3 ms·
Biggest advantage off the top of my head is memory usage (which matters when you are on a memory constrained VPS like a 256 slice). Nginx memory usage stays low
by Xichekolas 18y ago
Biggest advantage off the top of my head is memory usage (which matters when you are on a memory constrained VPS like a 256 slice). Nginx memory usage stays low under lots of load, since it has a constant number of workers and a job queue. I'm not clear on how exactly Apache does it, but my understanding is that it forks a child process to service each request, so under high loads gobbles up memory.
Second graph here illustrates:
http://blog.webfaction.com/a-little-holiday-present http://blog.webfaction.com/a-little-holiday-present
Personally, I also find Nginx more straightforward to configure, but I know that is mostly personal preference.
As an aside: I really love Engine Yard for sponsoring the development of this.
- rcoder 18y agoUsing a default configuration, Apache actually maintains a pool of worker child processes which handle the actual request processing, rather than forking on every incoming request. You can allow it to fork more workers under load, or keep it locked down to manage resource usage. You can also configure it to use an alternate MPM (Multi-Processing Module) to use thread pools, fork on each request, or some mix of the above. The difference in resource usage is due more to the fact that Apache is written to be a sort of generic network service platform, rather than a lean-and-mean HTTP server. It allows plug-in modules (whether written in C, or any of the mod_perl/python/ruby/etc. dynamic language bindings) to interact with just about any stage of request processing. In addition, a default Apache install will usually link a large number of other modules in each worker That being said, tuning Apache for performance + minimal resource usage is a bit of a black art. If you're not comfortable configuring + building your own server package from source, it's probably easier to just grab Nginx and be done with it.