Load testing your wordpress blog performance with JMeter and Woopra for Free


It is becoming a must to build a nice shiny blog for events, conferences, etc – those blogs act as the backbone of the social media campaign and as the aggregator of content being shared through the day.

This type of blogs usually have traffic peaks happening mostly during limited hours, so If you want to avoid users bitching about your site being down just when they need it – you need to be prepared by doing something called: Load Testing

Load testing is the process of putting demand on a system or device and measuring its response. It is performed to determine a system’s behavior under both normal and anticipated peak load conditions.
It helps to identify the maximum operating capacity of an application as well as any bottlenecks and determine which element is causing degradation.

So by performing load testing, you will be able to perform necessary tweaks to improve performance or purchase more processing capacity to match your number of visitor expectations.

By using woopra.com, you can live monitor the number of visitors and their activity on your site and use your previous load testing statistics to predict and avoid the bottlenecks by shifting user attention, shifting content or activating optimization techniques like loading a light weight theme or only part of your content.

Woopra offers a free version on woopra.com – it is pretty straight forward and intuitive to set up an account and start live monitoring your users (and even live chatting with them) – so i won’t go over the details here, if you are facing any problems, I am sure the guys from @woopra can help.

Performing the load test:
I previously wrote a blogpost on Load testing where I introduced the most 2 famous tools to use: HP Loadrunner (commercial) and JMeter (Free open source)

You can read the full post here : http://mireille.it/load-testing-with-jmeter/

Since then JMeter became my favorite tool – it is free/open source and really nice when you get the hang of it

You can grab your free copy from here . The thing is 5.3 MB only.

Windows
Browse to your newly downloaded folder, go to bin and double click jmeter.bat

Linux distro / OSX
If you are on some linux distro or osX you have a jmeter.sh file . Browse to your newly downloaded folder, open it in your favorite editor – there is one line that says :

java $JVM_ARGS -Dapple.laf.useScreenMenuBar=true -jar `dirname $0`/Applications/jakarta-jmeter-2.3.4/bin/ApacheJMeter.jar “$@”

All you need to do is make sure to point the dirname to your correct download location

After that you launch it in your terminal and JMeter java GUI will come to show.

Creating Thread Group


Right click on Test Plan , click add >>> Thread group

Thread group elements are the beginning points of any test plan. All controllers and samplers must be under a thread group.

Now you get to specify the following elements :

Thread name : descriptive field – we will name it “Thread group_testing wordpress”

Comments : descriptive field

  • Action taken after sampler error :
    • Continue
    • Stop thread
    • Stop test
    • Stop test now
  • Number of threads users u are emulating ( how many users visiting ur site u want )
  • Ramp up period ( the time JMeter takes to generate all the threads – if you have 10 threads and ramp up period of 100 secs – JMeter will start a thread each 100/10 = 10 secs. after 100 secs, all your threads will be booted )
  • Loop Count : How many times you want to repeat your test – you have the forever option or a number u can enter

After specifying the parameters for your thread group “testing wordpress”, time to emulate your first http request.

Creating HTTP Request

Right click on “testing wordperss” thread group >>> add >>> sampler >>> HTTP Request
( as you can see there are tons of other requests you can add like FTP , SMTP, JDBC – aka you can emulate people asking for file transfer, mail, db connections ! neat – but won’t be covered in this tutorial )

 

After choosing HTTP Request you need to specify the following details :

  • Name/comment of request : anything descriptive
  • Server Name or IP : in my case mireille.it or <insert your blog name>
  • Path : / in case u were planning on testing the root or any relative page link
  • Port Number : 80 (default port for browsing)
  • Method : get -  post – head – put – options – trace – delete – you will need to choose “GET”

You can add as many HTTP Request as you want – like this you can emulate the user visiting many pages in some special order – you can also emulate the user viewing a video for example by adding an HTTP request to yourwebsite.com/video.flv for example.

An interesting thing is that you can add a delay between the different actions – so if you added

HTTP Request 1 : index page

HTTP Request 2 : About us

HTTP Request 3 : watch video

You can add a time delay between each action to emulate the user actually spending time on the page.

Another Interesting thing you can do is that you can emulate users logging in for example or sending any kind of parameters like searches – all you have to do is add parameters to your requests.

Right click on your Thread Group >> Add >> Sampler >> HTTP Request

In path you can add the path to your login/protected page

In Parameters – you can add as many parameters as you want – it works on all kind of forms – all you have to do is know the “name” of the field being submitted – which largely depends on your blog.

In wordpress, the username field is called “username” – password field is called “password” – if you are testing out a contact form, you need to see the name you created in the plugin and so on.

Here is an example i filled out

as you can read on – it is pretty easy to fill out – now you need to know if the form is actually submitting and if the request is being carried on.

You need to create an Assertion that allow the ability to assert facts about responses received from the server being tested. Using an assertion, you can essentially “test” that your application is returning the results you expect it to.

In this case we “Assert” if the reply sent back from the server is “successful login” – Here is a sample assertion I created

Right click on the specific request you want to assert >> Add >> Assertions >> Response assertion – you will be greeted by the  following screen

The returned page is supposed to have the word “success” – which in this test i know it does.

You still need to view statistics about your assertions – so you right click on your HTTP Request >> Add >> Listener >> Assertion results- you only have to name it and make sure to check “Log errors only” – uncheck “Log successes”.

Depending on what you check, you will get a simple log of the errors or the successful logins.

Here is an example of a logged error

When i ran the test – i told JMeter to expect the word “epic” in reply – which was not the case and the “assertion” was deemed false.

This is basically what you need to do to perform the test, now time to get the data out by adding some reports.

Adding the Reports:

Reports are what it all comes down to and is actually what you will use to build your analysis.

Reports are the “listeners” – you can right click on individual requests or on the whole Thread and add a report to it, some reports are tables, others are graphs, almost all of them can be saved into a file – which comes in very handy.

 

 

 

 

 

 

The next step is to use common sense and simple math the analyze the above data and graphs and deduct your performance benchmark.

The nice thing about JMeter is that once you are done, you can save the scripts for later use and easy modification – all you have to do is replace couple of values and you are set to load test many blogs without re-doing the work or having to re-record screens and steps.

I think that makes it a long enough post – if you need a hand load testing your blog, drop me an email using the contact form, I will be glad to give a hand since this is one of the “services” I can offer as a freelancer.

Read More

Load testing your moodle install with JMeter scripts

In the previous post i introduced 2 solutions that will allow you to load test your website / application. The 2 applications are HP Load Runner and JMeter. You can read a quick intro about load testing, both software and my take / preferences.

As promised, I am dedicating a second post to show example of how to test your moodle install using JMeter. The example will show how to emulate the following steps :

  1. user navigates to site
  2. user logins + testing if login successful
  3. user views some content like FLV video

There are many reason i chose moodle/Jmeter for this post :

  1. I had to choose something
  2. It will be less useful if i show example of load testing on proprietary website that i did – so better show example on how to test some open source package.
  3. Referring to point 2 – from the open source solutions that are interesting to load test, you have wordpress/drupal/moodle. Moodle seemed to me more interesting cuz it is a content heavy system where most data resides behind a login for the students and it needs usually higher resources, so load testing moodle installs is important with all the students logging at the same time to view courses and take quizzes
  4. I was doing load test for moodle install and the contributions under http://cvs.moodle.org/contrib/tools/jmeter/ has only 1 entry . It was bit tricky to find example and resources on the topic ! so i am publishing this to hopefully help the lost souls working with moodle/jmeter
  5. Because I am optimizing my blog for moodle / JMeter and i am so far happy with the reach of keywords that say JMeter, moodle, load testing :). Yes, that is how i digg jobs as freelancer :)

Enough with the blabbery blabbering ,

Read More

Load testing with JMeter and HP Load Runner

After you happily build your website it is important to do some load testing in order to have an accurate idea of the performance under different conditions and to have a road map for your server specs and upgrades. Also you won’t be surprised or shocked when the long-awaited-visitors arrive and you will be able to handle your website traffic .

After some googling, to do decent load testing, it turned out that i have 2 main solutions to use :

  • HP Load runner
  • JMeter

Here is my review and experience with both software :

Read More