Posted by eli on July 11, 2008 at 4:17pm
Anybody have an experience using alternative web server configurations with Drupal?
I'm currently using Apache 2.0.x & mod_php to serve Drupal 5 along with a separate Lighttpd install for static content. Lighty's been doing such a good job with the images, I'm considering running Drupal on it too with FastCGI. Anybody have any experience with that? Was there a noticable performance benefit?
What about ngnix?

Comments
Some thoughts
People get frustrated with how much memory Apache takes, and switch from mod_php to FastCGI, then explore Lighttpd, then the memory leaks become troublesome, then they try nginx, then ....
Finally, they come back to Apache to mod_php, which is the most stable and feature rich.
I have seen this pattern a few times. Even Drupal.org used to run under FastCGI, now is back to mod_php.
Would like to know from those who have stuck to lighty or ngnix how they are doing and whether they will persevere.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
I suspect you're right. I
I suspect you're right. I should probably just go about it from the other end and try to move some of the other things off of Apache. We're also loading mod_perl and mod_python for other apps (not to mention mod_dav_svn and all the "usual" stuff) so the Apache processes are getting pretty out of hand.
Compartmentalize it.
Compartmentalize it.
Make the Drupal site live on its own server, and disable all the non PHP stuff. A minimal configuration is mod_php and mod_rewrite. Remove all the python and perl stuff.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
We have been using lighttpd
We have been using lighttpd for ww.rue89.com without any problem for around 9 monthes and we are not planning to switch back to Apache.
We are serving around 10M pages/month, the site have quite a lot of modules activated. We can support strong burst (last week we served ~ 1M page a day).
Our configuration :
lighttpd 1.4.13 - PHP 5.2 - APC - MySQL 5.0 - memcache 1.2.2
Damien Cirotteau
http://www.rue89.com
APC
Thanks! That's good to know.
Incidentally, do you use the APC module? Because it doesn't seem to work so hot. Seems kind of abandoned actually.
edit: Nevermind. I found Cache Router
We use APC only for opcode
We use APC only for opcode caching, so we don't use the APC module.
All the drupal caching is done in memcache.
Do you have some feedback on using Cache Router (to cache in APC isn't it) over memcache ?
Damien Cirotteau
http://www.rue89.com
still testing
I've only just started testing Cache Router on our development server. It's neat because it supports several backend caching mechanisms. So you could have variables cached in APC, but pages cached in memcached. Or quickly make changes.
The bad thing is that the author basically had to fork and refactor all the backend caching modules to make it all work together. Which is a good thing for APC (since the official modules stinks) but probably a bad thing for the memcache module.
No
Not really.
The author of Cache Router (Steve Rude) is one of the maintainers of memcached. His vision is to obsolete, supercede and unify all caches in one modules, including memcached.
So, it is a good thing to do.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Nice to know
Did you ever experience memory leaks in lighty?
On Apache with mod_php, and APC, and memcache, we serve over a million page views a day, and up to 21 million a month from a single box.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
We don't have memory leaks
We don't have memory leaks with those versions of lighty and PHP (lighttpd 1.4.13 and PHP 5.2.0).
We are running a multi-box configuration (3 load-balanced application servers + 1 mysql (+1 mysql in failover), but the site is feature heavy (and have the "all you can eat" modules syndrom...) and is running pretty well.
Damien Cirotteau
http://www.rue89.com
Zeus and FastCGI
For several of our larger-scale sites, we have deployed the commercial Zeus Web Server (ZWS) with a bunch of FastCGI processor machines that run behind a load balancer. Files shared over NFS, MySQL on a separate server(s). Works like a charm, no stability/memory/leak/etc issues what-so-ever, and to scale up we just add more processing servers.
We definitely ran into lock-up/runway process issues with Apache and FastCGI. YMMV.
Not sure what advantage going with mod_php would really provide, although there are some advantages (KISS) to load balancing "just" HTTP traffic rather than remote FastCGI requests on the back end.
No matter what you use, ensure that your Apache processes are lean. No sense in creating more process overhead.
FastCGI konfiguration is
FastCGI konfiguration is complicated and a good PHP Version must be found.
example: PHP 5.2.5 has several Bugs and produces memleaks and breakdowns.
PHP 5.2.4 or 5.2.6 is stable and can be used as FCGI.
I am running the follwing setup for several month on two server, without any problems. (1 as production and 1 as Development and benchmark test server)
Lighhtpd 1.4.19, PHP 5.2.6 (with APC and Memcache), Mysql 5
http://www.arbeitsplatz24.com - http://www.conews.de - http://www.sumacom.de
I like Lighttpd and nginx
I've been using lighttpd for almost 2 years and I was quite happy with it.
Yes, there have been quite a few memory leaks, but the current stable (1.4.19) seems to have no such problem (or at least not a major one). Another thing is that there is no check for 'if file exists' in rewrite rules and you have to use mod_magnet slightly reducing performance or create some really strange and complex (compared to apache & nginx) rewrite rules.
Also there is no graceful restart - there is no way to reload configuration without restarting lighty, which if you allow lighty to start it's own fastcgi processes means all php-cgi processes get killed and started again with all the consequences (like APC/xcache/etc having to rebuild oo cache).
All this is just nuisance and I would have stayed with lighttpd if it was all - the performance advantage over Apache is huge, especially if run with Fam/Gamin. The one thing that forced me to move to nginx is the limited ability of lighttpd to recover after MAJOR traffic spike. If there is enough traffic to overload all php-cgi processes it is very likely that.. server load will drop to near zero and only static content will be served until both lighttpd and all fastcgi processes get manually killed (with kill -9 - anything less wouldn't work) and then started again. This happened to me twice from the very beginning with lighty to about 3 months ego. Then a bunch of script kiddies started sending up to 2000 requests per second in batches lasting 2-3 seconds - it was enough to kill 4 core server each time and it stayed dead until it was lighty and fastcgi was killed -9 and started again. There was absolutely nothing I could do to prevent it (each request was from a separate IP - they were using zombified PCs) - automatic detection & restart wasn't really a solution, but got 95% angry users of my back for just long enough for me to learn how to use nginx.
After 3 months with nginx I can say that:
- it is faster than lighty -the difference isn't big, but it's there
- it has a steeper learning curve than lighty and there is almost no community help available - even documentation in english is a very recent thing! (when I started with lighty nginx documentation was russian only)
- rewrite rules are less complex compared to apache (in simple cases) and can be really complex if you want to (meaning you do get A LOT of options you can really use if you want to) - and you get 'if the file exists' check
- rewrite rules parser only stops on obvious and very serious mistakes - if writing a more complex set of rules you will spend quite a while trying to figure out why X doesn't work if no error was reported (and usually find out that rule was simply and quietly ignored due to errors)
- graceful restart is absolutely fabulous. Not only you can reload configuration without restarting, you can even replace nginx binary without having a 1 millisecond downtime
- it finally is easy to set all the server-side stuff that yslow was moaning about
Thanks, that's helpful
Thanks for taking the time to write that up, Etanol.
Our websites also tend to have significant spike. We send out email newsletters to a large number of subscribers. And a significant portion of those people open the email and click through to our website as soon as they get it (i.e. all at the same time). We've also had constant problems with rogue web crawlers that hit the site hard from a whole block of IP addresses (One thing I'll miss about leaving apache it mod_security -- what a great module).
Ngnix sounds very interesting. If I can get it up & running on our dev server, I'll be sure to post some benchmarks. My one concern is that Ngnix might be a tough sell on my colleagues (they though I was crazy to even consider non-Apache servers), but if it's as fast as everyone says it is, I think I could make it work.
Benchmarks are on the way
I've spent couple hours today to make yet another linux box out of spare parts and first thing tomorrow I will be setting up for major benchmarking if everything goes as planned there will be a comparison of:
Apache1+mod_php, Apache2+mod_php, Apache2 + fastcgi, lighttpd 1.4.19 + fastcgi, lighttpd 1,5 (dev) + fastcgi, nginx 0.6.32 + fastcgi, nginx 0.7.8 (dev) + fastcgi. If I have enough time I'll even give litespeed a try.
All those will be tried with: no oo cache, apc, xcache and different drupal cache settings.
That will give a total of 144 tests (8 web server/php configurations, times 3 opcode options, times 3 drupal cache setting, times 2 drupal versions) and I should repeat each of them couple of times to ensure no random factor has influenced the results, so give me a while ;-)
Varnish
You might want to look at varnish http://varnish.projects.linpro.no/ we have used it in production here and it does a VERY good job. It is very fast. I know that dobbles your testing, but we have had very good luck with it.
Isn't varnish a reverse
Isn't varnish a reverse proxy? If I were to include reverse proxies as well I'd have to test at least squid, pound and nginx in reverse proxy configuration. That would be almost 600 different tests. Unless I design some kind of automation to perform the tests and gather results proxies will have to wait.
Another argument against testing reverse proxies it that I have very little experience with them and my misconfiguration is very likely to change the results. Luckily that is not the case with all software mentioned in previous post.
Benchmarks in progress
20% of the tests done. 2PCs, some shell scripts and I should have the results by tomorrow morning. Some more nasty code and I should be able to get all the results (currently saved separately) as a single CSV file - and then it's just making pretty charts in Open Office Calc ;-)
benchmarks still in progress?
Etanol,
do you have your benchmarks ready?
Would be interested in
Thanks