Nginx vs Yaws vs MochiWeb : Web Server Performance Deathmatch, Part 2
Joe Williams - - January 04, 2009Updated: Retest data (using different machine and Erlang kernel polling) added to bottom of post.
Almost a year ago I did some Apache and Nginx performance testing. Apparently I have the bug again and have done some performance testing on Nginx, Yaws and MochiWeb. The latter two being Erlang based. Again deathmatch may be an overstatement but this is my attempt at gleaning some interesting performance data from some high performance web servers. Also, I attempted to improve the graphs this time around since they were a bit hard to read the last time.
The Setup:
I was not able to use the same server and setup as the last time, so comparing between this and my last deathmatch probably isn’t very accurate. For this test I used a Intel Dual Core 2.2GHz, 4GB RAM machine running Ubuntu 8.10 (64bit) and for the test server. Erlang (R12B-3), Yaws (1.77) and Nginx (0.6.32) are installed from the standard repository and mochiweb from subversion (rev 88). All are using the default configurations outside of adjusting listening port numbers. The test is again against a basic robots.txt file. The tests were done using a consumer grade 100mb switch and all tests originated from an old laptop I had laying around. I think that about covers the test bed, if you have any questions let me know.
For the tests I used autobench (httperf under the hood) with the following command, each test ran ten minutes apart. The order of the tests were done in was MochiWeb then Yaws and lastly Nginx.
autobench –single_host –host1 HOST –port1 PORT –uri1 /robots.txt –low_rate 10 –high_rate 200 –rate_step 10 –num_call 10 –num_conn 5000 –timeout 5 –file SERVER-results-`date +%F-%H:%M:%S`.tsv
The Results:
There are a few results from httperf/autobench that I would like to show, errors, network I/O, reply rate (and it’s standard deviation) and response time. (click on the graphs for a larger view)
MochiWeb and Yaws both seem to be the most consistent here. Nginx had a couple of funky spikes, I do not know if this was an issue with Nginx or with my tests and/or test bed. Take from it what you will.
Nginx seems to use a bit more network I/O consistently through the lower ranges of this test and then again as some spikes. MochiWeb and Yaws seem to have some inconsistencies as well.
The reply rate and network I/O graphs certainly seem to be tied, which would make sense. Edit: Average reply rate is average replies per second.
In the higher reaches of the tests Yaws seems to be most consistent.
MochiWeb seems to have consistently the highest response times with Nginx has the lowest. This also follows the data from the first deathmatch. Nginx had consistently low response times against Apache. Edit: Response time is how quickly replies are sent in milliseconds.
Next up are the system graphs, I have CPU usage (both cores combined), context switches, interrupts and load. To help read these please note recall that each test ran ten minutes apart and the order of the tests was MochiWeb then Yaws and lastly Nginx. The data was gathered using sar at five minute intervals and graphed using ksar.
It seems Nginx is the clear winner here. Kernel polling may be the answer here, a retest may be in order to see if it makes a difference.
MochiWeb and Nginx seem pretty even on context switches with Yaws a little higher. I suppose turning on kernel polling might make this a bit more even, since Erlang and Nginx both use epoll. This may also account for the CPU usage difference above.
Interrupts are fairly even across all of them.
Again Nginx takes it, again likely due to kernel polling being disabled. That’s my best guess anywho.
The data I used to create the graphs and etc is available here.
Let me know if you are interested in me retesting anything, I may try to enable kernel polling and try again if I get a chance.
Note that these are *my* experiences with each webserver, your testing and experiences may be different. As with most things there are pro’s, con’s, trade offs and pitfalls. The only way to find out what will work best for your environment is to test, test and test.
Update:
I performed the upper half of the tests again to see if there were any changes to sporadic jumps in the graphs http performance graphs. My initial test using the old laptop I saw the same results. I then ran the tests from a VM (running Ubuntu 8.10 in a KVM VM) on my dual core machine and found that the results were much more even. Unfortunately it’s the same machine that the webservers are running on but the results look much better. The first set is using the same setup as before but just adjusted to have the top half test. The second is the same test but with kernel polling turned on in Erlang.
All of them are very even and close, no real winners here.
Looks like Nginx is the clear winner with Yaws next, followed by MochiWeb.
Pretty much the same as last time (likely a little higher across the board due to running the tests in a VM on the same machine). Note that Nginx is a system process, so for Yaws and MochiWeb follow the blue line and Nginx follow the green.
About the same as before, other than being higher due to running a VM.
Pretty much the same as before again, Nginx seems the lowest.
Now for the tests with kernel polling enabled in Erlang (erl +K true).
With kernel polling on it looks like Yaws actually performs better in the reply rate test with MochiWeb performing worse and Nginx in the middle
In the response time test a huge change is noted, MochiWeb goes from roughly a ~14 ms response time at 2000 requests to ~65 ms. Also noted Yaws performs much better matching or beating Nginx.
With kernel polling in the Erlang webservers Nginx still seems to come out on top for CPU usage.
Following the performance trend we saw above Yaws sees a drop in context switches and MochiWeb increases.
Load-wise things stay roughly the same with Nginx being the lowest.
While it certainly seems that my old laptop that I did the original tests on is too slow or has a network issue, hopefully with these new tests we have some more clarity. It seems that Yaws improves with kernel polling enabled and competes well with Nginx. MochiWeb on the other hand apparently has issues with kernel polling and actually degrades performance. If anyone has more info on the internals of MochiWeb and possible causes I would be certainly interested.
If anyone would like the data from the second round of tests it is available here.
Categories: Blogs Joe Williams
Comments
You might want to try grabbing Yaws from its svn repository—I recently modified it to use the sendfile() system call via a new driver I wrote for Linux, OS X, and FreeBSD, which made it slightly faster and use significantly less CPU when delivering static content too large for its internal cache.
Posted by Steve Vinoski on 04 Jan 2009 at 02:07Cool, if I end up doing a retest I will give it a shot.
Posted by joew on 04 Jan 2009 at 03:09Well I’m not really familiar with these two, but I’m sure this will be great.
Posted by Speakers Agency on 11 Sep 2009 at 15:06Now i see that mochiweb is optimized well. Thanks for the entry.
Posted by gelinlik on 13 Sep 2009 at 23:40You should turn this into a formal research. It would be interesting.
Safety Training
After migrating from Apache/mod_python to nginx/flup on a VPS my Django sites began responding up to 10 times faster; overall system load decreased significantly. I couldn’t believe my eyes. After some months of testing I can say that, indeed, for a VPS this configuration is perfect. Not only nginx requires much less resources than Apache, but it’s also much easier to configure.
Florist in NJ
I would actually prefer Yaws over Nginx and Mochiweb.
Melaleuca
Earthtone9
After migrating from Apache/mod_python to nginx/flup on a VPS my Django sites began responding up to 10 times faster; overall system load decreased significantly. I couldn’t believe my eyes. After some months of testing I can say that, indeed, for a VPS this configuration is perfect. Not only nginx requires much less resources than Apache, but it’s also much easier to configure. thank you ..............
Türkiye’nin en büyük anne -bebek & aile yaşam platformu e-bebek ve Anadolu Ulaşım’ın işbirliğinde 1 Eylül 2009 tarihinde başlatılan, “çağrı merkezinden bilet alanlara çocuk koltuğu sağlanması”na yönelik uygulamaya olan ilgi artarak devam ediyor.
1 Haziran 2010 tarihinde yürürlüğe giren, ülkemizde oto koltuğu kullanımını zorunlu hale getiren yasa ile birlikte, seyahatlerde çocuk oto koltuğuna yönelik taleplerde ciddi artış yaşandığına dikkati çeken çocuk oto koltuğu Genel Müdürü Halil Erdoğmuş, ilerleyen dönemde bu talebin daha da artacağını öngördüklerinin altını çiziyor. hello
Posted by çocuk on 23 Jun 2010 at 21:59Karayolları Trafik Yönetmeliği’nde yapılan değişiklikle boyu 135 santimetre ve kilosu 36’dan az çocuklar için Çocuk oto koltuğu zorunlu hale getirilmesi ve uygulamaya aykırı hareket edenlere para cezası ve 15 ceza puanı uygulanması, kampanyaların alanını genişletti.
Posted by Çocuk Oto Koltuğu on 28 Jun 2010 at 09:23I think I’ve actually had better luck with Yaws somehow. Thank you for sharing.
Posted by Ronald Loves Nike Shoes on 10 Aug 2010 at 19:55The latter two being Erlang based. Again deathmatch may be an overstatement but this is my attempt at gleaning some interesting performance data from some high performance web servers…Transfer Test Northern Ireland
Posted by villash on 20 Aug 2010 at 08:56Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this.
search marketing
spy gadgets - Whatever your reason for visiting our site, we want you to know that we are dedicated to providing you with the very latest in cutting-edge solutions to assist in resolving your issues.
mens gadgets - At World Of Gadgets we are continually updating our range of exciting new gadgets gizmos and novelty clothing/items to accomodate all tastes.
Posted by jina on 12 Oct 2010 at 07:47Seems like a very thorough performance test. I wonder if the average user is going to be using it in the contexts you’ve tested.
- Mark @ Waterproof Socks
Add comment
Erlang on Twitter
» mshiba64 (Masami Shibatani): ということで、ErlangのBit Syntaxに突入。language for distributed and concurrent programだからね。
» despenjahatdos (Jon champion): Eits jangan salah begini2 saya titisan dewa erlang RT @yolapitalokaa: Yg ngepost twit kyknya jg lg galau drtd ... http://t.co/QfCyVSIl
» erlangtriaji (erlang triaji ): Sini sun ahahaha RT @Encays: Udah udah, lo berduaan aja RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aj
» Encays (antarif cahyadi): Menjepit RT @erlangtriaji: Tegang! RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh
» erlangtriaji (erlang triaji ): Tegang! RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget
» Encays (antarif cahyadi): Udah udah, lo berduaan aja RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama
» revianh (Revian Hermansyah): Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» erlangtriaji (erlang triaji ): Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» Encays (antarif cahyadi): Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» mshiba64 (Masami Shibatani): Erlangではシリアライズはterm_to_binaryというBuilt-in-functionで実行される。画像データもErlangで扱われるいくつかのTermも全てBinary型に可逆変換できる。
Statistics
Number of aggregated posts: 10454
Number of comments: 1392
Most recent article: January 31, 2012
Latest comments
» nobelboy on OpaDo Data Storage: Feel free to add some Qs here or contact me offline, and I will see what I can work into…
» darrensy on The Twisted Matrix: This has been a great idea you have shared. covers for kindle
» jony on Principle Software Engineer at LonoCloud (Full-time): That provides will become a internet marketer of little kinds of expert methods developers developing strategy using Erlang/OTP. There will…


















