NGINX.COM
Web Server Load Balancing with NGINX Plus

Today’s businesses face disruption and opportunity on a scale we have never seen before. As developers and technology professionals, we find ourselves at the center of this storm. What sets top development teams apart from the rest is the ability to innovate and adapt, to build and deliver extraordinary new products and experiences faster than the competition.

smashed-box

Building a great application is only half the battle. Delivering your great application is the other half.

No matter how sophisticated, functional, and beautiful a great application may be, if it does not perform in the real world, for real users, it has not succeeded.

Why Is Delivering An Application So Hard?

Real‑world deployments subject an application to stresses and strains it will never encounter in development:

  • Slow client traffic ties up server resources and impacts performance in a way that’s extremely difficult to measure in the lab.
  • Unpredictable spikes in traffic can overwhelm the application platform.
  • Search engine, screen‑scraping, and attack traffic can consume resources uncontrollably, and may leak sensitive data.
  • Multiple client types over multiple network types can defeat attempts to optimize the application stack.
  • Modern acceleration and security processes may not be well supported by the application framework.

The simple problem is this: modern application platforms (like Ruby‑on‑Rails, Grails, Python/Django, or even J2EE) are engineered for developer productivity first, not performance or scalability. What can you do to harden and prepare your application for the onslaught of traffic it will encounter in production?

How Can I Make My Application Production‑Ready?

There are a great many best practices and steps that you can take to make an application production‑ready. Caching, load balancing, HTTP optimizations, request scrubbing, and offloading operations like compression and encryption – these all contribute to improved performance, resilience, and control:

  • Caching reduces application load and delivers content faster to end users.
  • Load balancing distributes traffic across application instances to optimize performance and avoid failed or underperforming servers.
  • HTTP optimizations transform slow client traffic into fast local transactions so that applications operate at peak efficiency (as they do in a benchmark).
  • Request scrubbing cleans up traffic and drops bad requests before they can impact the application.
  • Compression and encryption offload takes work from application servers so that they can focus on what they do best – running your application!

NGINX and NGINX Plus industrialize these best‑practice capabilities into a single web acceleration and application delivery platform. For over 130 million websites, NGINX is the first software that user traffic hits. Over 40% of the busiest 10,000 sites on the Internet use NGINX to deliver their web applications.

How Can NGINX and NGINX Plus Help?

NGINX is a lightweight, highly reliable reverse proxy that is deployed as a web accelerator and web server in front of your infrastructure, and NGINX Plus extends this with more sophisticated load balancing, application delivery and monitoring capabilities. It is proven (with over 10 years of production deployment), it’s scalable (uses minimal memory and CPU), and it’s extremely fast. It is often deployed as the first tier for user traffic for the following reasons:

  • High‑performance SSL and SPDY termination – Regarded as one of the most advanced SSL proxies available, and the most widely used server for SPDY traffic. Offload SSL and SPDY from your application stack, improving performance and delivering more functionality.
  • Single entry point for multiple applications – Terminate and route traffic (HTTP, WebSocket and TCP‑based protocols) to multiple web applications, concealing the internal application infrastructure from external clients. The configuration language makes request routing easy, with a structured format that breaks out traffic by application (Host header) and URL.
  • Load balancing, visibility, and health checks – Distribute incoming traffic evenly across multiple application instances, informed by the load‑balancing policy, performance measurements, and health checks. The net result is that you optimize application performance by diverting traffic away from failed and underperforming servers.
  • Caching – Use the massively scalable hybrid disk and memory store for HTTP caching. The cache reduces the load on the application by serving duplicate requests, and speeds delivery to end users by responding directly to these requests. Even for fast‑changing applications like news feeds and blogs, you can reap enormous performance improvements by caching for a couple of seconds at a time (microcaching).
  • Static content offload – Move static content to the NGINX or NGINX Plus front end and serve it directly. It’s is not just an accelerating proxy, it’s also a full‑fledged web server. You can perform speculative checks to see if the content is present locally (the try_files directive) and forward the request to an upstream server if not.
  • HTTP optimizations – NGINX and NGINX Plus upgrade HTTP requests and maintain a dynamic pool of persistent (keepalive) HTTP connections. Optimizations are carefully sized to consume the minimum server resources necessary, resulting in better performance and greater resilience to traffic spikes.

shock absorber

You can regard NGINX and NGINX Plus as a shock absorber, protecting your applications from rough and unpredictable Internet traffic, giving the smooth ride that enables them to perform at their best.

What’s The Next Step?

NGINX Plus does not just help you to harden your application, readying it for production traffic. When you scale your application up from one development instance to multiple production instances, NGINX Plus is the one constant element that gives you control.

All problems in computer science can be solved by another level of indirection.

Wikipedia defines indirection as “the ability to reference something using a name, reference, or container instead of the value itself”.

With NGINX Plus, users reference your application instance through NGINX Plus rather than directly. NGINX Plus is a level of indirection that gives you control:

  • Faster deployment – After you provision your application, adding a routing rule (and optional authentication) to the NGINX Plus traffic management tier is all you need to do to make it available and to start monitoring traffic.
  • Sophisticated request routing – When a simple load balancer is not enough, NGINX Plus’ advanced load balancing, session persistence, and health checks give you full control over where traffic is routed.
  • A/B testing – Using NGINX Plus’ split_clients directive, you can safely test alternative application versions, siphoning off a small proportion of your users to a new version so you can conduct side‑by‑side tests.
  • Seamless application upgrades – When deploying a new instance of your application, you can use NGINX Plus to gradually move users across as their sessions complete, without any interruption in service or loss of traffic.
  • Taking a server out of service – You can instruct NGINX Plus to stop sending new requests to an application instance that you are removing from an upstream group, but let existing sessions complete. This is known as ‘draining‘, and provides a safe way to take servers down without interrupting or impacting user sessions.

NGINX Plus is the trusted gatekeeper, giving you full control over which traffic you admit to your applications, how it is rate‑limited, authenticated, and secured, and where it is routed to.

Finally, Transforming Your Applications For The Future

Organizations are navigating their way through complex application changes. The desire to optimize for speed of delivery rather than cost is driving significant transformations in the ways that development teams build modern web applications.

Nordstrom went from optimizing for IT cost to optimizing for delivery speed.

Your application infrastructure and your development processes will suffer great upheavals. Processes will change when you adopt continuous delivery and DevOps instead of big‑bang waterfall‑driven releases. Architectures will change when you adopt microservices instead of monolithic web applications. Deployment will change when organizations adopt cloud‑based as‑a‑Service platforms and reduce their dependencies on on‑premises software and hardware infrastructure.

In the face of this continual upheaval, you’re expected to deliver consistently high‑quality applications. NGINX Plus is the one constant you can count on. No matter what happens “behind the scenes,” no matter where you deploy your applications or the languages and platforms you select, NGINX Plus is the consistent, reliable, and high‑performance application delivery platform that you, and millions of other developers, rely on.

You build great applications. NGINX delivers them.

And try out our fully supported, enterprise‑grade application delivery platform, NGINX Plus – start your free 30-day trial today or contact us to discuss your use cases.

Hero image
Free O'Reilly eBook: The Complete NGINX Cookbook

Updated for 2024 – Your guide to everything NGINX



About The Author

Owen Garrett

Sr. Director, Product Management

Owen is a senior member of the NGINX Product Management team, covering open source and commercial NGINX products. He holds a particular responsibility for microservices and Kubernetes‑centric solutions. He’s constantly amazed by the ingenuity of NGINX users and still learns of new ways to use NGINX with every discussion.

About F5 NGINX

F5, Inc. is the company behind NGINX, the popular open source project. We offer a suite of technologies for developing and delivering modern applications. Together with F5, our combined solution bridges the gap between NetOps and DevOps, with multi-cloud application services that span from code to customer.

Learn more at nginx.com or join the conversation by following @nginx on Twitter.