Sunday, March 22, 2015

Wordpress load testing framework

Following my last two posts, about how to create realistic load tests and Wordpress performance I guess that the next post is just on time.

In the last post I've shared that we build up a new Wordpress platform and we continuously load test and improve its performance. In this post I'll share the resources and the concepts behind how we do that, while I hope some people will find it useful and will contribute back to improve it.

I have created a public github repository under https://github.com/jmeter-templates/wordpress about a week ago. In this repo there are all required resources for load testing a Wordpress site.



It is basically focused on the features we use on our own website, such as high rate of authenticated users, viewing blog posts (including AJAX calls interacting with the WP popular posts plugin for view counts and with Shariff for social figures), searching content, publishing new posts, posting comments, liking and unliking posts and comments (interacting with Like posts and comments plugin) and consuming RSS feeds. Anyone can extend this skeleton to have more features covered with his load tests, to reflect the relevant realistic scenario or usecase.

One of the most important parts of the JMeter script here is that it is modular. Each piece of interaction with a feature, is broken into a separate JMeter script, which is then loaded by the load test script and placed on the right place in the user flow. This allows each module to be changed while being focused only on a specific feature and allow re-usability of that module also on the single user script - which is used for base-lining performance or just as functional test.

Other resources in this repository are few drop-in plugins for Wordpress to allow:

  1. User impersonation - in case you don't want to create test users or just because you don't want to have all users passwords in a plain text file.
  2. Data export - which you can access with the third JMeter script in this repo - to extract all required objects to interact with during the performance test, such as existing users, blogs, posts, comments and tags.
The idea is that these tests should become part of your continuous integration flow and get you with up-to-date performance figures.

One of the most popular approaches is that for tests you should have an isolated "playground" - a predefined dataset where the test is running against, which is maintained (usually this is done automactically) to have predefined users and data to test with your automation and is deleted or recovered back to the same state as before the test was running, right after each test is finished.
While this concept may work for Functional testing, I think this is a wrong approach for load testing, as you either over-populate or over-interact with specific set of items in the application - thus over time they are getting overloaded and change the test results. You may clean them up with every load test, but you loose any natural / realistic growth of data in your load testing environment that way.

The right approach in my opinion is that your load tests should generate close to realistic workloads on the system, thus, they should provide at least the realistic growth and distribution of data along the way, so once you hit a bottleneck - you'll see it on your testing system before you'll get it on the real system. This is why this framework doesn't provide any mechanism for pre-populate the target Wordpress system with any dummy content. It will create it along the way, as you continuously load test the system. This framework should be agile enough to use anything you already have in the system to continue producing realistic load tests.

A final note is that I hope this github organization will become home to other load testing setups for popular frameworks, such as drupal, django, joomla and others.

7 comments:

  1. Thanks for sharing such informative article on Loadrunner Automation testing tool. This load testing tool will provide most precise information about the quality of software. Loadrunner training in Chennai| Loadrunner training

    ReplyDelete
  2. I am having some problem running the scripts provided and thought that it might have something to do with https access, which I currently don't have setup. Is this needed?

    ReplyDelete
    Replies
    1. Hi
      Can you share more details of the issue?
      Basically you can change the config in the properties file.

      Delete
  3. Thanks for these scripts, they're great! Unfortunately in my environment I am seeing the scripts are loading the web front end but I am seeing very little database activity. On investigating I noticed that despite using the export script with the 'data-export-csv.php' I am seeing wrong password errors in Wordpress when running the test. The export.jmx script is reporting as successful when run but does not appear to be extracting what it needs, is there a way to verify this has completed successfully?

    ReplyDelete
    Replies
    1. Can you share more about the issue you see?

      Delete
  4. Hello Thanks for this template but is it possible to give more explanation on how to use it. I try with the small info you gave on github but it fail short.
    I run the data_export-csv.php with the export.jmx, it's seeem to extract something but when i run the single user test it's not working i get numerous error on the anonymous testing and withn the authentificate user i get 100% error.

    Can you help me on this one ?

    Best regards,

    Stephane Laurencelle

    ReplyDelete
  5. Sure just send me more details as a github issue or via email: shmulikk@gmail.com

    ReplyDelete