spacer

How to load test your Moodle server using Loadstorm

spacer

Note: this post is part of the Oktobertest series

Using this step by step ‘how-to’, you will be able to test how well your Moodle installation would be able to cope with a certain amount of users, using the loadstorm.com service. Whilst this is not a perfect representation of what real life usage of your Moodle installation would be like, it will still give you a very good idea of whether your system is good enough to run Moodle for your expected number of users.

Loadstorm is a web based load testing service. Their business is to simulate multiple virtual users simultaneously navigating a website, following a scenario that you pre-recorded using the loadstorm point and click interface.

This tutorial will show you how to test your Moodle installation with 25 simultaneous users, as you get 25 lifetime free virtual users with loadstorm. It also turns out to be the maximum number of students I have in my classes. If you would like to test with more users, you would need to purchase extra virtual users. I have found the service to be very good value and the support top-notch.

Warning – This tutorial is for Moodle 1.9 but the steps for Moodle 2.x are virtually the same.

 

Before starting this tutorial, you should download the following files:

  • Load testing course for Moodle 1.9, Moodle 2.1, Moodle 2.2, Moodle 2.3
  • mdl_users.csv file to allow to create dummy Moodle users quickly
  • loadstorm.csv file so that your dummy users can login to Moodle through the loadstorm interface, and also post forum and blog messages

 

Step 1: Upload test users to Moodle

 

spacer
 
  • Note: You must be logged in as an administrator
  • Site Administration > Users > Accounts > Upload users
 
spacer
 
  1. Choose file > Select file > Select the mdl_users CSV file you downloaded prior to starting this tutorial
  2. Do not change any of the default values
  3. Click on ‘Upload users’
 
spacer
 
  1. Check that the data has been uploaded correctly
  2. Do not change any of the defaults
  3. Click ‘Upload users’
 
spacer
 
  • You will get a report of all users that have been created. Click ‘Continue’
  • Note: Don’t forget to enroll those newly created users into the course you want to use for loadtesting.
 
 

Step 2: Upload loadstorm.csv file to your loadstorm account

 

spacer
 
  • Go to app.loadstorm.com/home
  • Click on the ‘Build Tab’
 
spacer
 
  • Scroll down to the bottom of the page ‘Form Data Sets’
  • Click on ‘Upload data’
 
spacer
 
  1. Enter ‘Moodle users’ in the ‘Label’ box
  2. Click ‘Choose’ – Go and select the ‘loadstorm.csv’ file you downloaded prior to starting this tutorial
  3. Click ‘Upload’
 
spacer
 
  • Your file is now ready to be used
 
 

Step 3: Build a load test plan

 

spacer
 
  • In the ‘Build’ tab, click on ‘Add plan’
  • A ‘plan’ is a collection of ‘scenarios’ in loadstorm. More on this in the steps below
 
spacer
 
  1. Use a name that you can easily understand, as you might use many plans in loadstorm
  2. Again, your description should be as detailed as possible
  3. Click ‘Save’ when you’re happy with your form

Note: You can always edit the name & description of your plan

 
 

Step 4: add a scenario to your plan

 

spacer
 

A ‘plan’ is a collection of ‘scenarios’. A ‘scenario’ is a series of steps that a virtual user will follow on Moodle. For example, you could have one scenario where a user logs in, looks at the homepage and then logs out (scenario 1); Another scenario could be a user logs in, visits a course, answer a quiz and then logs out (scenario 2). The more scenarios you have in a plan, the more realistic your load testing will be. You can then assign a weight for each scenario so that it further ressembles how Moodle is actually used in your organisation. For example, one could argue that scenario 1 mentioned above would take place a lot more often than scenario 2. You could set a weight of 90 to scenario 1 and 10 to scenario 2 to reflect that.

For the sake of simplicity, we will only create 2 scenarios in this tutorial.

Scenario 1 with a weight of 40:

  • User looks at the homepage
  • Logs in
  • Downloads a 500KB resource
  • Logs out

Scenario 2 with a weight of 60:

  • User looks at the homepage
  • Logs in
  • Downloads a 500KB resource
  • Views a forum
  • Answers a forum post
  • Posts a blog post
  • Logs out

Click ‘Add Scenario’

 
spacer
 

1 & 2. Be as descriptive as possible
3. Assign the weighting you have decided to allocate
4 & 5. This is the minimum/maximum amount of time a virtual user would wait between steps (or ‘clicks’ in the real world). The actual time will be picked randomly by loadstorm for every step and every virtual user, between your chosen minimum and maximum values. If you want to put maximum strain on your server, you should try and keep those values as low as possible.
6. Make sure the correct CSV file is selected
7. Leave both boxes ticked so that your test is as close to real life as possible
8. Click ‘Save’

 
spacer
 
  • Check that all the options are correct and click ‘Add step’
 
 

Scenario 1, action 1: Visit the homepage

 

spacer
 

Warning: If this is your first time using loadstorm you will need to verify your server using the ‘Add a new server’ link. As I have used it before I cannot show you how to do that but there is a good tutorial at loadstorm.com/load-test-servers

  1. Leave this as ‘/‘ if your moodle is accessible via an address such as www.mymoodle.com. My Moodle installation is accessible at www.vleteacher.com/version19 hence the need for me to add ‘/version19′
  2. Select the correct server. Please see the warning note above if it is the first time you are using loadstorm
  3. Click ‘Save’

 

 
spacer
 
  • Loadstorm will open the page so that you can check the step was performed correctly
  • Click ‘New step’
 
 

Scenario 1, action 2: Login to Moodle

 

spacer
 
  1. The ‘Login’ page of Moodle is located at yourmoodleserver.com/login/index.php. Fill in the correct information for your server
  2. Click ‘Save’
  • Click ‘New step’ when the preview shows up
 
spacer
 
  • You will now need to tell virtual users what usernames and passwords to use to login. 
  • Check that your values match the ones circled in red above
  • Click ‘Save
 
spacer
 
 
 

Scenario 1, action 3: Visit the Load Testing course

 

spacer
 
  1. Select ‘Click a link’
  2. Look for and select ‘Load testing course’ (or whatever else course you want the virtual user to access)
  3. Click ‘Save’
 
spacer
 
  • Check that the step has been successfully created and click ‘New step’
 
 

Scenario 1, action 4: View a 500KB image

 

spacer
 
  • Select ‘Click a link’ and then scroll down to the correct resource
  • Click ‘Save’
 
spacer
 
  • Check that the step was successfully created and click ‘New step’
 
 

Scenario 1, action 5: Logout

 

spacer
 
  1. Select the ‘Click a link’ option
  2. Select the ‘Logout’ link
  3. Click ‘Save’
 
spacer
 
  • Check that the step was successfully created and click on the name of your plan (or the ‘build’ tab).
  • Well done, your first scenario has now been created.
 
 

Step 5: Add scenario 2

 

spacer
 
 
spacer
 
  • As for scenario 1, make sure you are as descriptive as possible. Note that I have added a weight of 60 to this scenario. Scenario 1 has a weight of 40, therefore the weight of both scenarios equates to 100.
 
spacer
 
  • Check that the details are correct and click ‘Add step’
  • Note: We could have copied scenario 1 and edited it, but as this is a tutorial aimed at very beginners, repetition of steps is a good way to learn.
 
 

Scenario 2, action 1: Visit homepage

 

spacer
 
  1. Leave this as ‘/’ if your moodle is accessible via an address such as ‘www.mymoodle.com
  2. Select the correct server. Please see the warning note above if it is the first time you are using loadstorm
  3. Click ‘Save’
  • Note: After each new step you have created, you will receive a message telling you that the step was created successfully. To keep this tutorial as succinct as possible, I have removed those screenshots for scenario 2. Simply click on ‘New step’ whenever that screen shows up
 
 

Scenario 2, action 2: Login to Moodle

 

spacer
 
 
spacer
 
  • Make sure your options are similar to the ones shown in the image above
 
 

Scenario 2, action 3: Visit the Load Testing course

 

spacer
 
  1. Select ‘Click a link’
  2. Look for and select ‘Load testing course’ (or whatever else course you want the virtual user to access)
  3. Click ‘Save’
 
spacer
 
  • Click a link > Choose the right file > Click ‘Save’
 
 

Scenario 2, action 4: Return to course homepage

 

spacer
 
 
 

Scenario 2, action 5: View a forum

 

spacer
 
  • Click a link > Look for ‘Forum – Standard’ > Click ‘Save’
 
 

Scenario 2, action 6: Post a forum message

 

spacer
  • Make sure your details are the same as above
 
spacer
 
  • Make sure your details are the same as above
 
 

Scenario 2, action 7: Return to course homepage

 

spacer
 
  • The previous step will have returned a message that prevents you from clicking on any links so you’ll have to copy your course URL. The URL to a course is always something like www.yourmoodle.com/course/view.php?id=somenumber
  • Simply change ‘somenumber’ to the correct number for your course. Look in your browser address bar to find out what your course ID number.
 
 

Scenario 2, action 8: add a blog post

 

spacer
 
  • Click a link > Look for ‘Add a new entry’ > Click ‘Save’
  • Note: you must have the ‘Blog’ block on your course page for that link to show up.
 
spacer
 
  • Copy the details as above
 
 

Scenario 2, action 9: Logout

 

spacer
 
  • Click a link > Find ‘Logout’ > Click ‘Save’
 
 

Step 6: Add a new load test

 

spacer
 
  1. Click on the ‘Build’ tab
  2. When you have checked that the steps are correct, click ‘Add scenario’
 
spacer
 
  1. Ensure the right plan is selected
  2. Schedule when your test should be run, or simply tick ‘Start load test as soon as possible’
  3. Be as detailed as possible in your description
  4. These settings are self-explanatory. To replicate real classroom use, I like to use the same figure for ‘Start users’ and ‘Peak users’
  5. Click ‘Save’
 
 

Step 7: Understand the results

 

spacer
 

Both graphs show the progression for the entire duration of the test. The example test we ran was 30 minutes long, and this is represented on the X axis.

Graph 1:

  • Throughput: amount of kilobytes per second transferred between your server and the virtual users. Please note that it is bytes, and not bits. This is important as your web hosting company will probably will mention their network throughput in bits, not in bytes. If you would like to convert the throughput shown in this graph against your theoretical server throuput, you would have to multiply the peak number by 8. In this example, the peak throughput was 650KBps or 5200Kbps – which translates as 5.2Mbps.
  • User load: The amount of virtual users completing the scenarios at any given time. Note that there is no scale for this data so you have to over your mouse on the graph to find out the exact data. Our example test started with 15 users and finished with 25 users in increments of 1.
  • Requests per seconds: depending on how you setup your scenarios, virtual users will wait for a random period of time between each ‘click’ (or step). As the time they wait is random, the graph is an easy way to find out how many requests per second your server received during the test. The shorter the wait between steps, the more requests per seconds your server would receive.

Graph 2:

  • Response time, average: shows how long it takes for your server to respond to the request. As far as I understand it, this metric does not reflect how long it takes for a page to fully load.
  • Response time, peak: it won’t always take the same amount of time for your server to respond to requests.
  • Error rate: if a page is not accessible for whatever reason, loadstorm would record it as an error. In this example, there were no errors. Errors should be taken very seriously as a healthy server should never return any errors. Errors could be returned if the server is overloaded. You should download the CSV file for detailed results (see below) and also look at your webserver error logs to find out more.

Note: Click on ‘Click here for details…’ link to get access to useful reports

 
 

Step 8: Dig further

 

spacer
 
  1. When looking at a specific report, you can click on ‘Download as CSV’ – This will show you results for every individual requests
 
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.