How to load test WordPress sites
Load test or stress test is measuring how many visitors your site could handle. Technically Requests per second!
This guide is all about load testing WordPress sites, some tips on how to handle sudden spikes, and how I handle it.
TABLE OF CONTENTS
- Why you should Load Test?
- Before Load Testing
- How to Load Test a WordPress website?
- Create a free account and verify domain
- Create a new test
- Analyzing Test Results
- How to handle High Traffic in WordPress?
Why you should Load Test?
What happens when your blog posts go viral?
Well, 237 real-time users are not that great, we have clients with 1k-2k real-time users!
Unless you properly load test a site, you don’t know whether all users are able to open your site during these spikes.
Trust me, only a few hosting providers in this world can’t handle this! (listed at the bottom).
Before Load Testing
Load testing is done by sending fake users to your website/server. Here are some points that you need to consider before running a load test.
- Some hosting providers charge based on the number of users/visits.
- While load testing your site may become unavailable to some users based on the load capacity of your server (that’s what we’re going to test).
How to Load Test a WordPress website?
There are several tools and services that can do a load test. In this guide, we’re going to use Loader.io.
- Free (freemium)
- Supports up to 10k users in the free plan
- Easy to use interface
- Supports incrementing users
- Developed by SendGrid (a leading email service)
Create a free account and verify domain
Create an account on Loader.io and verify your domain. You’ll need to download a file and upload it to the root of your WordPress directory (verification via DNS is in their paid plan).
Create a new test
Now let’s create a new test (aka load test) as follows:
Note the “Test Type”. There are multiple options like clients per test, clients per second, and maintain client load.
Maintain client load will start sending zero users and gradually increase it second by second. In such a way we can make sure that at what point it breaks!
Analyzing Test Results
Once your test is complete, you’ll get a report like this:
The key elements we’ve to look for is the ‘Response Counts’. The counts other than success means that much requests failed.
Luckily none of them failed for me! (I don’t believe in luck, learn how I did it below).
How to handle High Traffic in WordPress?
As you can see I was able to test 10k users per second with 100% success rate. The main trick that helped to achieve this is to use JungleWP's HTML pages optimizations that thanks to Cloudflare will cache your site at the edge level.
- Never use shared hosting. We provide VPS servers or managed hosting for WordPress . And we really know to handle scaling and handle traffic.
- Implement Redis/Varnish caching (Comes ready with all our Managed Enterprise Plans)
- Offload the server load using a CDN. We use Cloudflare, KeyCDN, Amazon Cloudfront, Google CDN.
- Create a static version of pages. Use cache plugins like WP Rocket or WP Fastest Cache. All our plans come with a Premium WP Rocket Licence.
- Compress images. Check our Image compression addon.
- Minimize HTTP requests. Included in all our Premium care Plans
It’s very important to run a load test and make sure your WordPress site is ready to handle high traffic. Otherwise, you’re going to lose some precious users!
Running a load test is pretty easy as we covered. However, achieving high RPS (requests per second) is very hard. That's where we can help you.