2

Apache httpd has done me well over the years, just rock solid and highly performant in a legacy custom LAMP stack application I've been maintaining (read: trying to escape from)

My LAMP stack days are now numbered and am moving on to the wonderful world of polyglot:

1) Scala REST framework on Jetty 8 (on the fence between Spray & Scalatra)
2) Load balancer/Static file server: Apache Httpd, Nginx, or ?
3) MySQL via ScalaQuery
4) Client-side: jQuery, Backbone, 320 & up or Twitter Bootstrap

Option #2 is the focus of this question. The benchmarks I have seen indicate that Nginx, Lighthttpd, G-WAN (in particular) and friends blow away Apache in terms of performance, but this blowing away appears to manifest more in high-load scenarios where the web server is handling many simultaneous connections. Given that our server does max 100gb bandwidth per month and average load is around 0.10, the high-load scenario is clearly not at play.

Basically I need the connection to the application server (Jetty) and static file delivery by the web server to be both reliable and fast. Finally, the web server should double duty as a load balancer for the application server (SSL not required, server lives behind an ASA). I am not sure how fast Apache Httpd is compared to the alternatives, but it's proven, road warrior tested software.

So, if I roll with Nginx or other Apache alternative, will there be any difference whatsoever in terms of visible performance? I assume not, but in the interest of achieving near instant page loads, putting the question out there ;-)

virtualeyes
  • 11,147
  • 6
  • 56
  • 91

2 Answers2

3

if I roll with Nginx or other Apache alternative, will there be any difference whatsoever in terms of visible performance?

Yes, mostly in terms of latency.

According to Google (who might know a thing or tow about latency), latency is important both for the user experience, high search-engine rankings, and to survive high loads (success, script kiddies, real attacks, etc.).

But scaling on multicore and/or using less RAM and CPU resources cannot hurt - and that's the purpose of these Web server alternatives.

The benchmarks I have seen indicate that Nginx, Lighthttpd, G-WAN (in particular) and friends blow away Apache in terms of performance, but this blowing away appears to manifest more in high-load scenarios where the web server is handling many simultaneous connections

The benchmarks show that even at low numbers of clients, some servers are faster than others: here are compared Apache 2.4, Nginx, Lighttpd, Varnish, Litespeed, Cherokee and G-WAN.

Since this test has been made by someone independent from the authors of those servers, these tests (made with virtualization and 1,2,4,8 CPU Cores) have clear value.

Gil
  • 3,279
  • 1
  • 15
  • 25
  • +1, Nice benchmark, looks pretty much the same in terms of peformance as previous benchmarks, showing GWAN blowing away everyone else and Apache at the bottom. Saying that, for the vast majority of low-load sites out there, very likely that one would not notice the slightest difference between GWAN serving up a 100 byte file (i.e. the file used in the benchmark) and Apache doing the same. Worth noting that the author mentions in the first sentence that this is the first benchmark he's attempted ;-) Nginx is the biggest threat to Apache dominance in web server market (GWAN is far from free) – virtualeyes Oct 14 '12 at 13:48
  • You might benefit from learning about why **latency** matters. Then, G-WAN would make (a lot of) sense to you - even on low-frequentation Web sites. And if benchmark beginners (but network pros) feel the need to test G-WAN vs other servers, that's a rather good sign. And Nginx costs a lot more in hardware than G-WAN. =) – Gil Oct 15 '12 at 13:50
  • well, at this point I'm more concerned about network latency then latency within my stack. Most sites are just fine with a low-end server running a poorly written LAMP stack app. Sites under extreme heavy load are the exception, and there the chosen stack and level of coding expertise are obviously crucial. G-WAN has a niche, you guys will do just fine, but not going open source might slow what would otherwise be a kick ass all over the web server market place product. Apache, Nginx et al are probably not complaining... – virtualeyes Oct 15 '12 at 16:42
  • G-WAN does not attempt to copy Nginx or Apache: it was written to do what others are not able to do. If you are fine with those tools then there is no reason to criticize G-WAN like you insist to do it. – Gil Oct 16 '12 at 11:07
0

There will be a massive difference. Nginx wipes the floor with Apache for anything over zero concurrent users. That's assuming you properly configure everything. Check out the following links for some help diving into it.

http://wiki.nginx.org/Main

http://michael.lustfield.net/content/dummies-guide-nginx

http://blog.martinfjordvald.com/2010/07/nginx-primer/

You'll see improvements in terms of requests/second but you'll also see significantly less RAM and CPU usage. One thing I like is the greater control over what's going on with a more simple configuration.

Apache made a claim that apache 2.4 will offer performance as good or better than nginx. They made a bold claim calling out nginx and when they made that release it kinda bit them in the ass. They're closer, sure, but nginx still wipes the floor in almost every single benchmark.

MTeck
  • 1,642
  • 3
  • 16
  • 34
  • Thanks, I have doubts. Why? 1) Apache 2.4 has been released; 2) Google mod_pagespeed does not yet support nginx (and will shortly extend beyond v2.2 to v2.4 support for Apache). mod_pagespeed alone is reason enough to stay put; 2.4 appears to blaze as well. If I was just serving static content I might consider switching, but fronting an application server, sticking with the rock that is Apache. – virtualeyes Mar 07 '12 at 21:45
  • 1
    When I was typing that, I was thinking in terms of dynamic content as well. Personally, I like having control over everything. It sounds like you don't actually want to use Nginx, though. A google search of Nginx vs. Apache will give you a whole lot of benchmarks. It's an ideal fit for smaller servers with less resources too. Unless you're going to actually try it and make sure you get the config right, you'll never really know which is better. – MTeck Mar 07 '12 at 21:54
  • I actually like nginx' efficiency, and configuration is indeed far simpler than Apache's. However, while Apache 2.4 may not quite match nginx in benchmarks, most of us are not fortunate enough to handle benchmark level traffic. In other words, in terms of speed there is likely ZERO difference as far as the end user is concerned. That's why I titled the post "non-Twitters of the world". It's not simply raw speed I'm looking for, it's load balancing an application server reliably, arguably the more important of the two in a relatviely low-load scenario – virtualeyes Mar 07 '12 at 22:54
  • @virtualyese: As soon as you will start generating *dynamic* contents (and that's the case almost everywhere now) performance will make a huge difference - especially on small machines (embedded, small VPS instances, legacy hardware, etc.) because **it's far less costly to scale vertically than horizontally** and for some applications scaling horizontally is simply not possible. – Gil Sep 23 '13 at 13:08