Apache vs IIS vs Nginx vs Node.js

Today, the most popular web servers are: Apache, IIS, Nginx, Node.js. Every web server has its own history, focus on technology, the preferred operating system, and etc.

But there is a fundamental difference in processing requests.

What are Web servers?

Responsive image

Web servers need to work with web applications on the Client–server model. Their task processing request from the user (customer, client) and the query result returned from the server (backend, serverside).

Web servers limits

A web server has defined load limits, because it can handle only a limited number of concurrent client connections per IP address (and TCP port) and it can serve only a certain maximum number of requests per second (RPS, also known as queries per second or QPS) depending on HTTP request type, settings, cached and hardware.

Each server has a dedicated “resources(hardware)” (RAM, CPU, etc.) to handle requests. These resources are used in flows and processes:

  • [Thread_(computing)]
  • [Process_(computing)]

The difference in the distribution of resources in the processing of requests is a key differentiator for are risen web servers.

Process-based web serves: Apache, IIS.

Apache, IIS are used each request is processed in a separate thread / process - “process-based”.

Responsive image

“Process-based” web servers.



For every client request uses a separate process / thread. Each thread / process requires a certain number of server resources(hardware). Server resources “idle/ not used” until the pending request and send the client a reply. What a negative impact on performance at high loads when the selected process flow is not enough to handle all requests.

Event-based web serves: Nginx, Node.js.

Responsive image

Event-based web servers.

Event-based web servers are used all resources of server hardware. Loop-event - endless request processing cycle. This cycle tracks the status of the request (the request from the customer reception, processing and sending the response).

In Singe process/thread is used all the resources the web server, allowing you to process requests as quickly as possible, and in cases of delays (obtaining data from the client to send data to the client) to work with other requests from the queue (Event Queue) ie asynchronously.

Total

Event-based(Node.js, Nginx) shows better performance under high loads, because that the server does not need to share resources among other threads / processes. Also, the server resources are always used without the “downtime”.