I hope, you have your environment ready, now you want to put a load to Test it.
We will be utilizing, Apache Jmeter tool for this. Basic knowledge of Jmeter will be required.
Moodle comes with a built-in support for Jmeter Load test script.
For Advanced User
here is the Moodle git repository link, contains useful scripts to setup / test / compares the whole site performance
Following are the steps.
If you want to test a course page, then you must have the course. and when you are putting the load with users , you must have created the account of the users. and they should be enrolled in the course.
This part can be done manually or dynamically
Plan-1 – Quick Start
” In this, you can download the attached material to create and run. The request flow will be : login > course view > logout “
- Create a course and use the shortname “m1” while creating the course. Make sure manual enrolment plugin is enabled . Note down the course id from url.
- Go to Site Administration > Users > upload Users and upload the file course_user.csv , present in download zip. this will create users and enroll them into this “m1” course. This csv contain 100 users.
- Load the test_plan.jmx file in Jmeter.
- Put the user_credential.csv in the home folder for jmeter.
- Change the variable values with your in Jmeter
Use Moodle functionality to create the course for you, and create the enhanced Jmeter Load Plan for you for that particular course.
- put this code in config.php
$CFG->tool_generator_users_password = 'any123' ; // this will be the password for the users created in next command
- go to location <moodlecodebase>admin/tool/generator/cli & run the following command
php maketestcourse.php --shortname="loadtest1" --fullname="loadtest1" --size="XS"
This will create a course in moodle with name as loadtest1.
- XS : 1 Users
- S : 30 users
- M : 100 Users
- L : 1000 Users
- XL : 5000 Users
- XXL : 10000 Users
This will automatically create the course , with activities with test users and enrolled them in this course.
- Now , go to “Site Administration > Development > Make Jmeter Test Plan”
- Select the Plan with size
- Select the Course “loadtest1”
- Jmeter Plan file and User Credential CSV file will get download
“Now, You have the Jmeter load test plan, You have the Course users list, and you know the password. Load the Test plan and Credential File in Jmeter. and You are ready to put the load.”