I know that many webmasters are thinking of how to make there websites load faster, how to decrease the load on their servers and the common things we do is try to optimize our servers, implement caching solutions, optimize other back-end software such as MySQL. But how important is the server performance itself?
For today's blog post I would like to see how 3 actively developed web servers could perform out of the box running a PHP and MySQL CMS on my test server.
The three server candidates are Nginx, Cherokee and Lighttpd web servers.
To perform our benchmark tests we will be using Loadimpact free service that supports up to 50 simultaneous connections.
I have used a Virtual Server test box with the following parameters:
CPU: 4 cores @ 2.8Ghz
OS: CentOS 5
Wordpress-like CMS running on PHP and MySQL with loaded demo content.
No optimization has been made to the standard applications.
Before running the load tests here is how I thought this servers would line up:
1. Nginx - Runet's popular web server choice.
2. Cherokee - It's active development and the idea of a "very fast" server should put it in the second place.
3. Lighttpd - It wouldn't be "light" and preferred over Apache if it wouldn't perform well?
4. Apache - The King is dead. Long live the King!
Now lets see the benchmark results:
1. Nginx - Ah! Now that is an impressive result! It seems that Loadimpact was just not able to give it any challenge at all, while slowly the load does increase over the number of concurrent connections Nginx just keeps on serving content like nothing important is happening and the load difference is only 15% at 10-50 simultaneous connections.
2. Cherokee - Disappointing! I was able to find that Cherokee 0.3 dates back to December 29, 2002. So the project developers had more then enough time to make something impressive and looking at their release log, it shows that the server is being actively developed over 2010-2011. I might be wrong as I haven't been a sys-admin in 2003, but maybe it took the fate of Apache?
What was once a "very fast" server, is now just a bulk of server software that is no longer impressive? 44% in load increase from 10-50 simultaneous connections.
3. Lighttpd - While the 10 connections test was somewhat close to Nginx performance at 50 connections, the benchmarks date should be given some credit . And if we take a look at the load difference from 10-50 Simultaneous connections it is only 10%! And that is awesome! While I have never given enough credit to Lighttpd server for it's slow development and release schedule compared to Nginx, this benchmark has opened my eyes and I can say it is still a worthy opponent to Nginx web server.
4. Apache - Who killed my pig? Telling the truth, I didn't expect such a bad performance from Apache web server. While the result didn't shock me, I did make a second test to make sure that Loadimpact didn't give me a bad result due to their service load. Guess what? It died exactly the same way in a test that was recorded 2 days later. The difference in load from 10-20 simultaneous connections is around 44%.
Apache is build so it can "chew" anything it is "fed" with. There is no point to comment it's development and release schedule. In the first place I didn't even want to include Apache into the server comparison, but I am happy that I did. I think it clearly shows that if we could run all our websites and applications under web servers like Nginx and Lighttpd we could finally say good bye to Apache. It had it's glory days and I think it's time to let the King rest in peace!
If you are a webmaster, most likely you have seen log files of Netcraft bot browsing your websites. One of the statistics that Netcraft collects is your server version.
On February 15 Netcraft has published it's latest web survey results:
In the February 2011 survey we received responses from 284,842,077 sites.
Apache saw the largest increase in terms of both market share and absolute growth this month, with 9.6M new hostnames equating to a 1 percentage point increase in market share. This continues the general upward trend seen for Apache since January last year. The most significant increase occurred in the United States, where 7M new Apache hostnames were recorded. Once again, significant contributions to Apache's increase were seen at AmeriNOC (4.6M) and Softlayer Inc (1.3M). Apache also made a net gain of 817k hostnames in the Netherlands as the result of a 1.3M increase at Axoft Group.
nginx and lighttpd also made gains this month, although lighttpd's market share remained static as a result of the increases detected for the other major web server vendors.
Microsoft and Google both lost hostnames and market share this month. Microsoft's most significant loss came in Germany, with a 239k drop. This came as a result of 237k fewer hostnames being recorded at Kabel Deutschland.
Total Sites Across All Domains
August 1995 - February 2011
Market Share for Top Servers
Across All Domains
August 1995 - February 2011
Totals for Active Servers
Across All Domains
June 2000 - February 2011
Market Share for Top Servers
Across the Million Busiest Sites
September 2008 - February 2011
While Apache is still a leading web server on the market and sadly still getting more attention then it should, I am happy to see a very steady growth in popularity of Nginx server over the past years.
Even if developers and webmasters are using it as a front-end server to Apache with server management software like ISPmanager. It shows the flexibility of the server and ability to lower the maximum load a server can take, resulting in IT savings. With first release on October 4, 2004 now Nginx serves at least 8.7m active domains and has an 8.4% active domains share.
Sadly the second best web server - Lighttpd that has performed incredibly well in our benchmark only serves 0.6m active domains and has 0.6% of the active domains share. While I wasn't able to digg up the reason why this server was never picked up by the webmasters community, Wikipedia mentions it running very popular Internet websites!
Lighttpd is used by a number of high-traffic websites, among them Meebo and YouTube. Wikimedia runs Lighttpd servers as does SourceForge. Three of the most famous torrent listing websites, The Pirate Bay, Mininova and isoHunt, which have more than 1,000 hits per second, also use Lighttpd. Lighttpd currently holds fifth place on the Netcraft "Web Server Survey" (November 2010).
Let's hope that developers will not let their hands down and will keep improving the performance of their product and maybe Lighttpd server market share will increase in the future.
I also had high hopes for Cherokee project development, watching their release schedule we can see that it is under active development, but it's performance is just not impressive when we compare it to Nginx or Lighttpd web servers. It might do better for other stuff like streaming or even running Ruby on Rails applications, but this web server shouldn't be considered for PHP and MySQL applications. Despite Cherokee 0.3 dating back 2002, Netcraft doesn't bother to record the market share for this web server and lists it under "other" category.
Finally, I'm amazed to see Apache simply die out in both of the tests that I have performed. While I have picked a very popular and well written CMS with as low as 3 MySQL queries to generate a page, the result of Apache benchmark was surely unpredictable. Loadimpact has a 20 connection limit where it simply stops a test if it considers that a website might be overloaded in order prevent abuse of the third party services. Sadly according to Netcraft, people just don't want to let go of this server and awesome software like ViMP is still being developed solely for Apache.
For me this benchmark is a clear proof that developers should try to pick up Nginx or Lighttpd web servers for their products. Both servers are very easy to deploy and while they might not offer such important modules like mod_rewrite with directory rules, they have their internal modules that are able to generate FURLS (friendly urls) that are so important this days. The only thing the software developers should understand that by making their software compatible with light servers, they are able to offer greater functionality for there products without worrying about them generating high server loads (a very important factor for products that are meant for general audience and that will end up running on shared servers). This way the developed products would perform better with large databases and would be able to serve a larger audience while their clients could lower their IT costs by picking up virtually dedicated servers instead of requiring them to be used only on a powerful dedicated servers.
Nginx server homepage
Cherokee project homepage
Lighttpd server homepage
Apache server homepage
Netcraft February 2011 web server survey
Loadimpact service homepage
Last note: While I do believe that the minimum and maximum load averages shouldn't be taken to seriously, I do believe that this tests have showed server stability or instability and it allows you to do percentile load comparison from 10-50 connection and in case of Apache... for 10-20 connections.
Hope you liked the blog post!