[BNM] Apache / Apache 2 / FastCGI / Lighttpd advice

Dominic Mitchell dom at happygiraffe.net
Mon Dec 4 13:59:14 GMT 2006


On Mon, Dec 04, 2006 at 01:05:01PM +0000, Jay Caines-Gooby wrote:
> My current webserver setup is Debian Sarge with Apache2 and Ruby & PHP
> both run from FastCGI.
> 
> The main box is crashing on a random basis and I'm now ready to point
> the finger at Apache2 + FastCGI, which anecdotally is known to be
> "unstable at times".

What does "crashing" actually mean?  Apache dieing? some bits not
responding?

> I've just read http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/
> and my head's spinning a bit.
> 
> Before I reach the point where I can't change my backend, I'd like to
> get a stable, scalable server set-up. It must run Rails & PHP.
> 
> Currently I'm tempted to just ditch Apache entirely and go down the
> lighttpd + fastcgi route, but I also like the look of:
> 
> http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/

James Duncan Davidson has been through similar troubles and explained
them quite well.

    "Deploying Rails with LightTPD"
    http://blog.duncandavidson.com/2005/12/deploying_rails.html
    "Real Lessons for Rails Deployment"
    http://duncandavidson.com/essay/2005/12/railsdeployment
    "Virtual Hosting Rails Applications with LightTPD"
    http://blog.duncandavidson.com/2006/01/virtual_hosting.html
    "Deploying Rails with Apache 2"
    http://blog.duncandavidson.com/2006/01/deploying_rails.html
    "Rails on Apache with mod_fcgid"
    http://blog.duncandavidson.com/2006/02/rails_on_apache.html
    "The Web Is a Pipe"
    http://blog.duncandavidson.com/2006/06/the_web_is_a_pi.html

The last one is most worthwhile reading, I reckon...

> Anyone been through similar growing pains and want to share the love?
> 
> The common thread between the two posts linked above is that both
> mention Apache and mod_proxy as a front end. Any Zope people care to
> comment?

I don't have experience with any of this at any professional level, just
the rails app I use for my blog (typo).  I run Apache 2.2.3 and rails
1.1.6, along with some PHP (mostly just for squirrelmail).  I was
getting very fed up with FastCGI as I would get random failures between
Apache and the backend rails processes a lot.  I wasn't able to
successfully diagnose these, in large part thanks to the utterly opaque
nature of FastCGI.

So I switched to mongrel and haven't looked back.  I run mongrel on a
high port and use mod_proxy to forward traffic to it.  I've had no
troubles with it at all.  However, this isn't a performant setup.
Because rails under mongrel is single threaded, you really need to run
mongrel_cluster to run several instance of mongrel at a time, and
use Apache's mod_proxy_balancer to load balance between them.  Or at
least, that's what I've heard.

    http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel
    http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

Good luck getting it all sorted.
-Dom

P.S. Thanks for the snipperoo t-shirt -- wearing it now!



More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service