What is Load Testing?
Load testing is a type of performance test you can run on your website that can help determine how well your site handles a large volume of traffic during a specified duration. This is accomplished by using a service or program that simulates real traffic. Once the parameters of the test are defined, the simulated traffic is then sent to the website and the site’s performance is monitored.
The results of the test can be measured from two vantage points: the program which performs the test and the server on which the website is hosted. For a complete picture of how your website handles the load test, ideally measurements would be monitored from both vantage points.
The program running the test can provide information that would be helpful in determining the perceived effect of the load test that your website visitors might experience. For example, how slow do pages load during the test and how many users experience an error page because the server can’t handle the load.
The server that hosts the website can provide information that would be helpful in determining whether the server’s resources need to be increased. For example, by monitoring the server’s CPU and memory usage during the test, you can see how close each resource is to reaching its limit and therefore might need increased.
Is Load Testing Important?
Load testing is not a simple task to perform, especially if you plan to do everything yourself. Most of you reading this probably already have a live website you want to determine the load for. Extra care needs to be taken here as the load test could potentially crash your website or at the very least slow it down while the test is running. This begs the question – do you even need to perform a load test on your site?
There is no easy yes or no answer to this question. Are you currently experiencing site slowness or timeout errors? Are you running an eCommerce site? Do you frequently have large spikes in traffic? Are you expecting a large spike in traffic from a promotional event? Would the consequences of your site crashing during a traffic spike be devastating? Are you managing a website for a very important client whose business you can’t afford to lose?
The more yeses you answered above, the more likely you need to perform a load test. Let me share a personal experience that load testing could have helped prevent.
Load Testing Anecdote
A few years ago the VPS server that hosted DiviPlugins.com began to throw 503 errors occasionally while visiting the site. Although concerned, it was rare enough (maybe once or twice a week) that I wasn’t so concerned to investigate right away. That would turn out to be a bad decision.
Shortly after the 503 errors began, I sent a newsletter to roughly 10,000 diviplugins.com subscribers (sent in blocks of 1,000 subscribers every 10 minutes). Almost immediately my website crashed. I logged into my hosting account, restarted my VPS server, and everything was up and running – for about 30 seconds when it crashed again. For the next two hours I had to monitor the server, restarting it every few minutes in the beginning and then every 10 or 15 minutes as the traffic died down until finally the nightmare was over.
I don’t remember if the newsletter was to announce a new product or a sale but I believe it was one of those two. In other words, the consequences of the website crashing were lost sales and frustrated users. I felt horrible about both. It wasn’t my finest hour but it also wasn’t the end of the world.
The point is, it could have been prevented by performing a load test. The sporadic 503 errors were a warning that I was reaching my server’s limits. Within a few days I worked on optimizing my site and migrated my hosting from a VPS server to a cloud server. More on that below.
How to Perform Load Testing
Again, load testing is not for the faint of heart. It’s not rocket science. But as with any task that we rarely perform or have never performed before, there is going to be a learning curve. There are several methods you can use to perform a load test with varying degrees of difficulty and thoroughness.
Regardless of which method you choose, I would highly recommend reading the first method below. There are invaluable insights I learned by working with an expert that can be helpful when planning and performing a load test should you choose to tackle this on your own. Remember also to proceed with caution regardless of the method you choose, especially if performing the load test on a production site or on a staging site that’s hosted on the same server as the production site.
Hire Someone Who Specializes in Load Testing
In preparation for this article, I was approaching load testing from the same vantage point as most of you. That’s to say that I had never performed a load test before and had no idea where to start, how much load I needed to test, or how to interpret the results. It didn’t take me long to realize I would probably be better served by hiring someone who did. I decided this would be a perfect task for Fiverr, the platform designed specifically for one-off tasks such as this. That’s where I found Mariam.
Mariam is a quality engineer tester that specializes in load and performance testing for banks and telecoms. For about $50 she can perform load testing on your site with 1,000 users (more users are possible) and deliver a basic overview of the results along with detailed results in the form of tables, charts and graphs. She can also help you interpret the results and let you know if any action needs to be taken. Here is a link to Mariam’s load testing “gig” on fiverr. Mariam has agreed to offer DiviPlugins.com users a 20% discount if you mention “DiviPlugins20” when you contact her. Thanks Mariam!
* The above link is NOT an affiliate link. I will receive zero commission from any work you have Mariam perform. I simply wanted to share a great resource for load testing that could potentially save you HOURS of work. I’m sure there are others who can perform a load test for you and do a great job. I chose Mariam based on her five-star reviews on Fiverr and how well she answered my questions.
Mariam performed three load tests for me:
- 5,000 users on diviplugins.com on current SiteGround cloud server (VIEW RESULTS)
- 5,000 users on a staging version of diviplugins.com on previous VPS server (VIEW RESULTS)
- 200 users download a free plugin and create an account on a staging version of diviplugins.com on SiteGround’s staging platform (VIEW RESULTS)
Click on the VIEW RESULTS link at the end of each test above to see the results. These are the deliverables Mariam provided for each test and you can expect if you choose to hire her to perform your load tests.
Keep in mind Mariam does not have access to the server that hosts the website she’s running the test on. The data she provides will be one half of the entire picture. For the other half, you’ll need to log into your hosting account which should provide historical data for your server’s performance. You may need to contact your host for specific instructions on accessing this data.
Below are the results of the first test above – 5,000 users on diviplugins.com on SiteGround’s cloud server.
I am on Siteground’s entry-level cloud hosting plan which provides 4 CPU cores and 8GB of memory. As you can see in the screenshot above, during the peak of the test my server still only used 1 of 4 CPU cores and about 5GB of the available 8GB of memory. I was happy the server performed as well as it did, but slightly disappointed I didn’t get to see the autoscale feature in action.
Autoscale allows the cloud server to dynamically increase resources on the fly as demand increases. Each additional core and each additional gigabyte of memory costs $10. For example, if my server had reached 6 GB of memory during the load test (75% of available RAM), autoscale would have kicked in and provided an additional 2GB for $20 (RAM is increased in 2GB chunks). My server would then have 10 GB of available memory for the remainder of the month. At the beginning of the following month, it would reset back to 8GB.
You can also set a limit on how much of each resource you’re willing to add. You can see in the screenshot below, I currently have my max CPU set to 8 Cores and my max memory set to 12 GB. If my server were to reach these thresholds, I would be charged an additional $80 for the month ($40 for 4 additional CPUs and $40 for 4GB additional RAM). If my server were to pass these thresholds, it would crash rather than continue to autoscale.
My VPS server resources are similar to Siteground’s – 6 CPU cores and 6GB of memory. Unfortunately that host does not offer the same monitoring tools as Siteground. I was originally going to SSH into this server and monitor the test live, but SSH wasn’t working right. After several hours working with support to enable my IP on the server’s firewall and troubleshooting my SSH key not authenticating, I remembered part of the reason I moved away from this host to begin with.
However, we still have the results provided by Mariam and based on those it seems the two performed very similar. The VPS was 15% slower on response times and had double the error rate.
Below are a few lessons learned from my first load test and questions Mariam helped me answer. Hopefully these will help point you in the right direction with your initial test.
How many users should I load test with? This is a gross oversimplified answer to this question, but basically you want to do your best to estimate the maximum number of visitors you would expect to have on your site during a traffic spike. I based mine on the number of subscribers to our email list. Taking into account that only a small percentage of email subscribers will actually make it to the website and that I would stagger the email to minimize the spike, I landed on a value of about 1,000 visitors at one time or less.
This is likely overestimated by quite a bit, but I wanted to plan for future growth. I also wanted to push my cloud server to its limits. SiteGrounds cloud servers are capable of increasing server resources on the fly and I wanted to see this in action. For this reason I had Mariam test 5,000 users within a 30 minute time frame. I also had her perform the same test on my old VPS hosting account which I still had just for comparison.
What actions will these users perform? Mariam uses a program called Jmeter to perform her load test. This program is capable of more than just simulating visitors to your website. It can also simulate complex actions that your users might perform while they’re visiting your site. For one of our tests, I asked Mariam to run a script within Jmeter to simulate visitors landing on a free plugin page, clicking on the download button, and going through the checkout process. Here is a screenshot of what that looks like in Jmeter.
I did this partly because I wanted to see how skilled she was at her craft (she didn’t disappoint) and to see what was possible with Jmeter. Ideally I would have had her perform this script on the live site to see how the server handled resource-intensive tasks like this vs simply visiting a page on the website. Instead I had her run the script on a staging version of the site in case things didn’t go quite as planned. Not to mention I didn’t want to have to deal with deleting all of the users and records created from the script. That brings us to the downfalls of staging sites.
Why is a staging site not always a great option when load testing? If your host offers a one-click staging site creation solution like SiteGround, most likely that staging site does NOT have access to the same resources as the live website. This makes sense because the purpose of a staging site is generally to test updates and changes, not test your server’s resource limits. But it’s not helpful if you’re trying to test the full capacity of your server’s limits.
To get around this, you could always copy your live or production site to a subdomain instead of using the one-click staging solution. You’ll just need to use caution here and make sure the staging site is completely detached from the production site.
Use a Service to Perform Load Testing
There are a few services available that automate load testing for you, the most popular being loader.io. You only have two options with this service:
- Free Plan – limited to testing 1 domain and limits each test to a maximum of 1 minute up to 10,000 users
- Pro plan – $100/month for unlimited tests and limits each test to a maximum of 10 mins up to 100,000 users
Since Loader.io does not have access to your server, you’ll be limited to the results they provide. You could log into your hosting account to view your server in real time while the test runs. But with the test limited to 1 minute, it might be difficult to determine whether any server resources were reaching their limits. At the very least you can review the response times and response counts. If response times are too high or there are too many failed response counts, this could indicate an issue. Below is a test I ran on diviplugins.com with 100 users.
As you can see, the test itself and the results are extremely basic compared to what an expert like Mariam can provide. However, I can see how the service could be useful for performing a scratch test. Basically to scratch the surface to see if there are any issues. If yes, maybe it’s time to hire a professional to perform a more thorough test.
Perform Your Own Load Test
The last option for load testing your site is to learn the tools used by experts and perform the tests yourself. Unless you are wanting to learn this skill so you can offer it as a service, I can’t say I would recommend this option. For a task that rarely needs to be performed, it’s just not worth your time. If you want to run a simple test, use the free plan on loader.io. If you want a more thorough test, hire someone who already has this skill.
With that said, Jmeter seems to be the most popular tool for load testing. This is the program used by Mariam to perform the load tests on my sites. If you’re interested in learning how to run this free, open-source tool you can check out this Jmeter tutorial video for beginners.
K6 is another free, open-source tool you can use to perform load testing. If you’re interested in this tool, check out this video for a k6 tutorial.
Optimizing After Load Testing
If your load test results are poor or if you’re seeing 503 or similar errors on your site, you’ll need to optimize your website, upgrade to a high performance plan, or change hosting.
Before you look at hosting, you should focus on optimizing your site. WordPress is a great platform to build your website on. But it can consume a lot of your server’s resources if not properly optimized. It pulls a lot of data from a lot of different places (database, theme files, plugin files, etc.) Without a simple caching plugin for example, WordPress will likely process dozens of database queries and PHP functions PER PAGE LOAD. This is completely unnecessary and easily avoided.
Anything you can do to minimize the amount of server resources required for each visitor will improve site performance. You should run down the usual site optimization checklist: upload images smaller than 250kb when possible and optimize them using TinyPNG, use a caching plugin like WP Super Cache, use a CDN like CloudFlare, keep active plugins to a minimum, etc.
If optimizing doesn’t help, it may be time to change your hosting. I would highly recommend a cloud server hosting plan if you can afford it and can’t afford for your site to crash. They’re more expensive than shared or VPS hosting, but the ability to increase server resources dynamically based on demand is a game changer.
I think the best option for me is to hire an expert on this, as mentioned in this post. I have tried cloudflare cdn to optimize web speed load, and changed to a VPS server based service ( SpinupWP). At first, I might give a test to loader.io service although as well. Thank you ver much for this useful post !