Load tests in moodle 41 (update 2025)

Versión 8 (Emilio Penna, Lunes, 10 de Marzo de 2025 13:47:48 -0300)

1 2 Emilio Penna
h1. Load tests in moodle 4.1.16 (update 2025)
2 1
3 1
4 1
5 1
h2. Files for load tests
6 1
7 1
Attached there are the following files:
8 1
9 1
10 1
* Moodle quiz backup
11 1
* Test users file, for enrollment in the test course
12 1
* Jmeter script for load test (jmx)
13 1
14 1
15 1
h2. Setting up the test data 
16 1
17 1
18 5 Emilio Penna
#  Create a new course for the quiz, or use a existing one or a generated one (for example TestCourse S)
19 5 Emilio Penna
#  Restore the quiz backup file (mbz) 
20 5 Emilio Penna
#  Upload test users (with enrolment to the new course)
21 1
22 6 Emilio Penna
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. 
23 1
24 1
25 1
h2. Configuration of the jmeter script
26 1
27 1
28 2 Emilio Penna
(The script was tested with jmeter 5.5 and moodle 4.1)
29 1
30 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).
31 4 Emilio Penna
32 1
After opening the script (jmx file) adjust the settings:
33 2 Emilio Penna
34 5 Emilio Penna
# 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. 
35 6 Emilio Penna
# In "CSV Data Set Config" you have to set the path and name of the users file (perftestusers5000.csv)
36 7 Emilio Penna
# 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.
37 1
38 1
39 1
h2. Tips for running the tests:
40 1
41 1
* 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.
42 1
43 1
44 1
Running from command line:
45 1
46 1
<pre>
47 8 Emilio Penna
$ ./jmeter -n -t /home/user/moo4quiz-2.jmx -l /home/user/jmeterout.jtl
48 1
</pre>