How to Manage Sudden Traffic Surges and Server Overload

Original: https://www.nginx.com/blog/how-to-manage-sudden-traffic-surges-server-overload/

For many retailers, the COVID‑19 pandemic changed where and how their customers shop for the holidays. Locked out of brick-and-mortar stores, shoppers flocked to online retailers more than ever before, spiking e‑commerce sales to $189 billion in 2020, a 33% increase over 2019. With fewer than six months standing between retailers and this year’s holiday shoppers, we’re revealing several ways you can leverage NGINX and prepare for sudden traffic spikes.

Step 1: Know Where You Stand Against Your Competition

Before making changes to your stack, it helps to know just how much you need to maximize your “Cyber Season” performance to thrive instead of just survive. Start by collecting data about the performance of competing websites. Time to load a page is probably the most important metric – many of today’s impatient users abandon a site if it doesn’t load within three seconds. There are many tools available for measuring load time, lots of them free. An easy place to start looking is a recent Geekflare review of 11 testing tools.

Consider measuring load time for these pages:

Testing key pages for half a dozen competitors along with your own site takes just a few hours. (Be sure to clear your browser cache by using Shift+Refresh before measuring download times.) Armed with results, this is what you do next:

Step 2: Run NGINX, Like the World’s Busiest Websites

Earlier this year NGINX became the #1 web server on the Internet. We’re honored so many sites trust us to deliver their websites and apps, and hope you will too. But NGINX is more than just a web server. It’s an all-in-one software reverse proxy, load balancer, cache, and API gateway.

One of NGINX’s most important benefits is how it optimizes the flow of traffic into your site. Think of NGINX as a doorkeeper, managing traffic at the front of your store. It gently queues up and admits each shopper (HTTP request), transforming the chaotic scrum on the sidewalk into a smooth, orderly procession in the store. Shoppers are directed to the specific location of items on their wish lists, ensuring that traffic is distributed evenly and all resources are equally used.

NGINX primarily employs two out-of-the-box techniques to achieve this:

In addition to optimizing traffic flow, here are more four ways you can leverage NGINX to optimize your site and prevent server overload during a traffic surge.

Read on for details on:

Improving Web Page Response Times with Caching

Click-and-collect, online ordering for in‑store pickup, and even customer payment options increase the likelihood of a successful online transaction. Content caching with NGINX has a similar effect for web traffic. NGINX automatically stores each file it sends to clients, and serves subsequent requests for a given file directly from the cache. Caching not only gets responses to users faster, it reduces the load on your upstream servers because they don’t have to process the same requests over and over from scratch. Depending on your application, content caching can reduce the volume of internal traffic by a factor of up to 100, reducing the hardware capacity needed to serve your app.

For more details about caching and sample configurations, see Cache and Microcache Your Site Content and A Guide to Caching with NGINX and NGINX Plus on our blog.

Managing Visitor Traffic with Connection, Rate, and Bandwidth Controls

At the busiest times, the doorkeeper for your store might need to limit the number of shoppers coming in. This might be for safety reasons (avoiding overcrowding) or preferential treatment of valued customers (VIP hours, invitation‑only promotions, and so on). Web apps need to take similar measures. You can prevent server overload by limiting the amount of traffic entering your site, ensuring that clients get timely access to the required resources. NGINX (and in container environments, NGINX Ingress Controller) offer a range of methods for limiting incoming traffic, including:

You can differentiate between different types of clients if necessary. Perhaps the delivery area for your store does not extend to Asia, or you want to prioritize users who have items in their shopping baskets. You can leverage cookies, geolocation data, and other parameters to control how NGINX applies traffic limits.

Avoid Server Overload with Elastic Scaling

Traffic surges can easily cause server overload if you don’t have adequate infrastructure in place. NGINX’s lightweight, event‑driven architecture maximizes app delivery performance with the infrastructure you already have. Our sizing guides for NGINX Ingress Controller and for NGINX Plus on bare metal and virtualized environments help you determine accurate operating expenses for the performance and scale you are preparing for.

There are additional NGINX features DevOps teams can leverage to effectively scale for traffic spikes:

Protect Customer Data with Built-In Security

Making transactions secure is table stakes for any website, but especially for online retailers who handle credit card information. As unlucky retailers such as Target know firsthand, a breach can mean a tarnished brand and lawsuits. Target addressed its 2014 data breach with enhancements that improved visibility and tightened security. Stand out from the competition with one of the most secure shopping experiences in the market by implementing:

Now You’re Ready

Arming your web properties with our enterprise-grade solutions now means you can rest assured you’re ready for whatever the year‑end shopping season has in store (or online!) in 2021.

Free 30-day trials are available for all of our commercial solutions:

Or get started with free and open source offerings:

This blog includes contributions from Owen Garrett and Floyd Smith.

Retrieved by Nick Shadrin from nginx.com website.