Load testing WordPress Sites
Posted by Oleg Prosyanik
Today we'll take a look at how BlazeMeter helps us to test our service and find bottlenecks in a hardware server configuration.
As an example, we'll use our demo blog which runs under the CMS WordPress. It's a sample blog with some blog posts and several information pages. Of course, real world sites have much more material; content, images, links, etc., than our blog, but this configuration will be quite enough for our demonstrative test described below. So, let’s start the test performance of our site!
The Creation of the Load Script
First, we need to develop a test script. For this purposes we need the Apache JMeter tool. Our test plan will consist of key actions which will be performed by users of the blog:
• reading blog posts.
• viewing general site information pages.
• searching for material of interest.
While writing the script, we do not need to forget about realism of simulated process. Key steps should better match the reality, so that we could accurately estimate the performance of our website.
So, our test plan describes blog readers. Users performs key actions with actual amount of time required for reading materials, searching posts, opening web pages.
After we created our script using Jmeter, let's turn to the launch of the test using BlazeMeter service!
The Creation of the Load Test
BlazeMeter is 100% compatible with Apache JMeter. So, it will not be a problem to configure the launch of our test on the service. BlazeMeter has a super simple configuration process, and provides great capabilities for service users.
First, let’s name our load test. It will be shown in the list of our tests at the main profile page. Then we need to select load origin location.
To run our test we need to upload the script file and other required files. Then, set up basic settings for our test as it is shown in the image above.
For the first test run we set 300 concurrent blog readers (aka users) and set ramp up period to prevent a sharp increase in server load. Even though the duration of our test is 100 minutes, it will be enough to obtain the server performance.
BlazeMeter also allows us to fine-tune the tests with.....
• setting scheduled test running
• JMeter console line arguments
• JTL properties
• hosts override and others
One of the additional options is the opportunity to connect the New Relic account to monitor performance and pinpoint any bottlenecks during the load test. New Relic is an app performance monitoring service that provides a drill down of:
• performance analytics
• real user monitoring
• server monitoring
• SQL/NoSQL performance monitoring
• Web-application transaction tracing, alert notifications and many other features
We specify our API key and configure metrics parameters in the New Relic connection settings.
After configuring all settings, we can run the test and analyze the obtained results which will be provided by BlazeMeter.
Analysis of the First Test Run of the WordPress blog
Now we can analyze results and make conclusions about the performance of our website.
Note that we can see that we have not gotten any errors during the test run. This proves the stability of our website for the moment.
If we had received errors, BlazeMeter would provide the special errors log which displays all errors during the test run, and would also show every problematic element separately.
There are displayed the number of requests of each webpage, percent of errors and other helpful information in the Aggregate Report table.
To view the server status we use the New Relic service. This service will help us to see graphically the basic server parameters. As it is shown in the image above, our website can serve nearly 300 concurrent users (this is the number of virtual users we had set in the load test configuration). The coming of new blog readers to our website will lead to 100% CPU load and our service will become unstable. To increase the stability of the site and be prepared to increase of the site traffic, we need to improve the obtained results.
For these reasons let’s configure our WordPress website and improve the performance of our server.
At first, we need to configure CMS. All unused WordPress modules must be turned off, and all necessary should be optimized for better performance. Non-optimized modules cause big problems for the site performance. They use extra system resources and slow down our server.
Then, we need to think about server hardware. Current configuration is not enough, the server is not ready for the increase of using resources. So, let’s improve its performance by using better hardware.
After this we should run our load test again and compare both results.
Analysis of the Second Test Run of the WordPress blog
After second test run we have got new results and now can analyze them. BlazeMeter provides with the ability to view statistics not only for all test, but for each request described in our JMeter script. It helps us to understand which pages (requests) make problems at our site, which pages cause errors (for example, page may contain an embedded image, which is not available now), which pages loads slowly, etc.
To view results graphs for each request separately we just select required script element located above the graph. Buttons on the sides of the graph provide opportunity to switch statistics graphs and compare indicators in which we are interested.
When our load test had run more than one time, BlazeMeter provides an easy way to compare results and make decision about changes we had made. To compare results we need to select previous result for comparing from the drop-down list located in upper right corner of the page.
Previous results are drawn with the thinner line than the results of the current test. At the image we can see that after the performance improvement, the response time decreased by nearly 30 percent.
As you see, we had upgraded server’s hardware, and now server load is not too high as during the first test run. The coming of more blog visitors will not affect the quality of our service.
As a result, we had done next changes on our server:
• increased the amount of RAM from 1.5 to 3.0 GB
• added 2 CPU cores
• disabled unused services
• disabled unused WordPress modules and configured necessary of them
Summary of Load Testing a WordPress blog with BlazeMeter
In this report we had a look on the one of the major problems that might overtake your growing web service. Monitoring service performance and timely detection of potential problems is not a simple task. BlazeMeter has helped us simulate easily and quickly the activity on the site and to predict our future real problems. Also, we were able to check whether our service had any errors. The manual check of the site with the purpose to find them is very difficult, especially when our site is a big portal, and we must identify problems in the shortest possible time.