How to Prepare your Website for an Occasional Traffic Spike

How to Prepare your Website for an Occasional Traffic Spike

Some websites have small or moderate traffic most of the year. However, there are times when it suddenly increases. It happens because they offer seasonal products or services like Christmas decorations, swimsuits, or summer holiday trips. A large number of visitors coming to the webpage during such seasons can even cause its crashes. Fortunately, it’s possible to adjust the servers’ configuration to handle the occasional traffic spikes. We’ll show you a scalable and cost-effective solution that we implemented in one of our projects.

Is upgrading to high traffic website hosting necessary?

Traffic increase on your website is something that you, as its owner, definitely celebrate. People are interested in your products or services, and it drives sales. However, the type of server infrastructure you’re using might not be able to process a bigger number of requests, as its primary hosting requirements were probably different. Then your website can go down, and you can lose many valuable transactions. Reconsidering your webpage hosting will be necessary here. You don't have to immediately go for expensive solutions dedicated to high traffic websites and pay for them even when you don’t need to process big traffic.

The answer to your problems is scalable and highly available cloud infrastructure. It’ll handle your regular site traffic at a minimal cost. Your spending will rise during the traffic spike, but the capability will still be very high, and the website constantly accessible for your visitors.

Amazon Web Services

One of the cloud solutions that ensure flexibility is Amazon Web Services and its Amazon Aurora and AWS AutoScaling options. The first one is MySQL and PostgreSQL-compatible relational database created for the cloud. When the traffic increases, the website still loads fast, since this database is five times quicker than regular MySQL databases. Thanks to scalability, you can adjust the settings to both smaller and larger web traffic.

AWS AutoScaling takes scalability to a higher level as it monitors a webpage or application and adapts its capacity to provide a stable operation for the lowest possible price. The cost optimisation in this service means that you pay for the resources you need at the exact moment. Then, when the traffic drops on a website, AWS AutoScaling automatically turns off the additional capacity resources which reduces your spending.

Now, we’ll take a closer look at how these AWS solutions can work in practice by analysing the 911day.org website we developed and prepared for dealing with the occasional big increase in traffic.

Managing traffic spike on 911day.org website

MyGoodDeed foundation pays tribute to people killed and injured in the terrorist attacks on the 11th of September 2001 by encouraging Americans and others to do good deeds. The foundation organises initiatives, like volunteer projects and delivering meals to people in need, that others can join, as well as inspires them to create their own activities.

Challenge

Traffic on the 911day.org website is moderate most of the year. As the anniversary approaches, it begins to grow rapidly. On the 11th of September appears the spike.

Google Analytics data of the 911day.org website showing the traffic spike

Google Analytics data of the 911day.org website showing the traffic spike.

Knowing that the traffic significantly increases only once a year, the website owners didn’t want to maintain the high traffic infrastructure throughout the year.

Solution

To answer this webpage’s issue, we created the dynamic, highly available, and scalable cloud infrastructure in Amazon Web Services. It lets reduce the costs to a minimum during the time of the regular website traffic. When the traffic spikes, the spending increases to provide the 911day.org website the highest efficiency.

Architecture’s details

As Drupal development experts, we built the 911day.org website on Drupal CMS application which uses PHP and MySQL. Considering the latter, we chose Amazon Aurora, the database compatible with MySQL. It scales automatically when the load grows which was crucial for this project.

We moved the webpage’s code to Amazon Elastic Compute Cloud (Amazon EC2), and we placed the shared files, like media, styles, and sessions, in Amazon Elastic File System (Amazon EFS). This way, the shared files can be synchronised between many instances.

The website’s architecture is defined as a code and managed by Terraform, infrastructure as a code software tool. It allowed us to create the configured and ready-to-use virtual machines in a few minutes. Then we plugged the machines into the Elastic Load Balancer which divides the traffic equally on all machines.

During the time of regular traffic, the 911day.org website uses two machines which is a default setting. Below you can see how the complete architecture looks.

The architecture of 911day.org website during a regular traffic

When the traffic grows, we increase the value of the variable related to the number of machines, and Terraform adjusts its configuration. Around the 11th of September 2020, we were adding more machines (up to eight) to handle the large traffic. Here’s how it changed the website’s architecture:

The 911day.org website’s architecture during an increased traffic

With our configuration of AWS infrastructure, the 911day.org website seamlessly handles the large traffic spike on the 11th of September. The tailor-made hosting solution turned out to be the most effective for the MyGoodDeed foundation’s needs.

Flexible and scalable infrastructure

Having occasional website traffic spikes, you don’t have to be overwhelmed with the new infrastructure costs. Thanks to the flexibility and scalability of cloud solutions, you’ll pay more only when the load increases. And the high availability of services like AWS will prevent your site from going down during the large traffic time. This way, you won’t lose valuable visitors nor transactions.

Increase your Google ranking. SEO for a Drupal website