No Comments

How NGINX and DRUPAL together help boost site performance!

Sandeep Khuperkar I CTO and Director, Ashnik
India, 15 Feb 2016

by , , No Comments


Drupal is an open source Content Management System that allows you to organize, manage and publish your content. It’s presence is growing manifolds in application development landscape.  Based on PHP which is a scripting language, Drupal is easy to learn, easy to use and quick to move to production. Most of the Drupal sites use traditional web servers which may pose performance limitations when the site demands rapid scalability.

The architecture of Drupal has following layers:


Drupal image2

NGINX as an application delivery platform plays a key role in serving the modern web. It combines web server with load balancer, content cache, and media deliver into a high performance Application Deliver Platform (ADP).

Apart from helping in optimizing performance for high traffic loads, NGINX helps address the performance bottlenecks. While serving as webserver for your Drupal sites NGNIX sharply reduces memory utilization as concurrent connections increases thereby improving the performance dramatically. NGINX can also be implemented as reverse proxy server which would help remove burden of handling internet traffic from your application server. You can implement NGINX as a reverse proxy server with either Apache or NGINX as your webserver.

NGINX was designed to solve the C10K problem – the challenge that most of the traditional webservers have while supporting large number of concurrent connections. It runs an ongoing event loop which handles requests as and when they occur, without allocating resources to the requestors. You can replace the existing webserver with NGINX and most of the time you can do this without changing your actual application code. However, if you don’t plan to change your existing webserver which works directly with your Drupal code to NGINX, you can still use NGINX as a reverse proxy server, load balancer etc. to enhance the performance.

If you are setting up a new application, you may well want to go for NGINX. But in the cases where sites are already using Apache or any other webservers, adding NGINX as reverse proxy server allows you to free your Drupal server from handling internet traffic.

NGINX provides some new capabilities to your Drupal server which include:

1. Caching of static files – Serving static files like images, CSS files, JavaScript files so on separately from dynamic pages’ increases site performance. NGINX fetches the cached files to the user faster and offloads the Drupal server from a significant number of transaction per pageview.

2. Dynamic files caching – Drupal handles caching of PHP- generated pages. NGINX can help in removing the load of caching from Drupal as it supports both static file caching and PHP page caching. This approach provides a few benefits like;

  • Simplifies the developing, maintaining and debugging of your Drupal applications
  • Improve the performance by handling the caching at NGINX server level.

With NGINX taking care of the caching efficiently, it’s performance benefits are remarkable. Instead of Drupal app generating fresh page for hundreds or thousands of concurrent requests, it may only have to generate a fresh page every second.

3. Scalability & Load Balancing –  NGINX as a reverse proxy allows you to use multiple application servers, thereby giving you horizontal scalability. It also allows you to add and remove servers with zero downtime. NGINX’s load balancing capability supports Round Robin, Least Connection, Hash, IP Hash, and Least Time that helps with deciding which server the next request should go to.

4. Session Persistence –  NGINX Plus offers session persistence using multiple methods like “Cookie insertion”, “Learn”, and “Sticky routes”. Session persistence keeps a specific client assigned to the same server throughout its session thereby enabling a server down without interrupting the established sessions.

To summarize in a nutshell, Drupal is a platform for web content management and is a powerful tool for building simple and complex sites. As these sites grows in terms of usage, performance becomes a very critical aspect. Here NGINX and NGINX Plus can help boost the performance immensely through it’s use as a replacement webserver, as a reverse proxy server, caching and micro-caching engine thereby providing load balancing and session persistence capabilities.

Ashnik has been helping organizations realize the benefits of NGINX through our consulting, systems integration and implementation services.

– Sandeep Khuperkar I CTO and Director, Ashnik

Sandeep is the Director and CTO at Ashnik. He brings more than 21 years of Industry experience (most of it spans across Red Hat & IBM India), with 14+ years in open source and building open source and Linux business model. He is on Advisory Board of JJM College of Engineering (Electronics Dept.)  And visiting lecturer with few of Engineering colleges and works towards enabling them on open source technologies. He is author, Enthusiast and community moderator at He is also member of Open Source Initiative, Linux Foundation and Open Source Consortium Of India. 


More From Sandeep Khuperkar I CTO and Director, Ashnik :
Tags: , , , , , , , , , , , ,