Versión 1/11 - Siguiente » - Versión actual
Emilio Penna, Lunes, 10 de Marzo de 2025 13:07:26 -0300


Load tests in moodle 41 (update 2025)

Files for load tests

Attached there 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

1. Create a course for the quiz
Create a new course, or use a existing one or a generated one (for example TestCourse S)

2. Restore the quiz mbz

3. Upload test users (with enrolment to the new course)

The file usuarios_curso.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. Take appropiate care as the file also contains the password of the users.

Configuration of the jmeter script

(The script was tested with jmeter 5.4.1 and moodle 3.8)

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).

The parameters for the test are:

1. In "Configuracion del CSV dataset" you have to set the path and name of the users file (usuarios5000.csv)
2. In "plan de pruebas", you have to configure the course id, quiz id and server url.
3. In "valores por defecto para peticion HTTP" set the server url
servidor

In "grupo de hilos original" 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.

TO DO: The script has "Assertions" for controlling that the server response is what we expect in a successful execution, it works inspecting the html in the response with a pre-defined text. We used, for example "Pagina 1 de 8", a text that appears in the bottom of the quiz pages. This text is in spanish, so it works if the language for the users is spanish. You can change that assertion text, or set lang=es in the mdl_user table, with an

update mdl_user set lang='es' where username like 'prueba%'; 

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/epenna/moodle-quiz3-v1.jmx -l /home/epenna/jmeterout.jtl

perftestusers5000.csv - File for users upload and enrol, and also used in the jmeter script. (547,5 KB) Emilio Penna, Lunes, 10 de Marzo de 2025 13:07:26 -0300

backup-moodle2-activity-1307-quiz1307-20250311-0829-nu.mbz - Quiz backup (578,9 KB) Emilio Penna, Martes, 11 de Marzo de 2025 08:30:13 -0300

moo4quiz-2.jmx - Script jmeter - updated 2025-03-11 15:39 (329,8 KB) Emilio Penna, Martes, 11 de Marzo de 2025 15:40:05 -0300