InformationResourcesCategories |
Nginx vs. Apache2 - in Rails Running Death MatchPosted by Andy Koch at 15:13 | Thursday, May 15. 2008Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
You give some clues about what might have been limiting the Apache server. You mention that either the server or the VM running on the server has only 512MB of RAM. You also mention that Apache was using a lot of memory and was swapping extensively.
If Apache isn't able to fit in RAM but Nginx is, I would have expected an even larger ratio in their speeds. Did you measure the number of page faults in the two systems? The production machine your app is going to run on is going to get some reasonable hardware. I think you've only proven that Nginx uses less memory than Apache. While this might be interesting information for someone running a lot of VMs on the same box, I don't think it's interesting for your application.
no, you're wrong
Apache did run fine in the VM, but it's memory usage exploded when put under the stress of heavy load. I would expect similar results on any server, except that a more powerful server may be able to avoid a blowout. My main point of mentioning the RAM size was that running 4 mongrels on such a system is a bad idea. Maybe 2 mongrels, 3 at most. But then the idea isn't to find optimal performance on this machine bu to get a perspective on which web server performs better as a front-end for my Rails app. To that end, one could claim they're near equal - but when the Rails requests are simply or it's static content, Nginx is clearly superior.
Are you just speculating, or are you going to release the page fault numbers?
Benchmarks and speculation don't mix very well...
The default mpm for Apache is prefork, which trades memory efficiency for thread safety. Switch the mpm to worker (as used by nginx), disable all unneeded modules, and you will probably see identical performance on that hardware.
Yes, I agree with Andy, poster above.
Apache comes with a CRAP LOAD of modules that are loaded by default. It is up to the Apache ADMIN to learn about the capabilities of all modules, AND DISABLE THOSE NOT NEEDED. Apache is not bloated! It just comes with A LOT of configurations and bells and whistles, that can EASILY be 'turned off' (hence saving memory and cpu) A bare bones mod_php + core modules + 1 or 2 extra modules makes for a fast and slim Apache. The default apache is a PIG, yes when you have all 20+ modules loaded which most are never used... Learn to be a real Administrator and learn how to do it right. Running tests in a 512 megabyte scenerio is obsurb. Any web server will have at least 1-2 gigs of ram if not 4+. It is going to begin to use SWAP after 512 (which just about ANY server (mail, imap, database or otherwise) will encounter. Now I agree that perhaps Nginx or Lighttpd may be 'lighter', but that is because it is not preloaded with all the cool modules, like apache. But, Apache DOES give you the options to use them OR NOT (all you have to do is comment out each module you do not want to load, and it will not be used and saves on resources. ) Where as with nginx it is not nearly as tested, secure and matured as the grand old Apache. You need to re do your tests, and concider all things. The first thing that VOIDS your tests, not to be mean, is the fact that you mentioned you used DEFAULT installs... Well, that is not optimization. And voids all claims... you MUST configure correctly to get good results. The reason why all the apache modules are loaded by default, is to show off all the cool features and make aware to Apache Admin they are there... however, default install is NOT the optimized install. |
QuicksearchPollsWhich phone is for you?
Archives ArchivesLogin |