Mono Fast CGI on Apache 2.2.8 dies after ~1000 requests

View: New views
3 Messages — Rating Filter:   Alert me  

Mono Fast CGI on Apache 2.2.8 dies after ~1000 requests

by Luckyrat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am having a bit of trouble getting Mono to work reliably with Apache 2.2.8 and Fast CGI on CentOS 5 (with the latest package updates). I have tried with mod_fcgid 2.2 and 2.3.4 (from SVN) and see no similar problems when PHP sits at the other end of the mod_fcgid requests.

I have run load tests against the sample ASP.NET websites that were distributed with Mono 2.4.3.2 and see a consistent failure to get beyond around 1000 total requests (I can't put my finger on the exact number, maybe it's 1024). I am not referring to a limit on the concurrent requests but merely the total which any given mono process handles.

After about 1000 requests, the mono process grabs an entire CPU core and seems to sit in a busy wait loop. Judging by the output of "lsof | grep fcgi" I suspect it is waiting for the FCGI unix socket to become available - the number of handles held open by mono on the FCGI socket sky-rockets until it reaches about 1000. After the Apache FCGI daemon has determined that mono has timed out, it kills the mono process, starts a new one and the cycle repeats. Again, with PHP the number of handles that php-cgi holds open doesn't grow*. The memory usage also creeps up by a total of a few megabytes in line with the increasing number of requests that the mono process has handled but I don't know whether that is related to this problem.

I have found that setting the FcgidMaxRequestsPerProcess mod_fcgid directive to less than 1000 produces a slight improvement because apache pro-actively kills the mono process before it reaches this mystery limit but this still results in the full mono startup procedure being executed every 1000 requests which isn't that great.

I'll really appreciate any ideas on what could be causing this, how I could work around it more effectively or what further information I could supply to help us diagnose where the problem lies.

Many thanks,
Chris

* At least not beyond a handful, I presume heavy concurrent load would push it up slightly.

Re: Mono Fast CGI on Apache 2.2.8 dies after ~1000 requests

by Robert Jordan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Luckyrat wrote:
> Hi,
>
> I have run load tests against the sample ASP.NET websites that were
> distributed with Mono 2.4.3.2 and see a consistent failure to get beyond
> around 1000 total requests (I can't put my finger on the exact number, maybe
> it's 1024). I am not referring to a limit on the concurrent requests but
> merely the total which any given mono process handles.

This bug is already fixed in SVN trunk and Mono 2-6.

You can simply take xsp/src/Mono.WebServer.FastCgi/UnmanagedSocket.cs
from trunk and recompile your 2.4.3.2 xsp.

Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@...
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Mono Fast CGI on Apache 2.2.8 dies after ~1000 requests

by Luckyrat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Robert Jordan wrote:
This bug is already fixed in SVN trunk and Mono 2-6.

You can simply take xsp/src/Mono.WebServer.FastCgi/UnmanagedSocket.cs
from trunk and recompile your 2.4.3.2 xsp.

Robert
Thank you for the quick response Robert. I did as you suggested and the problem is indeed solved.

Chris