Don’t be a victim of Cyber Week crashes: start testing with Gatling Enterprise Cloud
It’s that time of year again! Black Friday and Cyber Monday are just around the corner and if you’re going to face higher than usual traffic volumes then you’ll need to be prepared. Load testing is one way to ensure your e-commerce site can withstand the increased traffic volume as well as spot any potential issues you’ll face during peak periods.
Every year we write about load testing for Black Friday and Cyber Monday: you can find our 2020 post here and our 2021 post here. The message is largely the same, that load testing can help understand how your e-commerce website will react to traffic so you can understand what steps you’ll need to take to prepare your website for the traffic you’ll receive on Black Friday. However, every year websites experience the same problems and crashes. So we’re back again with another article on how to prepare for Cyber week, although this time we’ll be specifically focussed on Gatling Enterprise Cloud and will be providing some more specific directions on how to get moving in the right direction. So let’s start with the basics and then we’ll go directly into the types of tests you should run and how to run them with Gatling Enterprise Cloud.
What am I actually testing and how will this help us?
What you’re actually testing is the response times and errors for the requests and API calls that occur when a user is accessing and navigating your website. After you complete a test you’ll be able to see if any requests or API calls are slow or run into errors and what amount of traffic is causing them to experience these issues. Seeing these reports won’t tell you how to fix these errors but it will give your development team a better idea of where to look. Knowing what amount of traffic will break your website or cause an outage will allow you to see what kind of resources you’ll need to prepare for the traffic you can expect during Cyber Week.
How much traffic can I expect on Cyber Week?
If you’re not sure how much traffic to expect, the best way to guess might be to look to the past. If you’ve got a well established site that has had consistent traffic levels over the last few years, you can check your analytics for past years to get a rough idea of what you can expect.
If your website is new though though, or has expanded so much that your past traffic isn’t relevant, studies have shown that traffic to the top 100 shopping sites increased 137% on Black Friday and 112% on Cyber Monday. Additionally, you can expect much of this traffic to occur in spikes with many customers trying to access websites at midnight to ensure the deals they’re looking for aren’t sold out.
How should I get started with my Cyber Week Load Tests?
Testing with Gatling allows you to simulate traffic on your website or ecommerce application. In order to get started, you’ll need to download Gatling Open Source. You can find everything you’ll need to know about installing Gatling here.
Once you’ve installed Gatling Open Source, you’ll need to create the scripts you’re going to be using to build your simulations. If you want to learn everything about Gatling Scripts, I recommend digging into our documentation and taking courses in the Gatling Academy (there’s even a whole module dedicated to testing an ecommerce site).
For now though, let’s focus on the key points you’ll need.
Get a realistic user journey
You probably have a good idea of how you’d like your user to experience your website:
However, users might have a different process. It’s important to use analytics tools to find out how your users are actually using your website. Once you’ve done that you can use the Gatling Recorder to replicate this journey and then add different injection profiles to complete your scripts.
What are the tests I should run and what do their injection profiles look like?
For Cyber Week I suggest running 3 different types of tests to ensure you’ve got the best picture of how your site will react to traffic. If you’re a frequent Gatling Blog reader, you’ve heard them all before but we’ve included some sample injection profiles in our Java DSL here to help you on your way.
Spike Test
Injection profile:
scn.injectOpen( rampUsers(20000).during(1), );
The above injection profile is a VERY intense soak test adding 20,000 users performing your user scenario over 1 minute. However, for an event like Black Friday this isn’t out of the realm of possibility. If you expect less though feel free to change the numbers to what’s realistic for you. This test will give you a great idea on how your website deals with a sudden spike of traffic, hence the name. You might need more than one load generator to run a simulation with this many users, depending on the script.
Soak Test
Injection profile:
scn.injectClosed( constantConcurrentUsers(1000).during(600), )
On Black Friday you can not just expect spikes of traffic but higher than average consistent traffic throughout the day. The above injection profile would simulate 1000 concurrent users running through your scenario for 10 hours. Feel free to adjust the numbers to more accurately reflect your traffic. A soak test like this can help give you a better understanding of how your site will react to sustained traffic over the course of a huge day like Black Friday or Cyber Monday.
Capacity Test
Injection profile:
scn.injectClosed( incrementConcurrentUsers(1000) .times(6) .eachLevelLasting(3) .separatedByRampsLasting(1) )
Finally, do you want to know exactly where your site hits its limit? A capacity test is the perfect way to find out. Above we have a capacity test that slowly adds users and stays at a level for a while so you can see exactly where your website starts to slow, bend, or break. Here’s an example of what the user arrival would look like for the above user injection:
Why perform my tests with Gatling Enterprise rather than Gatling Open Source?
Don’t get me wrong, Gatling Open Source is a very powerful tool and a great way to start testing. However, in a sales season with hundreds of thousands of dollars at stake, if there’s a crash, the history, distributed testing and advanced reporting features you get with Gatling Enterprise are more than worth it. Let’s go over a few of the standout features and how they can help. For a full list of the run history and report features check out our post from last week breaking down everything in Gatling Enterprise Cloud’s reports.
Run History
Gatling’s motto is to test, succeed, and iterate. Every time you run a simulation in Gatling Enterprise you’re able to compare the results of your most recent run to your previous run. This allows you to have your developers make changes after each run (ITERATE!) and directly compare how those changes have affected your response times and error ratios. You can do this manually with Gatling Open Source but seeing the trends and reports makes this faster and easier for you and your development team.
Distributed Testing
Where Gatling Open Source uses your computer as the load generator, Gatling Enterprise Cloud allows you to select and distribute the traffic you’re generating from different geographic regions around the world. This way you can replicate the traffic you actually receive and get more accurate results. You can even adjust what percentage of the traffic you want to be generated by each specific region as seen below.
Advanced Reporting
When you run a test with Gatling Open Source, you’ll get a response time that includes the total elapsed time the request took to receive a response. This includes:
- The DNS resolution time
- The TCP connection time
- The TLS handshake time
- The HTTP roundtrip
So everything that happens during all those steps is reported back to you in one figure.
On Gatling Enterprise you get to see the time elapsed for each of these steps individually for each request. This allows your dev team to get a much better view of where bottlenecks or breakpoints are and what to address in order to fix them.
OK, I’m ready to test! Where do I go?
As mentioned above, if you’re a pure beginner the best place to start is the Gatling Academy. However if you’ve already got your scripts, you can head directly to cloud.gatling.io and create your account. Black Friday is still two months away so the time to start testing is now. If you have any questions, please don’t hesitate to reach out to sales@gatling.io.