« Anterior -
Versión 10/11
(diff) -
Siguiente » -
Versión actual
Emilio Penna, Lunes, 10 de Marzo de 2025 15:15:47 -0300
Load tests in moodle 4.1.16 (update 2025)¶
Files for load tests¶
Attached to this page are the following files:
- Moodle quiz backup
- Test users file, for enrollment in the test course
- Jmeter script for load test (jmx)
Setting up the test data¶
- Create a new course for the quiz, or use a existing one or a generated one (for example TestCourse S)
- Restore the quiz backup file (mbz)
- Upload test users (with enrolment to the new course)
The file perftestusers5000.csv contains 5k users. The csv file has a column that indicates the shortname of the course to enrol the users, edit the file and adjust the name of the course. Then upload the users via site administration, users, accounts, upload users. In the form set "force password change": none.
Configuration of the jmeter script¶
(The script was tested with jmeter 5.5 and moodle 4.1)
The script uses plugins, so the plugins-manager.jar is required. It can be downloaded from https://jmeter-plugins.org/install/Install/ and put in the lib/ext directory of jmeter (jmeter restart required).
After opening the script (jmx file) adjust the settings:
- In "Test plan", you have to configure the course id, quiz id and server host name. You can also adjust the waiting time of the virtual user (twait), that is, the time that the user waits "thinking"in each page.
- In "CSV Data Set Config" you have to set the path and name of the users file (perftestusers5000.csv)
- In "Thread Group" the threads number and ramp up time can be specified. Start with only 1 thread until the test run with no errors, then try more threads, in an incremental way. In our tests, we used, up 3000 threads with a 180 seconds ramp up.
Tips for running the tests:¶
- We ran the script with a maximum of 1500 threads per client (generator). If more is used, is probable that errors appear but they are because the client cant support that load, in that case, you can run more than one client at the same time, or use the jmeter capabilities to do a distributed load test.
Running from command line:
$ ./jmeter -n -t /home/user/moo4quiz-2.jmx -l /home/user/jmeterout.jtl
- It is possible that if a test fails before finishing, the attemps will remain "in progress", and if you try to start another attempt with the same user, it will cause an error.
One solution is to mark as "finished" all the attemps: update mdl_quiz_attempts set state='finished' where quiz=xxx;