How to Traffic Load Test WooCommerce

WooCommerce is powerful, but only as limited by the power of your server infrastructure. Therefore, it’s important for you to know the limits of your shop. I often see the people asking the question: how many users can WooCommerce handle? The answer depends on your hosting provider, server specifications, plugins and cache setup.

What is load testing?

Load testing is the process of simulating heavy user traffic to websites. The goal is to find out exactly how many concurrent users a site can handle before it crashes. There’s it’s important to use various of testing methods to simulate user behaviour. These can range from:

  • Soaking: The number of users will increase for the duration of the test.
  • Spike: The number of users will quickly increase and then decrease.
  • Maintain Load: A set amount of users will be navigating the site for duration of time.

Should you load test a small site?

Yes, you should be load testing your site even if it’s small. You website might be handling your regular traffic well, but there are events where sites experience traffic spikes. Traffic spikes can be unexpected, you should be prepared even for a small site. Traffic spikes usually happen when there’s a surge of users visiting your site because of viral article, being shared on social media, or users clicking on your site from a email marketing campaign.

Unexpected traffic spikes can be expensive. If your website is not prepared for a traffic surge, you risk the server crashing. Once your server has crashed, no one will be able to load the site. If you’re running a eCommerce store, your customers will also be disappointed and you’ll suffer a loss in sales.

What to do before load testing

  1. I highly recommend that you create a staging/test version of your WooCommerce site on a server that mimics your production server. You don’t want to accidentally crash your production site and miss out on customer orders.
  2. Look at your analytics over the past year. Did you have any traffic spikes? Make a note of your regular concurrent users and how many users visited during a spike. You should try load testing at different multiples of your current traffic. e.g Can my WooCommerce store handle 5x the users from my last traffic spike?

Load testing WooCommerce

Now that we have an understanding of load testing, let’s apply it to WooCommerce. WooCommerce is built on PHP, MYSQL which runs on a server. The server configuration has limited resources such as CPU power and RAM.

Crashing WooCommerce shouldn’t be the goal, but it is good start. During a load test it’s important to keep track of processing power and RAM usage. This will give you a good indication of how far your can push the current server configuration.

I’ll provide you with an introduction into load testing, rather than a full guide. First thing is first, you’ll need load testing tools to simulate user traffic to your WooCommerce store.

Loader.io

The first and simplest tool I’ll recommend is Loader.io. Loader provides a realtime dashboard while your tests are running. You can keep an eye on exactly how long each user request takes and see exactly when the server starts struggling.

Example Load test dashboard on Loarder.io

k6.io

A more flexible and robust solution to load testing is k6.io. K6 is my favourite tool because of the flexibility when it comes to writing tests. You can even record a step by step test by using their browser extension.

You can really narrow down the test to show if each step in the flow was successful or failed.

I’ve personally used the k6.io CLI to test products in WooCommerce cannot be oversold when using our Reserved Stock Pro plugin.

I’ve personally used the k6.io CLI to ensure our plugin Reserved Stock Pro will prevent overselling in WooCommerce. During a rush sale with high number of users, If there are 10 products in stock, only 10 customers should be able to add the product to their cart.

Example load test with WooCommerce and stock using k6.io
Example test of Reserved Stock Pro during a load test

The wonderful team at k6.io has developed a starter load test template For WooCommerce.

You’ll be able to check the entire cart & checkout flow with K6.

  1. User navigates to a product.
  2. User adds the product to their cart.
  3. Check if adding to the cart was successful or not.
  4. Proceed to fill out the checkout form.
  5. Place the order.
  6. Check if order was successful.

What do you do after you’ve written you test? Scale it up! The power of K6 is in the ability to set the amount of virtual users and how they should distributed in your test over the duration. Try the different methods of load testing, that I mentioned above.

Learning from your WooCommerce load testing

Once you know your WooCommerce max limits on the current server configuration, you can take the opportunity to make a “scale” plan for your WooCommerce store. I admit it’s not the best name I’ve come up with but here’s what I mean.

A scale plan should be in place for when you expect an heavy amount of traffic to your WooCommerce store with short notice. If you are expecting a high amount of traffic to your WooCommerce, you can scale up your server to support the traffic spike with ease. All customers will then be able to purchase products without any slow downs from WooCommerce. After the traffic spike you can scale your server back down to the normal operation.

Creating a scale plan:

  1. Use ridiculous high number of users and run the tests.
  2. Your server crashed.
  3. Increase the hosting server resources, more CPU Cores and RAM.
  4. Repeat until your server doesn’t crash.

The increased server configuration should serve as your scale plan. You’ll be ready to increase your server at a moments notice.

Avatar photo
Morgan

I help eCommerce store owners to run their stores smoothly and get more sales. Let's discuss optimizing your store! Hit me up via the support page or on Twitter @morganhvidt