[_] [BNM] Apache / Apache 2 / FastCGI / Lighttpd advice
Jay Caines-Gooby
jay at gooby.org
Mon Dec 4 14:24:37 GMT 2006
On 12/4/06, Dominic Mitchell <dom at happygiraffe.net> wrote: > 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? Kernel death and/or whole networking stack :-/ Sometimes the box reboots othertimes I have to use my remote re-boot capability as I can't ssh in. :P > 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... Ah. Thanks for these. > 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. Yeah, that's what the Codahale post covers. I'm working through it at the mo. > 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! Photos! Some good links there, thanks Dom. Also I've just stumbled over multi-master circular mysql replication and the magic auto_increment_increment and auto_increment_offset variables. Sweet! I've been scratching my head about replication between the two data-centres and this nails it :) -- Jay Caines-Gooby jay at gooby.org +44 (0)7956 182625 skype:jaygooby http://snipperoo.com http://blog.snipperoo.com