Fcgid.conf - Photo uploads

My network guy is saying that fcgi is built for short lived processes.
I’m running up against the limit of DefaultMaxClassProcessCount which
is set to two, on the third picture upload it’s dying, and returns a
503. The implication is that either I build a separate RoR application
that only uploads photos and run CGI, or switch to PHP for uploads and
downloads.

Has anyone else run into this?

Is there a way to monitor the number of processes used, so that I can
manage the resource?

The access_log shows

x.x.x.x - - [13/May/2007:11:43:40 -0400] “POST
/item/create?item_class=Photo&noredirect=1 HTTP/1.1” 503 408 “-” “”

My mod_fcgi setup is:

AddHandler fcgid-script .fcgi
SocketPath /var/lib/apache2/fcgid/sock
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 10 --> i moved this up to 40
DefaultMaxClassProcessCount 2 --> i moved this up to 10
IPCConnectTimeout 8
IPCCommTimeout 60
DefaultInitEnv RAILS_ENV production

and the error I’m getting in my apache error_log says

[Sun May 13 11:43:44 2007] [notice] mod_fcgid: too much
/var/www/deploy/current/public/dispatch.fcgi process(current:2,
max:2), skip the spawn request

I notice also in my production log that the third request for a photo
upload crashes, and then just continues on with the fourth:

Processing ItemController#create (for x.x.x.x at 2007-05-13 11:43:40)
[POST]
Session ID: s
Parameters: {“Filename”=>“somerights20.png”, “item_class”=>“Photo”,
“_session_id”=>“s”, “action”=>“create”, “Upload”=>“Submit Query”,
“controller”=>“item”, “noredirect”=>“1”,
“item”=>{“filename”=>#StringIO:0xb77c5738}}
Completed in 1.32691 (0 reqs/sec) | Rendering: 0.00011 (0%) | DB:
0.16443 (12%) | 200 OK [url]

Processing ItemController#create (for x.x.x.x at 2007-05-13 11:43:42)
[POST]
Session ID: s
Parameters: {“Filename”=>“TIJ4.jpg”, “item_class”=>“Photo”,
“_session_id”=>“s”, “action”=>“create”, “Upload”=>“Submit Query”,
“controller”=>“item”, “noredirect”=>“1”,
“item”=>{“filename”=>#<File:/tmp/CGI.28857.2>}}
Completed in 1.20233 (0 reqs/sec) | Rendering: 0.00011 (0%) | DB:
0.04595 (3%) | 200 OK [url]

Processing ItemController#create (for x.x.x.x at 2007-05-13 11:43:44)
[POST]
Session ID: s
Parameters: {“Filename”=>“Backgnd.gif”, “item_class”=>“Photo”,
“_session_id”=>“s”, “action”=>“create”, “Upload”=>“Submit Query”,
“controller”=>“item”, “noredirect”=>“1”,
“item”=>{“filename”=>#StringIO:0xb7c7655c}}

Processing ItemController#create (for x.x.x.x at 2007-05-13 11:43:44)
[POST]
Session ID: s
Parameters: {“Filename”=>“CodeCapsules.jpg”, “item_class”=>“Photo”,
“_session_id”=>“s”, “action”=>“create”, “Upload”=>“Submit Query”,
“controller”=>“item”, “noredirect”=>“1”,
“item”=>{“filename”=>#<File:/tmp/CGI.28857.5>}}
Completed in 0.86467 (1 reqs/sec) | Rendering: 0.00010 (0%) | DB:
0.03867 (4%) | 200 OK
[url]