5 ms·
Nginx vs. Apache in AWS
- linuxsec 14y agoNginx rulez... end of story!
- manoleet 14y agoLighttpd is missing... but good benchmark anyway.
- niggler 14y agoGiven the usage numbers (looking at netcraft) the two most popular engines were compared. Its a fair comparison, especially when you note that IIS doesnt run in linux. Lighttpd isn't even big enough to warrant a mention http://news.netcraft.com/archives/2013/02/01/february-2013-web-server-survey.html http://news.netcraft.com/archives/2013/02/01/february-2013-w...
- nodesocket 14y agoI actually really like the lighttpd config structure, but its not actively maintained and doesn't have the amazing community that nginx has. It is clear that nginx has won the high performance web-server battle..
- raylu 14y agoThe sensible config syntax is the reason I still use lighttpd. http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/IfIsEvil
- papsosouid 14y ago>Lighttpd is missing That's like saying thttpd is missing. It isn't tested because it isn't relevant.
- lemcoe9 14y agoWhy exactly did they limit nginx to one worker proces?
- cbsmith 14y agoYeah... I came here to write this too. Seems just silly. Makes even less sense that not comparing with Apache 2.4.
- machbio 14y agoI came here to write the same thing.. Worker Process 1; - for nginx on 2 cores Nginx Php ???? - you have not mentioned what PHP config you are running on Nginx The Benchmarking needs to get better, this thing keeps on happening
- webosb 14y agoi feel the same way... 1 worker process??
- karavelov 14y agoEven with one process/worker, so without any parallelism, nginx is faster than apache most of the time. If you want to make a meaningful comparison you should set the workers to the number of CPUs the OS sees (hyperthreaded or not).
- ck2 14y agoIf you are going to test Apache at least use 2.4 in MPM-event mode so you are testing apples to apples. Using Apache 2.2 in worker mode is like comparing 8 year old tech to modern code. hint: Apache is still about 15-20% slower than nginx even in it's fastest mpm-event mode, but it has many more years of features and modules available - it all depends what your needs are - single site services vs multi-site webhosting You can always do the best of both worlds by proxying apache with nginx if you need both. Takes one evening to figure out.
- niggler 14y agoIt's fair insofar as Debian still ships with 2.2 (2.4 in experimental)
- INTPenis 14y agoI wouldn't call Debian Sta(b)le fair testing. Ubuntu is a slightly better but to be truly fair you should use the latest stable production branch of each program. Or dev if that's what you're testing.
- niggler 14y agoThe parent argued that the comparison is unfair, but those are the versions you would get from Debian (apt-get install nginx-light apache2)
- j-kidd 14y agoWell, the title is "Nginx Vs Apache in AWS", not "Nginx from apt-get Vs Apache from apt-get in AWS". If you can't install the latest stable releases, then don't write a comparison about them.
- niggler 14y agoI don't know what versions are provided by the "amazon Linux AMI" (which the article cites as the image) but I would venture to guess that those are probably the standard (which would make the title apt)
- nthitz 14y agoGood research and writeup.. But 3D bargraphs... Come on!
- arooaroo 14y agoI'm sure there's a good reason why Apache 2.4 wasn't in the comparison but the author failed to mention it. Apache 2.2.23 may be a recent release but it's a security update of an old but stable branch. Apache 2.4 branch is a year old and a significant update including performance improvements to complete with the likes of nginx. I would still expect nginx to "win" but seems a fairer comparison somehow.
- gingerlime 14y agoI think one of the less obvious conclusions here is how important caching is for wordpress, both with nginx and apache. I wish this test also covered W3 Total Cache though. I know it's hard to test all possible permutations. One of the biggest issues with wordpress in particular however, is that whilst it can run with nginx happily, it is written primarily with Apache in mind. And many plugins rely on it too. I got it to work fine with nginx, but it somehow still felt rather experimental. Perhaps it's just me. I wrote a similar post from a slightly different angle, comparing the cost/benefit of adding different caching layers. This included W3TC and varnish on both apache and nginx, and using a cheap shared hosting. http://blog.gingerlime.com/2012/how-much-cache-is-too-much/ http://blog.gingerlime.com/2012/how-much-cache-is-too-much/
- peterwwillis 14y ago"Here is a benchmark that shows the performance of a watermelon and a large canteloupe lobbed from a trebuchet using different kinds of wood and rope under different wind conditions. We tied random weights to each melon for no apparent reason." What the fuck is the point of a performance benchmark if you didn't tune any settings for performance?
- emn13 14y agoIndeed - this doesn't tell you anything. Was nginx configured well? Was apache? How much difference would it have made? Is the old apache version relevant? Pointless test, unless you intend to use those settings on that software on similar hardware.
- roldenburger 14y agoAgree, you can only compare both, if both are tuned for optimal performance for the specific situation.
- peterwwillis 14y agoHell, it would have been great if they had used a real closed testbed on a local network instead of AWS. That would give you reproducible test results that aren't influenced by things like communal server resources and a communal network. Regardless, they put zero thought into what makes each application work to its peak performance and just picked two random configurations, probably based on defaults that we know to be poor on Apache and advantageous on nginx. Using worker instead of event just adds insult to injury.
- taligent 14y agoCall me stupid. But maybe Apache shouldn't ship defaults that have poor performance ?
- peterwwillis 14y agoWell stupid, Apache ships with the default settings it does for historical expectations of its users. But the application's tuning is driven largely by how you use it, as there are several workers for Apache that all are useful in different situations and require vastly different configuration options. This is to say nothing of the kernel options which also need to be tuned to the application. The defaults are just defaults. They need to be changed to improve performance.
- moe 14y agoIt's posts like this making it to the frontpage (and the inevitable comment thread) that make me sad about what HN has become. What happened to the idea of making submissions (and comments) cost karma points anyway?
- deleted 14y ago[deleted]
- peterwwillis 14y agoWhiny comments like this make me sad, but luckily I know they don't reflect on the community as a whole.
- colmmacc 14y agoDisclaimer: I work at AWS, I'm not speaking for my employer. I also helped write Apache httpd, and I'm not speaking for Apache either. Just on my own behalf. The Apache configuration in the benchmark isn't great, using values of; MaxClients 400 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 means that Apache will be doing extra work to spin up and spin down threads in response to the load. It's best to keep everything static, e.g. MaxClients 1000 MinSpareThreads 1000 MaxSpareThreads 1000 ThreadsPerChild 25 That way there aren't additional clone() calls when under load (when you least need it), the maximum concurrency is the same. For a fairer fight still, the event mpm could be used. Apache has nearly 20 year old configuration defaults - because it's best not to break things on users who rely on them. Properly configured, and sanely built, Apache can easily perform as well as nginx or lighttpd. These days 99% of web-server performance is in the kernel and the SSL/TLS libraries. The user-space code is almost completely irrelevant (and those configuration knobs I mentioned really just control how often certain system calls are called). But it hardly matters; "apt-get install nginx" just works, and you really don't have to worry about it; you get a relatively small binary with some sane defaults. Apache is awesome, but I run nginx on my own EC2 micro instance. It's less hassle.
- linuxsec 14y ago"Apache is awesome, but I run nginx on my own EC2 micro instance. It's less hassle." ...enough said!
- Nikkau 14y ago"Moreover… Nginx wasn’t always the winnner." is my favorite part.
- philtar 14y agoCan someone explain how the medium instance is serving more req/sec than the large one when caching is on?