Apache, nginx, or lighttpd? [closed]
I am going to be live blogging from an event and expect huge spikes in traffic. I am currently using apache with modphp and it died last year under heavy traffic and I don't want it to happen again.
I am thinking of setting up a separate VPS for this blog running on wordpress.
What http server should I use? apache, lighttpd, or nginx?
Which will perform the best under heavy load?
The content will be very dynamic with AJAX updates.
Lighttpd or nginx is probably the right way to go about this. Personally, i'd choose nginx.
Don't forget to heavily optimise your application too. Cache query results with memcached.
Further optimisation can be made by serving your images, js, and css from a seperate cookie free domain. Following the tips in that guide will set you well on your way too.
You could front your webserver(s) with Varnish to cache static page data. If you really want to go all out, serve your images,js and css from a CDN.
Depending how much traffic you get (or expect to get); you might need to consider multiple front-end webnodes, in which case, Varnish can act as a pretty damn good load balancer.
I've said it before, and I'll say it again. If you expect traffic spikes, and demand uptime and no outages, perhaps you could look at an Amazon EC2 with AutoScaling offering. It's likely to be more efficient than building your own solution, especially if you're not expecting the traffic to persist all year.
Also, you haven't said whether you're using a VPS or a physical machine. I've found that VPSes suck for high traffic sites, because there's often IO contention issues, causing high IOwait times. For high-availability, you really can't beat dedicated hardware, dual NICs, redundant network infrastructure, etc.
All depends on your budget, I suppose.
Nginx or lighttpd are sure bets. You can configure Apache to be more competitive by using the mpm-worker module in place of prefork. However, this requires configuring php to use fastcgi or the like; that's probably a smart idea in and of itself.
I personally run wordpress using nginx with php-fpm and it's fast as hell.
There are some optimizations you can make regardless of which web server you choose.
- Enable/install APC, the php opcode cache.
- Enable mysql query caching
- Install WP Super Cache and serve up static versions wherever possible.
Test the setup under simulated load to make sure it doesn't bork out.