Difference between revisions of "JMeter"

Jump to: navigation, search
Line 5: Line 5:
  
 
<hr/ >
 
<hr/ >
The [http://jmeter.apache.org/ Apache JMeter] has always been the most common load testing resp. performance measuring tool in the Moodle community. Since around release 2.5, Moodle makes the process of load testing with JMeter vastly simpler through two built-in scripts, (Site administration > Development >) ""Make test course'''  and (dito >) '''Make JMeter test plan''', augmented by a set of add-ons [https://github.com/moodlehq/moodle-performance-comparison Moodle performance comparison]. This document is about the two built-in scripts and JMeter.
+
The [http://jmeter.apache.org/ Apache JMeter] has always been the most common load testing resp. performance measuring tool in the Moodle community. Since around release 2.5, Moodle makes the process of load testing with JMeter vastly simpler through two built-in scripts, ""Make test course'''  and '''Make JMeter test plan''', both under Site administration > Development, augmented by a set of add-ons [https://github.com/moodlehq/moodle-performance-comparison Moodle performance comparison]. This document is about using the two built-in scripts with JMeter.
  
Warning:  '''Do not run these scripts on a production system!'''
+
Warning:  '''Do not run these scripts on a production system!''' These scripts generate data and load the server to its limit and beyond, making it to bloat and become non-reponsive. Don't even run them on a separate Moodle instance in the production server: their effect on the DBMS is undocumented.
 
 
These scripts generate data and load the server to its limit and beyond, making it to bloat and become nonreponsive. Don't even run them on a separate Moodle instance in the production server: their effect on the DBMS is undocumented.
 
  
 
<h2>Make test course</h2>
 
<h2>Make test course</h2>
This tool creates standard test courses that include many sections, activities, and files. This is intended to provide a standardised measure for checking the reliability and performance of various system components (such as backup and restore). This test is important because there have been many cases previously where, faced with real-life use cases (e.g. a course with 1,000 activities), the system does not work. Courses created using this feature can occupy a large amount of database and filesystem space (tens of gigabytes). You will need to delete the courses (and wait for various cleanup runs) to release this space again.
+
This tool creates standard test courses that include many sections, activities, and files. This is intended to provide a standardised measure for checking the reliability and performance of various system components (such as backup and restore). This test is important because there have been many cases previously where, faced with real-life use cases (e.g. a course with 1,000 activities), the system does not work.
  
Do not use this feature on a live system. Use only on a developer server. (To avoid accidental use, this feature is disabled unless you have also selected DEVELOPER debugging level.)
+
Courses created using this feature can occupy a large amount of database and filesystem space (tens of gigabytes). You will need to delete the courses (and wait for various cleanup runs) to release this space again.
  
 
Once you have set the debugging level Site administration > Development > Debugging: Debug messages = DEVELOPER: extra Moodle debug messages for developers, visit Site administration > Development > Make test course. You have the choice between XS (~10 KB; create in ~1 second), S (~10 KB, create in ~30 secends), M (~100 KB, create in ~2 minutes), L (~1 GB, create in ~30 minutes), XL (~10 GB, create in ~2 hours) and XXL (~20 GB, created in ~4 hours).
 
Once you have set the debugging level Site administration > Development > Debugging: Debug messages = DEVELOPER: extra Moodle debug messages for developers, visit Site administration > Development > Make test course. You have the choice between XS (~10 KB; create in ~1 second), S (~10 KB, create in ~30 secends), M (~100 KB, create in ~2 minutes), L (~1 GB, create in ~30 minutes), XL (~10 GB, create in ~2 hours) and XXL (~20 GB, created in ~4 hours).
Line 20: Line 18:
 
Output:
 
Output:
 
Creating course
 
Creating course
     Creating course [short name]
+
     Creating [Course name]
     Creating assignments (1): done (0.1s)
+
     Creating assignments (100): . . . . . . . . . . . . done (12.7s)
     Creating pages (1): done (0s)
+
     Creating pages (200): . . done (1.5s)
     Creating small files (1): done (0s)
+
     Creating small files (128): done (0.4s)
     Creating big files (1): done (0s)
+
     Creating big files (5): . done (1.3s)
     Checking user accounts (1)
+
     Checking user accounts (1000)
     Creating user accounts (1 - 1): done (0s)
+
     Creating user accounts (1 - 1000): . . . . . . . . done (8.7s)
     Enrolling users into course (1): done (0s)
+
     Enrolling users into course (1000): . . . . . . done (5.7s)
     Creating forum (2 posts): done (0s)
+
     Creating forum (500 posts): . . done (1.7s)
     Course completed (0.3s)
+
     Course completed (32.2s)
 +
 
 +
The final Continue will give you a view of the course thus created.
  
 
<h2>Make JMeter test plan</h2>
 
<h2>Make JMeter test plan</h2>
This tool creates a JMeter test plan file along with the user credentials file. This test plan is designed to work along with https://github.com/moodlehq/moodle-performance-comparison, which makes easier to run the test plan in a specific Moodle environment, gathers information about the runs and compares the results, so you will need to download it and use it's test_runner.sh script or follow the installation and usage instructions.
+
This tool creates a JMeter test plan file along with the user credentials file.
 +
 
 +
This test plan is designed to work along with [https://github.com/moodlehq/moodle-performance-comparison Moodle performance comparison], which makes easier to run the test plan in a specific Moodle environment, gathers information about the runs and compares the results, so you will need to download it and use it's test_runner.sh script or follow the installation and usage instructions.
 +
 
 +
You need to set a password for the course users in config.php (e.g. $CFG->tool_generator_users_password = 'moodle';). You might want to set $CFG->passwordpolicy = 0; in your config.php if the proposed user password conflicts with the password policy of the site.
  
You need to set a password for the course users in config.php (e.g. $CFG->tool_generator_users_password = 'moodle';). There is no default value for this password to prevent unintended usages of the tool. You need to use the update passwords option in case your course users have other passwords or they were generated by tool_generator but without setting a $CFG->tool_generator_users_password value.
+
There is no default value for this password to prevent unintended usages of the tool. You need to use the update passwords option in case your course users have other passwords or they were generated by tool_generator but without setting a $CFG->tool_generator_users_password value.
  
 
It is part of tool_generator so it works well with the courses generated by the courses and the site generators, it can also be used with any course that contains, at least:
 
It is part of tool_generator so it works well with the courses generated by the courses and the site generators, it can also be used with any course that contains, at least:
Line 43: Line 47:
  
 
You might want to consider your servers capacity when running large test plans as the amount to load generated by JMeter can be specially big. The ramp up period has been adjusted according to the number of threads (users) to reduce this kind of issues but the load is still huge.
 
You might want to consider your servers capacity when running large test plans as the amount to load generated by JMeter can be specially big. The ramp up period has been adjusted according to the number of threads (users) to reduce this kind of issues but the load is still huge.
 
Do not run the test plan on a live system. This feature only creates the files to feed JMeter so is not dangerous by itself, but you should NEVER run this test plan in a production site.
 
  
 
Visit  Site administration > Development > Make JMeter test plan. Under Size of course your have six possibilities: XS (1 user, 5 loops and 1 rampup period), S (30 users, 5 loops and 6 rampup period), M (100 users, 5 loops and 40 rampup period), L (1000 users, 6 loops and 100 rampup period), XL (5000 users, 6 loops and 500 rampup period) and XXL (1000 users, 7 loops and 800 rampup period). As target course select one of the courses created above.
 
Visit  Site administration > Development > Make JMeter test plan. Under Size of course your have six possibilities: XS (1 user, 5 loops and 1 rampup period), S (30 users, 5 loops and 6 rampup period), M (100 users, 5 loops and 40 rampup period), L (1000 users, 6 loops and 100 rampup period), XL (5000 users, 6 loops and 500 rampup period) and XXL (1000 users, 7 loops and 800 rampup period). As target course select one of the courses created above.
 
Update course users password: ticked.  
 
Update course users password: ticked.  
  
Now set $CFG->tool_generator_users_password in config.php to generate the test plan. Once successful you can download a test plan (jmx file) [[File:users_timestamp.csv|users_timestamp.csv]] and a users file (csv)
+
Once successful you can download a test plan [[File:testplan_timestamp.jmx|testplan_timestamp.jmx]] and a users file [[File:users_timestamp.csv|users_timestamp.csv]]  
 +
 
 
<h2>Running the test plan on JMeter</h2>
 
<h2>Running the test plan on JMeter</h2>
 
(to be filled)
 
(to be filled)

Revision as of 22:03, 18 May 2020

This article is a stub until we collect enough information about the developments since previous update in 2012. All improvements are welcome!

You can also add your comments to the discussion page or to the the discussion in the General developer forum.


The Apache JMeter has always been the most common load testing resp. performance measuring tool in the Moodle community. Since around release 2.5, Moodle makes the process of load testing with JMeter vastly simpler through two built-in scripts, ""Make test course and Make JMeter test plan, both under Site administration > Development, augmented by a set of add-ons Moodle performance comparison. This document is about using the two built-in scripts with JMeter.

Warning: Do not run these scripts on a production system! These scripts generate data and load the server to its limit and beyond, making it to bloat and become non-reponsive. Don't even run them on a separate Moodle instance in the production server: their effect on the DBMS is undocumented.

Make test course

This tool creates standard test courses that include many sections, activities, and files. This is intended to provide a standardised measure for checking the reliability and performance of various system components (such as backup and restore). This test is important because there have been many cases previously where, faced with real-life use cases (e.g. a course with 1,000 activities), the system does not work.

Courses created using this feature can occupy a large amount of database and filesystem space (tens of gigabytes). You will need to delete the courses (and wait for various cleanup runs) to release this space again.

Once you have set the debugging level Site administration > Development > Debugging: Debug messages = DEVELOPER: extra Moodle debug messages for developers, visit Site administration > Development > Make test course. You have the choice between XS (~10 KB; create in ~1 second), S (~10 KB, create in ~30 secends), M (~100 KB, create in ~2 minutes), L (~1 GB, create in ~30 minutes), XL (~10 GB, create in ~2 hours) and XXL (~20 GB, created in ~4 hours).

Output: Creating course

   Creating [Course name]
   Creating assignments (100): . . . . . . . . . . . . done (12.7s)
   Creating pages (200): . . done (1.5s)
   Creating small files (128): done (0.4s)
   Creating big files (5): . done (1.3s)
   Checking user accounts (1000)
   Creating user accounts (1 - 1000): . . . . . . . . done (8.7s)
   Enrolling users into course (1000): . . . . . . done (5.7s)
   Creating forum (500 posts): . . done (1.7s)
   Course completed (32.2s)

The final Continue will give you a view of the course thus created.

Make JMeter test plan

This tool creates a JMeter test plan file along with the user credentials file.

This test plan is designed to work along with Moodle performance comparison, which makes easier to run the test plan in a specific Moodle environment, gathers information about the runs and compares the results, so you will need to download it and use it's test_runner.sh script or follow the installation and usage instructions.

You need to set a password for the course users in config.php (e.g. $CFG->tool_generator_users_password = 'moodle';). You might want to set $CFG->passwordpolicy = 0; in your config.php if the proposed user password conflicts with the password policy of the site.

There is no default value for this password to prevent unintended usages of the tool. You need to use the update passwords option in case your course users have other passwords or they were generated by tool_generator but without setting a $CFG->tool_generator_users_password value.

It is part of tool_generator so it works well with the courses generated by the courses and the site generators, it can also be used with any course that contains, at least:

   Enough enrolled users (depends on the test plan size you select) with the password reset to 'moodle'
   A page module instance
   A forum module instance with at least one discussion and one reply

You might want to consider your servers capacity when running large test plans as the amount to load generated by JMeter can be specially big. The ramp up period has been adjusted according to the number of threads (users) to reduce this kind of issues but the load is still huge.

Visit Site administration > Development > Make JMeter test plan. Under Size of course your have six possibilities: XS (1 user, 5 loops and 1 rampup period), S (30 users, 5 loops and 6 rampup period), M (100 users, 5 loops and 40 rampup period), L (1000 users, 6 loops and 100 rampup period), XL (5000 users, 6 loops and 500 rampup period) and XXL (1000 users, 7 loops and 800 rampup period). As target course select one of the courses created above. Update course users password: ticked.

Once successful you can download a test plan testplan_timestamp.jmx and a users file users_timestamp.csv

Running the test plan on JMeter

(to be filled)

See also