Ok. This is not so much as a part 2, but a revision of the last test. There were a number of flaws. One of the big ones was that I was running the benchmark on the same box as the server. So the benchmark was using around 90-95% of the CPU, leaving little for the server process. Also, it was pointed out to me that the server handles requests differently from 127.0.0.1, as well the networking stack takes away performance as well. So I fixed these errors in my new test. I used my laptop and my desktop. The laptop was running VMware Player to run the linux environment, and my desktop running Windows 7. More information on the hardware and the environment used is at the end of this post.
Ok, now to the good part!
It was pointed out to me that I did not label the graphs. They are measured in requests per second.
2-1-10: Updated formatting so it worked with my theme.
The 1st test I did was using a file called “small.png”. It was a ~5KB png file. Before I go on, I want the graph to do the talking.
Lighttpd started off strong (again). Lighttpd came in 1st place with Cherokee right behind. Each server is very close to another (performance wise). They are around .010ms per request apart, which is not a huge difference. Nginx fell behind, but still has respectable scores. Apache2 is just plan silly. Why is it used so widely?
Now these are using default configurations, but I think you could get a lot more performance out of Apache and nginx. So who takes this round? It would have to be Lighttpd, but I also have to say Cherokee. They are so close that there would be not a huge performance difference in a live site.
Now it is on to the 5kb JS file. Wait? Isn’t that the same size as the png? Well, yes it is Jimmy. And the performance data is about the same as well.
There is not much to say except that Lighttpd or Cherokee would be the better server for small static files.
ZOMG PHP!!1!!!!111!!!!!
PHP, the most used coding language for the web. I used version 5.26. Lets say each server handled phpinfo() differently, now I might try different configurations (like calls to the database, system functions etc…). I was kind of taken back with this test. I am surprised that Apache had such a low score. I thought that it was the most used, that there had to be a good reason. Well it looks like its not used for performance.
Before I get any comments (yea right). Nginx can not spawn PHP processes, therefore requiring php requests to be proxied to another server. PHP performance would (somewhat) reflect the performance of that server, so I did not include it in this test. But yea. Lighttpd and Cherokee led in this test, while Apache fell in behind. Now I do not know, but I do think you can increase php performance in Apache by using fastCGI, but I did not check what method Apache was using. Lighttpd and Cherokee was using fastCGI. Please note. PHP was not modified in any way so the performance reflects stock config.
On the 2nd to last test, I used a 1mb png file. Now this was a layered png made in fireworks. I don’t think it would effect performance, but just a heads up. Now in this test each server was very close in performance. Cherokee came in 1st place with nginx right behind. Lighttpd and Apache were the same.
There is no real winner here, but Cherokee takes this one, if just by a small margin.
Ok, so the finial test. The last test I used a 10mb zip file. Apache2 and Lighttpd were the lowest preforming servers in this group.
Nginx was very good as well as Cherokee. Now looking at the data, each server is still VERY close to another.
So who wins? Well let me 1st say: APACHE DOES NOT WIN!
Every other server has areas of good performance, and lesser. It is really between Lighttpd and Cherokee. Nginx is good, but it is still new, and can not handle PHP. Also it was slower than the other servers. Now where it will be be in a year or so? Who knows. Lighttpd and Cherokee are both very good. So which one is better?
Well in raw data terms, Lighttpd takes the cake (also they are active in development). Cherokee is a great server as well. I like it more because it has its own control panel. Yes, you read that right. And not a crappy little does-not-really-help-you-in-any-way control panel, but i-has-total-control type of control panel.
The finial verdict: Lighttpd or Cherokee
Hardware used:
- Server
- Debein 5.0
- 2.1GHz Dual core AMD Turion x2 (one core to server)
- 4GB of ram (256mb to server)
- VMWare player
- Host
- Windows 7 (Retail build 7600)
- 2.5GHz Dual core Intel Pentium
- 2GB of ram
- Server software
- Cherokee .7
- Lgihttpd 1.4.19
- Apache 2.3.3
- nginx/0.6.32
In your graphs, what are you measuring? Is it seconds for 1000 requests?
I think the reason Apache is used so widely and is so much slower is the vast array of modules and configuration you can have. By being able to configure Apache at the directory level you have much better control and optimization of things.
Lighttpd might be great for a large site that has a dedicated server and will be the only thing running on it, but when you lose the ability to customize it makes it much more difficult to have things the way you want them.
This is quote accurately summarizes the differences:
Apache is a winner in terms of features and modules available, so it is like Swiss Army Knife, you can do whatever you want with it.
Lighthttpd, on the other hand, is small, so its memory and cpu consumptions are smaller.
But it doesn’t provide you with flexibility of Apache.
Right now, huge traffic sites mainly use a combination of Apache and Lighthttpd, letting Apache to serve dynamic content (php, etc) and leaving all the static files (images, js and css files) to lighthttpd
What are you using to test the servers because I am interested in running my own tests to see what would work best for me.
I am using ab.exe which can be found in the Apache bin directory (just ab on linux systems). You can see above what hardware I used.
I do have to agree that Apache has a lot of different add-ons, but Lighttpd (and Cherokee for that matter) have a good wealth of expandability options.
Also, have a file that list the averages that I got during testing, which I will post once I find my flash drive.