Load testing your WordPress site

Author - Vic Lobins

Posted By Vic Lobins Lead Back End Developer

Date posted 13th May 2020

Category WordPress


What is load testing?

Load testing is a type of performance testing run on a specific application (web or otherwise). Essentially it’s a way to check how the application behaves with multiple concurrent users interacting with it.

The aim is not to immediately go to extreme lengths to break the site, but to measure how the site reacts to an increasing number of users (within an appropriate limit) over a time period.

Why should you load test your WordPress site?

When you are load testing, the aim is to gradually increase the load in order to find out how the system operates under it. In doing so you will discover the maximum capacity of this system, find memory leaks and bugs, and check whether the infrastructure running the application can support it properly.

A great example of this is when a post, a page or another resource on your website goes viral. If your content blows up overnight on the likes of Twitter or Reddit the amount of users viewing your site will massively spike causing server overload. This means users won’t be able to load your page, or it will take a lot longer to load. This happens every year when Glastonbury tickets go on sale, and it doesn’t just mean you can’t view that page and get those tickets, the entire website suffers for it.

We’ve also seen this recently as JustGiving struggles to cope with the demand of donations thanks to Captain Tom’s NHS fundraising!

Your main goal when load testing, is to measure peak operational capacity. You’re trying to make sure that in the unlikely event of a load spike, your infrastructure and your application won’t fall over. The test allows you to record and analyse data which in turn will allow you to prepare and modify your application and infrastructure for launch.

What do you need to do before you begin load testing?

Generally you want your website to be as optimised as possible from the start, which is something we constantly strive for and keep at the forefront of our minds during our WordPress development process.

Before undertaking a load test it’s good practice to run performance tests using the likes of Google Lighthouse. These measure page load speed, enumerate HTTP requests and generally show you how optimised your site is (including lots of guidelines on how to improve it).

It’s a good idea to familiarise yourself with your web hosting provider and the infrastructure/hardware your site is built on, as well as the LAMP environment for your WordPress site. Find out any limits and restrictions on your system, shared host accounts with the likes of GoDaddy have restrictions on CPU cores, memory allocation, and I/O processes.

Testing should be done on a stable ‘ready for release’ application, however it goes without saying, do not do this on your live site!

Familiarise yourself with some testing tools, there is an array of tools available both commercial and free. Loader.io is a good place to start. Another well known favourite is Tsung, there’s a vast amount of information available out there (great article on Tsung by WPMUDEV here)

What results can you expect when load testing?

I ran the below test on a pretty old portfolio website of mine which is running PHP 5.6. The main thing here is the Response Counts panel, the test only simulated 250 users over 1 minute because I was being gentle, but none of them failed or timed out. Running it a second time with 5000 users per minute unsurprisingly failed as this is on a shared hosting platform with many restrictions, it’s fair to say that if you’re expecting a large number of users that you go with a dedicated hosting platform!

93digital load testing
Source: Loader.io

Another important stat is the average response time, which in the first run was gauged at 2975 ms (almost 3 seconds). The more concurrent users the larger the number, and in this case 3 seconds to load a home page is way too long! There have been numerous studies and articles published about the impact of page load speeds, some of them claiming that 40% of people abandon a website that takes more than 3 seconds to load.

Ideally you want the average response time to be low and your timeouts or load failures to be zero, but this is essentially a benchmark test. It provides valuable data which you can then use to strengthen your infrastructure and improve your application.

How to measure application performance during load testing

Load testing tools let you actually apply the load and see when limits are reached, but sometimes it’s helpful to have a more detailed look inside your application to see how the inner workings perform. A useful tool for doing this is New Relic.

New Relic
Source: New Relic

New Relic application performance monitoring can help to identify some of the areas that might be holding your website back whilst it’s under high load, or where it’s not performing as well as it could be, for example if your theme or plugins are slowing down your MySQL database.

Altogether, load testing can be an important part of preparing a site for launch into a potentially high pressure enterprise environment.

Let's Talk

Do you have a web design and build project coming up that you would like to talk about?