Find Out if NGINX Is the Right Web Server for You

Ankit ChaudharyDecember 15, 2015

By now, you’ve likely heard of NGINX, the lightweight web server growing rapidly in the marketplace and giving heavy weights like Apache some serious competition. Yet given the fairly recent arrival of NGINX to the web server scene (it became a company as recently as 2011), many businesses are struggling to decide whether to go with a traditional web server like Apache or the newer model, NGINX.
Here, I give you the lowdown on NGINX and explain how it differs from traditional web servers so you can make the right choice.

What is NGINX? How does it work?

NGINX (pronounced “engine x”) is a free, open source web server with high performance, high concurrency, and low memory usage. A number of features make NGINX a good choice for modern website architectures. These include:

  • Multiple protocol support (HTTP, HTTPS, WebSocket, IMAP, POP3, SMTP)
  • SSL termination (TLSv1.1/TLSv1.2/SSL/SNI/PFS/PCI-DSS and OCSP Stapling)
  • HTTP video streaming using MP4/FLV/HDS/HLS
  • Caching static and dynamic content
  • Content compression
  • Header manipulation
  • Request filtering
  • Extended monitoring and logging
  • Upgrades without downtime using live binaries
  • Graceful restart with non-stop request processing
  • Complete reverse proxy and load balancer
  • Access and bandwidth control
  • The ability to integrate efficiently with many applications 

Likewise, NGINX has been tested and approved in a number of operating systems and platforms, from FreeBSD 3/5 to Linux 2.2/2.6/3, Solaris 9/10, Mac OSX, and Windows XP, to name a few.

From Apache to NGINX: how to decide

 
If you use an HTTP server like Apache, knowing whether to jump to NGINX isn’t easy. After all, Apache is an established, flexible web server that many enterprise-level customers rely on for delivering both dynamic and static content. It can run on a range of operating systems, is well-maintained, and is used so widely that a substantial amount of user-generated documentation exists, making it easy for developers to find what they need. Another key benefit is Apache’s customization capabilities, which include a rich set of features that can be modified and extended through the use of readily available add-on modules to fit many different technical or business needs.

With these benefits, however, come drawbacks. For one, because of the primarily process-based processing model Apache uses, it consumes more memory under high server loads, which can result in degraded performance (although the recent Apache 2.4 release promises improvements in speed and caching). And while the worker multi-processing module (MPM) has been available since 2004, it uses threads, not processes, to serve requests, which can cause compatibility issues.

NGINX, on the other hand, is designed to be simple and lightweight, and to require fewer hardware resources than other web servers. It does this in part by using an event-based processing model, which generally requires less memory than a process-based server. Because of this design, NGINX can serve static webpages quickly. For instance, if a website receives a large number of concurrent hits seeking static pages, NGINX has the advantage of keeping up without overly taxing the server hardware.

But this doesn’t mean you should automatically transition to NGINX. Because NGINX is newer, you will have to get by on less documentation and support, compared to more established web servers. The lightweight design also means that it can be more difficult to customize, which might be necessary for large or complex configurations. Consequently, many sites use both: NGINX as a reverse-proxy front end that kicks back to Apache to do the dynamic processing. Further, since NGINX excels at delivering static content, some sites will offload these tasks to dedicated NGINX servers that do nothing but shovel static content like images, CSS and JavaScript files, and streaming media files. In fact, if you’re inspecting those sites from the client level, it can appear as though NGINX is running the show, when it’s just fronting Apache or other services.

Top reasons to recommend NGINX

Whether you use the Apache HTTP server (“httpd”) server or are without an httpd server, you can use NGINX. What makes it a great choice?

  • NGINX is fast because it does not need to create a new process for each new request.
  • It uses very little memory, especially for static webpages.
  • It’s open source.
  • You can use NGINX with a range of systems.
  • It’s highly scalable, and performance does not depend on hardware.
  • The high-performance reverse proxy server is used as a load balancer.
  • While HTTP is stateless, NGINX offers session persistence and can preserve some cached data, such as that of a shopping cart with long results pagination. Additionally, it makes sure that repeated requests from the same client are routed to the same shared server to actually maintain session-specific data.
  • Unlike Apache, NGINX is built for high concurrency, so it can handle multiple concurrent requests at the same time.
  • NGINX is easy to install and configure.

The NGINX market share


As you can see by the survey conducted by Netcraft in February 2015, NGINX is growing and gaining market share among the top web servers:

NGINX_Chart-1024x175

Ready to make the switch? You can download NGINX and choose between the free open source version and paid commercial version, NGINX Plus, with the added perk of customer support.

At InfoCepts, our team of BI and data warehousing experts have strong experience working with NGINX, Apache, and other web servers. Get in touch to talk through your needs.