Get Insights from our experts delivered right to your inbox!
Subscribe to the Softtek Blog
(Original publication in Spanish at Softtek's Latam Digital blog)
Choosing a web server used to be easy. If our web infrastructure was on the Microsoft stack, we’d use their Internet Information Server (IIS). If not, then we’d use Apache. But there are now more choices available on the market.
One of the newest alternatives is NGINX, an open source solution that has quickly become the second most popular web server in the world.
To decide between the available solutions it’s helpful to have dealt with all of them, as I have. The following is a brief review of the choices.
Apache is the most widely used web server, but as is often the case, the most used doesn’t necessarily equate with higher quality - it’s just the best known. Apache has many positive traits, but it’s best known for its performance, which is especially important in today’s resource-heavy internet.
Apache creates strings and substrings to manage additional connections. An admin can configure the server to control the maximum number of allowed strings, and the configuration varies according to the available memory on the server.
But if there are too many processes working in-memory, performance can be compromised.
Additionally, when the maximum number of strings are utilized, Apache restricts additional connections. It may also be set to perform in a pre-forked or worker multi-processing mode (MPM). This enables the creation of new processes for each additional user that connects to the web server.
Apache is limited by its available memory and its potential to trigger a dead thread in memory. If a thread is delayed, a user must wait for the web page to unfreeze until the process is complete and thus re-load the page. If a process gets stuck it’s unable to re-start, and stays trapped.
NGINX is an open source HTTP server that includes an email service with access to Internet Message Access Protocol (IMAP) and Post Office Protocol server (POP). NGINX can also be used as an inverse proxy, which enables it to perform load balancing between back-end servers, as well as act as a cache for slower back-end servers.
NGINX’s architecture is different from the traditional web server architecture, which typically creates a new instance for each request. Instead it processes tens of thousands of simultaneous connections in a very compact process within various CPU nuclei.
NGINX is also composed of modules that compile themselves in real time. The user can download the source code and select which modules to use, making it lighter than competing web servers. For example, there are modules that connect to application clones, provide load balancing, become proxy servers, and more. There are no PHP modules per se, as NGINX can interpret PHP code natively.
Organizations such as Facebook and Wordpress.com use NGINX because its asynchronous architecture leaves a small memory footprint while consuming fewer resources, making it the ideal architecture for multiple dynamic web pages. A difficult task. How else could NGINX manage Facebook’s billion users?
Other large web companies that use NGINX are Tumblr, Instagram, Yahoo, YouTube, Pinterest, Zynga, SourceForge, GitHub, DropBox, Intel and Netflix, among others. Even some Content Delivery Networks (CDNs) use it, such as Cloudflare, NetDNA/MaxCDN, Cachefly and ProCDN/MediaTemple.
NGINX uses less RAM
The majority of large GNU/Linux distributed environments use NGINX in their repositories.
Yes, you read it right. Some companies only use NGINX to serve static content, and use Apache to serve dynamic web pages.
You can use NGINX as a cache server - with a bit of configuration - allowing you to improve your application’s efficiency without having to touch any code.
NGINX can be used for load balancing, distributing traffic to different servers to improve scalability.
NGINX, Inc. is the company behind the development of the NGIX server, which in addition to the open source community provides professional support to complement the community-based support.
NGINX is compatible with a large quantity of existing CMSs in the market, and there are plenty of documentation and tutorials about how to install them on NGINX. Some of the more popular CMSs include Wordpress, Joomla, Drupal, phpBB and more!
We have discussed a few of the differences between NGINX and Apache, and how one could be used vs. the other, or in concert, as well as how one or the other can more closely meet your web server needs.
Both resource consumption as well as response times are factors which influence web server performance tests, and NGINX was designed to respond favorably when compared to Apache. As opposed to Apache, NGINX doesn’t have modules to serve dynamic content in PHP, Python or Ruby, and others. Instead it leverages external modules, which can be added to the server, making it lighter and more agile.
It’s because of these reasons, and many more, that NGINX has become a viable alternative to Apache’s HTTP server.
I’d love to hear your thoughts in the comments section below! Are you a full stack developer or in need of one? See my earlier post, 9 Things a Full Stack Developer Should Know.
.