Static and Dynamic Content
In fetching the static content, Apache relies on its traditional simple file-based approach, whereas Nginx is designed to handle maximum load and thereby, performs 2.5 faster than the Apache server.
In the case of dynamic content, Apache need not rely on the external components, thus, processes all the requests of dynamic content within the web server itself. On the other hand, Nginx depends solely on the external component, i.e. PHP-fpm for the execution of all the requests of dynamic content.
Yet, from the below-shown readings, it is evident although Nginx cannot process the requests within the web server, it performs almost equal to the Apache server in fetching the dynamic content.
Memory Usage
By default, Apache is an iterative server which means by iterating through each server, it only serves a single request at a time due to its process-driven approach which in turn increases the memory usage. On the other side, Nginx is a concurrent server which can efficiently manage multiple requests at the same time within a single thread by its event-driven approach.
The most popular and widely used server combination is,
- Nginx server + Varnish + PHP-FPM + MySQL + HAProxy
Though the other packs also form a suitable combo, the suggested combo runs exceptionally well for Magento sites and seamless productive results can be achieved. Need to install the above combo for your system? To know about the installation process of Nginx, visit our below blog article on, Installing Nginx on Ubuntu 18.04. In this article, a brief glimpse about Apache and Nginx followed by a comparative table and charts in terms of performance such as requests per second, memory usage, static and dynamic content have been presented.