3 comments

[ 3.1 ms ] story [ 20.4 ms ] thread
I spent an entire day last week doing basically the same benchmarks on a new Linode account.

The results were definitely not what I expected. Both servers were able to crunch roughly the same number of requests per second. Nginx won by 20% in some situations, Apache won in a few others, but the margin was never really that significant.

However, it's important to note that there were huge differences in CPU load while running the benchmarks. Running "ab -c50 -n100000" would bring load to 30 with Apache, but only 0.7 with Nginx! Apache also used a lot more ram.

I assume there must be some other bottleneck (disk access?) keeping Nginx from utilizing more of the CPU, hence the fairly close results.

Well, Apache would definitely be using more RAM since the Apache process would be actually running/parsing/etc. the PHP. nginx just sends the request along to another process and so nginx shouldn't be using significantly different amounts of RAM from what it would normally use since all the PHP stuff is happening in a different process.
I also found Nginx to also be far easier to configure.