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.

closed as primarily opinion-based by Chris S Mar 31 '14 at 3:47

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


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.

  1. Enable/install APC, the php opcode cache.
  2. Enable mysql query caching
  3. 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.


We previously had an apache2 setup with about 200 vhosts (1 per client) which proxied to one of 4 load-balanced backend servers. We found that with both mpm-worker or prefork, Apache2 used a Huge sum of unshared memory per each connection (20-30 mb ea, almost 400-500mb total, just for the front-end!) (mpm-worker seemed to fluxate multiples of that number based on maxclients) We didn't have the RAM do dedicate to a large idle pool of front-end workers, and constantly hit max load on a weekly basis on our machines.

We then switched the front-end to nginx. I have it configured to take a max of 4096 connections (similar to max clients on apache), and it's using 30mb ram. It continues to run and deliver adequate response in heavy-swap conditions. We were able to nearly double our max simultaneous requests. We only hit max load on deadline days, and even then we can tweak our backends to give those clients priority.

In hindsight, using apache2 as a load balancer/proxy was probably unwise, but it's what we ended up with after years of evolution. We clearly outgrew it, and nginx came to the rescue.

Remember this is just anecdotal evidence, but you'll find similar success stories with any of the event-based servers (lighttpd or nginx)


welcome to this site.

I'm sorry if I disappoint you, but your site could crash under high load again. Any server has a limited capacity. A VPS has only a fraction of the capacity of the full server. And you don't know how high your load will become.

content will be very dynamic - AJAX updates

Note that this can dramatically increase the load on the server; depending on the implementation.

To answer your question, using nginx alone, or nginx as a proxy in front of Apache as Espennilsen wrote, are probably the best solutions of the ones you mention.

CarpeNoctem's suggestions are also solid. WP Super Cache is a common recommendation for speeding up Wordpress in a simple way. If you follow my suggestion below, then the benefit from WP Super Cache is reduced.

To really get performance on a budget, you should:

  • disable the AJAX
  • as best possible disable any Wordpress plugins that query the database often.
  • place a pure HTTP proxy cache such as Squid Cache in front of your webserver (Apache).

Squid can be configured to keep the full webpage output from Wordpress in RAM, and 'refresh' it from Wordpress after a given time. This means the same version of the webpage is served to all users without change for a short while, but in the meantime Squid can serve the webpage from RAM. This is dramatically faster than hitting the webserver and executing Wordpress for each page request.

Setting up caching is tricky and takes some knowledge. Using a professional sysadmin with past experience in this field would be recommendable.

  • Not sure why you recommend disabling AJAX. If implemented properly, it can avoid full pageloads by automatically reloading only the relevant changes. The risk is in the fact that the client keeps polling for changes, but that may be preferable to users hitting F5 all the time. Serve those AJAX queries from a Varnish cache and you can deal with a lot of traffic. – Martijn Heemels May 7 '12 at 22:04
  • @Martijn Heemels: This is an ancient question, without good facts to go on. :-) Generally speaking, AJAX and HTTP Keepalive dramatically increase the number of open HTTP connections against the server, compared to the classic open connection - retrieve page - close connection model. And each open IP connection consumes RAM on the server, for connection buffers etc. And VPS servers are generally short on RAM. All of this can be counter-acted by adjusting the design, of course, and I do agree that AJAX is an improvement for the end user. – Jesper Mortensen May 8 '12 at 12:51

I just went from apache2 prefork to nginx php through fastcgi. There truly is no comparison, the nginx default setup is just simply able to handle many times the requests of apache with prefork. I could have gone with apache2 mpm worker php through fast cgi, but I installed the nginx on the same server but with a different port to fully test everything out before switching the site to it. I now may redo apache2 with mpmworker and fastcgi and compare.

My overall thought is that apache2 mpm worker fastcgi would work just as well for me.

You can do some load testing using http://loadimpact.com, where my apach2 2 setup could not make it to finishing 20 users and the nginx completed the 50 users with practically no load. BTW my setup has just 128MB RAM with 1GB swap.

  • The load impact site is a very nice tool cheers – seanl Mar 26 '10 at 11:14

your php app will be the bottleneck with all 3 choices. I have setup multi-billion hit sites fine with apache.