NGINX vs Apache – power engine asynchronous and even-driven server

Apache is a flexible server which can be process-based, thread-based or event-based as determined by the MPM used, while nginx is an event-based web server.

Nginx is probably the two best-known asynchronous servers and Apache is undoubtedly the best known originally process-based server. The main advantage of the asynchronous approach is scalability. In a process-based server, each simultaneous connection requires a thread which incurs significant overhead. An asynchronous server, on the other hand, is event-driven and handles requests in a single (or at least, very few) threads.

discovery

Nginx works differently than Apache, mainly with regard to how it handles threads. Nginx does not create new processes for each web request, instead the administrator configures how many worker processes to create for the main Nginx process. Each of these processes is single-threaded. Each worker can handle thousands of concurrent connections. It does this asynchronously with one thread, rather than using multi-threaded programming. NGINX in opposite to  Apache, instead of using the multi-threaded approach with blocking I/O, it uses an event loop with asynchronous I/O. Because of these design choices, NGINX is often able to handle more requests and connected clients. Below situated illustrations show a benchmark comparison NGINX and Apache.

NGINX is using in Node solutions to serve big traffic in case of static datas  (e.g. hosting static files and proxying)

 

nginx-apache-memory

nginx-apache-reqs-sec

(source – pictures:
1. https://blog.webfaction.com/2008/12/a-little-holiday-present-10000-reqssec-with-nginx-2/
2. https://www.nginx.com/solutions/streaming-media/?_ga=1.21964347.1860504214.1449414993
)

December 6th, 2015

  • Excellent post. I found myself checking constantly this blog and
    I am just inspired! Very helpful info particularly the last part 🙂 I maintain such information much.
    I was looking for this certain info for the number of years.
    Thank you and have a great time..

  • I was pretty pleased to discover this article. I wish
    to to many thanks for your time for this particularly fantastic read!!
    I definitely savored every little bit of it and i perhaps you have saved to fav to find out new things within your blog..

  • I was pretty pleased to discover this article. I wish
    to to many thanks for your time for this particularly fantastic read!!
    I definitely savored every little bit of it and i perhaps you have saved to fav to find out new things within your blog..

  • It is the ideal time and energy to develop plans for future years
    and it’s time and energy to be happy. I’ve look at this post and when I could I
    would like to suggest you some interesting things or advice.
    Maybe you could write next articles talking about this post.
    I wish to read more reasons for it!.