[Ruby] Good alternatives to Mongrel?

Eric Hodel drbrain at segment7.net
Sun Jan 6 16:23:20 PST 2008


On Jan 5, 2008, at 16:36 PM, Scott Windsor wrote:
> On Jan 5, 2008, at 11:23 AM, Phil Hagelberg wrote:
>> Scott Windsor <swindsor at gmail.com> writes:
>>> I'd look into running rails as a fast cgi app, and then picking a
>>> webserver that you can configure with fastcgi (apache, lighttpd,
>>> nginx, etc).
>>
>> Last I checked FastCGI caused a lot of random crashes that were
>> extremely difficult to debug, and forward development on it had
>> basically ceased. Unless things have changed drastically in the past
>> year, I would strongly warn anyone against using it. (Ever tried to
>> deploy on Dreamhost? They only allow FastCGI, and it's a total
>> nightmare.)
>
> Make sure you're using mod_fastcgi, not fastcgid.  fastcgid is more
> unstable than a monkey on crack, but a lot of people use it because
> it can be slightly easier to configure.  Avoid this trap!

Beyond the configuration problems I usually have with Apache, I've had  
no problems with Apache and FastCGI in general.  (I almost always do  
something wrong with configuring Apache.)

I have found mod_fastcgi to be unstable on Apache 2, but this was  
three years ago.  It had nothing to do with FastCGI + Ruby.  Maybe  
they've fixed mod_fastcgi, or there is better backwards-compatibility  
in Apache 2 for modules written for Apache 1.

I've been using mod_fcgid on Apache 2.2 with zero problems for my  
personal projects.

I never had any issues with mod_fastcgi and Apache 1.3 performance or  
stability while working for two years at The Robot Co-op on  
43things.com.  They're still using Apache 1.3 with mod_fastcgi 2.4.x  
with, AFAIK, no problems.

Here's a ps listing for the Rails processes from one of their web  
servers:

40864 www          1 101    0   202M   197M CPU3   2  20.3H  9.77%  
ruby18
22238 www          1   4    0   201M   195M accept 0 866:58  4.64%  
ruby18
57765 www          1  96    0   140M   135M select 2 289:36  3.71%  
ruby18
58972 www          1 100    0   137M   131M select 3 286:25  7.32%  
ruby18
59782 www          1  97    0   138M   133M CPU1   1 283:44  4.83%  
ruby18
99346 www          1   4    0   133M   127M accept 1 133:33  4.00%  
ruby18

20 hours of CPU time for that top process, while the newest has  
consumed just over 2 hours.  About 8.5 hours average CPU time between  
restarts.

While there may be issues with FastCGI in Ruby, I've never experienced  
them.  For my blog, I've had two non-normal exits while using FastCGI  
for the past 11 months, both of them Errno::EPIPE in the fcgi handler,  
which probably means that my blog was transmitting data to somebody  
and I shut down the web server.

Oh, I've never used fastthread either, unless it was built-in to  
ruby.  43things.com isn't using fastthread (is using ruby 1.8.5).

Also, I've always run on FreeBSD, if that makes any difference.


More information about the Ruby mailing list