Jan 8

How To Prevent Black Friday Website Slowdowns

Your website will likely see a sudden traffic spike on Black Friday, which increases the load on your servers and there may be particular parts of the website that are particularly expensive to call.

As Black Friday is perhaps the most important day of the year for ecommerce sites, the consequences of a slow website are much higher than any other day of the year.    

To help you prevent a Black Friday website slowdown, we'll outline specific action steps you can take now to optimize your website for optimal performance.

1. Reduce Server Load With a CDN

CDNs reduce the traffic that actually comes to your server so that the additional traffic spike you experience on Black Friday isn’t as impactful on website performance. 

They do this by distributing cached copies of your content across a network of global servers.

Therefore, your servers will only receive a fraction of the overall traffic (typically about 1% to 25%).

This speeds up content delivery and significantly reduces the load on the original server, as many requests are offloaded to the CDN's distributed servers.

As a result, users get the data they need faster, which can increase conversion rates, and the company also enjoys reduced server costs. 

To summarize, implementing a CDN can give you the following benefits:

  • Reduced hosting and data transfer costs by offloading traffic to edge servers.

  • Improve website speed by serving users from geographically closer servers.

  • Enhance site reliability by providing redundancy against server failures.

  • Improved security with features like DDoS protection and encryption.

  • Improve scalability during traffic surges and positively impact SEO due to faster load times.

There are plenty of CDNs for REST APIs, like Cloudflare, AWS CloudFront, and Fastly.

However, most aren't designed for GraphQL, and many GraphQL users have to build their own solution.

This process is costly and isn't a great use of the engineering team's time as it doesn't directly improve your business's core value. 

To solve this problem, we built Stellate, the first GraphQL CDN. It's powered by Fastly's 98 worldwide edge locations and gives you all the benefits of a CDN without the cost of building and maintaining your own system. 

It's also a truly out-of-the-box edge caching solution as it gives you all the tools and automations you need to efficiently optimize your caching solution. Here are just a few of the features it offers that make caching easy:

  • Fine-grained cache control: You can create custom rules to define specific GraphQL query results you want to cache and for how long based on fields and types.

  • Automatic mutation invalidation: Stellate automatically invalidates any changed data sent to your GraphQL API.

  • Instant global cache purging: If you don't build a granular purging mechanism, you'd have to purge all the data from the cache at once, which would drop the cache hit rate to zero and could overload the server. Stellate solves this problem by allowing you to purge data based on a certain parameter, such as product price or items in stock.  

Stellate also gives you access to cache purging metrics and analytics that show when types have been invalidated and which queries are affected. We also show what triggered the purge.

These insights make it easy to tell if you’re using the cache efficiently, leading to better response times and performance.

Another issue with GraphQL is that it doesn't offer any observability metrics out of the box, which makes it difficult to understand how to improve your cache hit rate. 

So we built detailed observability metrics into Stellate to solve this problem. In addition to providing your current cache hit rate, you’ll also see:

  • Cacheable Bandwidth

  • Requests

  • Latency P95

Though perhaps most importantly, you’ll also see a consolidated list of the biggest improvement opportunities. 

For example, you can see from the dashboard below that improving the caching for the product listing page could improve your cache hit rate by 9.6%. The next biggest opportunity is optimizing the user profile, which could improve the cache hit rate by 7.8%.  

With these metrics, you don’t waste time making minor optimizations and can instead triage opportunities by impact. 

Stellate also offers a selection of other helpful GraphQL metrics, like user engagement, global latency, and more.

You can see for yourself how Stellate can help you improve your caching strategy by signing up today.

2. Implement Rate Limiting

The steps above optimize your website to efficiently handle more traffic on Black Friday. Yet if your website still can't handle the traffic spike even after executing these best practices, implementing rate limiting can prevent the website from going down altogether as it restricts the number of requests a user can make to a service within a specific time frame. 

Even if rate limiting forces some users to wait, it's a far better option than the entire website crashing. 

Within Stellate, you can set the following rate limiting rules:

  • Request based rate limiting

  • Custom limits per query or mutation

  • Different limits for different customers

  • Complexity based rate limiting

Another key benefit of rate limiting is that it allows you to prevent a single person (or bot) from purchasing all of your products during a popular product drop. 

Rate Limiting Hero Image
Rate Limiting Hero Image

To do this, you can implement a custom limit on the "add to cart" operation so that an individual user can only make a purchase every few seconds. For example, if you set the limit to one purchase per user every five seconds, a bot would have to wait five seconds before making another purchase. 

This ensures fair play and prevents a reseller from snatching all of your products before legitimate customers can purchase them. 

3. Set Up Alerts

As Black Friday is only a 24 hour event, any errors preventing users from purchasing a product will cost you sales as those users likely won't return to purchase the next day. Instead, they'll just purchase from another competitor.

To proactively identify and fix errors before they negatively impact sales, set up alerts for critical steps in the buyer's journey. 

A few of the alerts we recommend you create for Black Friday include:

  • Product pages

  • Add to cart functionality

  • The signup/login functionality 

  • Checkout pages

Stellate makes it easy to set up alerts for each of these functionalities, and you can also specify the type of error you want to be alerted about and the error percentage threshold within a given timeframe:

Alerts Types - Create Step
Alerts Types - Create Step

If the error does occur, Stellate provides detailed information on the error, such as who was impacted, where it occurred geographically, the device it occurred on, and more. This helps you quickly diagnose the issue, reducing the time required to fix it. And on Black Friday, every second counts!

4. Perform Stress Tests 

Finally, your plan is only as good as it performs, so be sure to stress test consistently before Black Friday to simulate high traffic situations and proactively identify issues that negatively impact performance.  

As you're stress testing, ensure you aren't constantly running the same requests. If you are, some of the data may become cached, and the test won't reflect a real-world scenario of what might happen if thousands of unique users in different locations on different devices.

5. Compress and Optimize Media 

Product images and videos can slow down your website, and any latency will be exacerbated on Black Friday during high traffic periods.

To prevent media from slowing down your website, here are a few optimization tips:

  • Use a CDN, like Fastly or CloudFlare

  • Minimize JavaScript and CSS

  • Implement caching for standard HTTP requests

Once you’ve optimized your media, perform stress tests to simulate high-volume traffic and monitor real-time server performance.

6. Create A Backup and Recovery Plan

It's also essential to have a backup and recovery plan in place with very clear instructions – clear enough that even a junior engineer could execute them. 

Once you have a backup and recovery plan, practice recovering your data with it to ensure you know how to do the backup and that the backups are in the correct format. 

If your backup plan doesn't work, you'll want to discover and solve that issue before Black Friday! 

Final Thoughts 

Any website slowdown will decrease conversions, yet on Black Friday, the impact of any latency is magnified as it will affect more users, and ultimately, sales.

However, you don't necessarily need to make drastic changes to your infrastructure to prepare for Black Friday. Previously, GraphQL users had to manually build and maintain their own caching solutions, which is a costly and time consuming endeavor. So, we built Stellate, the first GraphQL CDN, to solve this for you.

You'll also have access to observability metrics, alerting, and other critical features you'll need for a successful Black Friday.

You can learn more by scheduling a demo, or try it out for yourself today.