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
- 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.
- 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.
Recommended tools
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.
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.
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.
- User navigates to a product.
- User adds the product to their cart.
- Check if adding to the cart was successful or not.
- Proceed to fill out the checkout form.
- Place the order.
- 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:
- Use ridiculous high number of users and run the tests.
- Your server crashed.
- Increase the hosting server resources, more CPU Cores and RAM.
- 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.