Nginx Great alternative of Apache Server (Part 2)
Hello
everyone,
Lets continue to my last article on nginx server.....
Last discussed about the feature of Nginx, Today we will discuss about the comparsion between the
Nginx and Apache....
we will compare on some point :
- Documentation
- Flexbility
- Performance
- As discussed
above Nginx is based on event-driven architecture. Apache is based on
process-driven architecture. It is interesting to note that Apache in its
earliest release was not having multitasking architecture. Later Apache
MPM (multi-processing module) was added to achieve this.
- Nginx doesn’t
create a new process for a new request. Apache creates a new process for
each request.
- In Nginx, memory
consumption is very low for serving static pages. But, Apache’s nature of
creating new process for each request increases the memory consumption.
- Several
benchmarking results indicates that when compared to Apache, Nginx is
extremely fast for serving static pages.
- Nginx
development started only in 2002. But Apache initial release was in 1995.
- In complex
configurations situation, when compared to Nginx, Apache can be configured
easily as it comes with lot of configuration features to cover wide range
of requirements.
- When compared to
Nginx, Apache has excellent documentation.
- In general,
Nginx have less components to add more features. But Apache has tons of
features and provides lot more functionality than Nginx.
- Nginx do not
support Operating Systems like OpenVMS and IBMi. But Apache supports much
wider range of Operating Systems.
- Since Nginx
comes only with core features that are required for a web server, it is
lightweight when compared to Apache.
- The performance
and scalability of Nginx is not completely dependent on hardware
resources, whereas the performance and scalability of the Apache is
dependent on underlying hardware resources like memory and CPU.
Documentation:
The documentation for both Apache and NGINX are excellent, including the NGINX wiki. NGINX also offers online and on-location training
sessions on a variety of NGINX topics — including exam certifications.
Flexbility ;
Customization to the web server can be done through writing
modules. Apache has had dynamic module loading for the longest time, so all
Apache modules support this.
This is, however, not the case for NGINX. In the
beginning of 2016, NGINX got support for dynamic module loading; previously,
NGINX required the admin to compile the modules into the NGINX binary. Most
modules do not yet support dynamic loading, but over time they probably will.
According to some other author says
Below we’ll contrast the performance of Apache (using the
event MPM) with that of NGINX in both static and dynamic content serving roles.
Static
Content
NGINX is about 2.5 times faster than Apache based on the
results of a benchmark test running up to 1,000 concurrent connections.
Another benchmark running with 512 concurrent connections, showed that
NGINX is about two times faster and consumed a bit less memory (4%).
Clearly, NGINX serves static content much faster than
Apache. If you need to serve a lot of static content at high concurrency
levels, NGINX can be a real help.
Dynamic
Content
A 2015 benchmark comparing dynamic content serving by
Apache and NGINX found that the Apache event MPM, when paired with the
PHP-FPM module, can handle about the same concurrency as can NGINX with PHP.
Another web server performance comparison showed similar results. The
reason for this is almost all of the request processing time is spent in the
PHP runtime environment rather than the core part of the web server. The PHP
runtime environment is pretty similar between both web servers.
Conclusion :
Feature | Nginx | Apach |
Supported OS
|
Linux, Unix, MacOS, Windows-partial
|
Linux, Unix, Windows, MacOS
|
User support & Fixes
|
User community only
|
Corporate support & User community
|
Cost & Development
|
Free, Open source
|
Free, Open source
|
Security
|
Very good
|
Excellent
|
Features & Documentation
|
Good
|
Excellent
|
Performance
|
Excellent
|
Good
|