5 ms·
Full disclosure: I'm a committer on the Apache httpd server. I hope this is sarcasm. Apache has support for the same event driven model that NGINX has. Since
by breser 9y ago
Full disclosure: I'm a committer on the Apache httpd server.
I hope this is sarcasm. Apache has support for the same event driven model that NGINX has. Since most people get their copy of Apache from their distribution they're often getting a rather old version of Apache. NGINX has taken good advantage of this to imply that Apache is out of date.
I happen to also use NGINX at work. What I'll say is it has it's own set of problems. There are various reasons to choose one or the other for a particular problem. But the idea that Apache httpd is obsolete is nonsense.
- pram 9y agoTo be fair most distros (still?) provided Apache with mpm_prefork as the default. I doubt many people even realize you can use an event based handler. Out of the box nginx will be way more performant.
- breser 9y agoAnd the reason distros do this is because modules like mod_php and mod_perl have historically not worked well with other MPMs. As far as I'm aware this should be resolved with newer versions of Apache and the modules. Also historically the MPM was built into the server and required a rebuild, but newer versions provide the MPM as a loadable module. But the distros have very long upgrade cycles and are hesitant to change their defaults since they don't want to break peoples existing setups. If you care about performance then you probably don't want to use the distribution's copy. People tend to use NGINX's distributions directly from NGINX or build it on their own. Since NGINX didn't have dynamic loadable modules until recently that drove more people to build their own copies. I do think it's fair to say that NGINX has a reputation for getting better performance out of the box without configuration. However, it doesn't take long before you have to start tweaking it as well in my experience. So I don't think some peoples impressions of Apache are entirely unfair but I don't think they are entirely fair either. But this shouldn't surprise anyone given that NGINX is a business and has a marketing department. Apache is a foundation and really doesn't market like NGINX does.
- catdog 9y agoI don't know about perl but for php php-fpm is basically the way to go now rendering mod_php irrelevant.
- breser 9y agoYes that is very much the case, but people are still using these things.
- jeltz 9y agoI have not followed Perl web development lately, but 10 years ago people were moving from mod_perl to FastCGI.
- davidgerard 9y agoI find if you're using PHP, it's going to be your entire CPU and memory load problem, and the server in front of it isn't. I have bothered with php-fpm previously, specifically so that when the server is getting hammered it just stops trying, instead of sending the box into OOM-killer.
- peterwwillis 9y agoUsing the distro's build of Apache is actually preferred for production servers. The distro build commonly has useful patches and will receive very fast security updates, not to mention being tested much more than a one-off build. You just wouldn't use a stock configuration, for a multitude of reasons. The only reason you might compile it yourself for a performance boost is to strip out all the features, but then you have to ask yourself if you even need Apache. We used different mpms for different purposes even 10 years ago. A cluster of boxes could still serve over a hundred thousand mod_perl responses per second, at which point with a decent-sized set of perl apps your bottlenecks are application CPU and memory, not connection processing. Prefork is simply the most compatible mpm for every module that exists, so of course you'd ship that as the default for a distro. Server software being "fast out of the box" is like saying a phone's battery comes "fully charged out of the box". It's convenient, but I can also just take an hour and get it there myself.
- LaSombra 9y agoBut whose fault is it really? If you want a performant web server you, at least, know what you are benchmarking against and what your bottlenecks are. If you know that but can't be bothered to learn what you are putting in production then it's not really the project or the distro faults IMHO.
- jimmaswell 9y agoIf you're involved in something that needs that degree of extra performance then you'll probably know to either manually get a newer Apache or do whatever else you need. For the majority of people just using apache to casually host a few personal projects or simple webpages it's not going to matter.
- tannhaeuser 9y agoCongrats to the release (I'm a lurker on httpd-dev so I know that http2/mod_h2 is out of the "experimental" state). > There are various reasons to choose one over the other Care to elaborate? Out of my head I could think about these: - rfc caching with proper revalidation (as opposed to mere Expires: header generation) - process isolation (aka CGI) - better docs (and community/mindshare, though unsure about the latter) - vhosting ecosystem
- breser 9y agoIn my experience it really comes down to NGINX is trying to position themselves as a replacement for load balancers like F5's BigIPs. So they have functionality that goes well beyond what you'd call an HTTP Server. For instance Layer 4 proxying rather than just Layer 7 proxying. But that's just my experience at work. I'm sure there's a ton of other reasons. I can't say that I really agree with your list. I actually find Apache's documentation to be much better, I find myself needing to go read the code to figure out some behaviors with NGINX quite often still. Process isolation with CGI can be equally done with Apache httpd as with NGINX. I can't say I'm familiar with NGINX's caching behavior in detail since we're not using it. Also not sure what you mean by vhosting ecosystem since I see the design as pretty similar, unless you mean the upstream configuration.
- tannhaeuser 9y ago> I actually find Apache's documentation to be much better Err, the points I listed are in favour of Apache httpd (I guess I haven't made myself very clear).
- r2dnb 9y agoJust adding this since nginx proponents seem to be over-represented in threads these days : - I too find that the Apache documentation is much better than the nginx one - I also prefer the Apache License over the open-core, pay-a-license-for-more-feature model of Nginx. - Then the module system of Apache is simply stable, proven, and seamless. I'd go with Apache any time of the day as far as HTTP servers are concerned. I have nothing against Nginx per se, but I think that the Apache is dying / Apache is obsolete rhetoric is so far away from truth and exaggerated that it is almost becoming some sort of propaganda. Apache is doing just fine and is going nowhere anytime soon and its configuration file format is not that complicate. Just try it for yourself and read the (well-written) docs.
- kijin 9y ago> Apache has support for the same event driven model that NGINX has. Since most people get their copy of Apache from their distribution they're often getting a rather old version of Apache. I don't think that's fair to Linux distros, either. Most popular distros have been shipping mpm_event for quite a few years, even if not enabled by default (because of mod_php). I understand that as a developer of a phenomenal piece of software, you would prefer everyone to use the latest and greatest version. But for a typical user, Apache is so stable that the difference between CentOS's 2.4.6, Ubuntu's 2.4.18, and the latest version doesn't look large enough to have a significant effect in an "Apache vs. nginx" debate. After all, distros ship outdated versions of everything, including nginx.
- breser 9y agoMaybe my view here is somewhat jaded on distro versions since from the time 2.4 was released it was serveral years before major distros actually were shipping it. Some of that was just coincidence that 2.4 was released right after several distros froze for their major versions. But yes the difference between patch versions is usually quite small.