Difference between revisions of "Load testing Moodle with JMeter"

From MoodleDocs
(Created page with "Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications ...")
 
m
 
(37 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
+
Being the original load testing tool for servers, introduced in 1998(!), JMeter [http://jmeter.apache.org/] has always been the number one load testing resp. performance measuring tool for Moodle. Around its release 2.5, Moodle developers made the testing process vastly simpler by adding many scripts. The topic of this page is the usage of the two scripts ''Make test course'' [https://docs.moodle.org/en/Test_course_generator] and ''Make JMeter test plan'' [https://docs.moodle.org/en/JMeter_test_plan_generator] and JMeter running on a client machine.
  
There's a place in Moodle Contrib for people to share their Jmeter scripts here:
+
Warning:  Do not run these scripts nor JMeter targeting a production system! They generate a large amounts of artificial data and load the server to its limit and beyond, making it to bloat and/or become non-responsive. Don't even run them on a separate Moodle instance in the production server: their effect on the DBMS is undocumented.
http://cvs.moodle.org/contrib/tools/jmeter/
 
  
For more information about JMeter and what it could help you to stress test your Moodle installation, please see:
+
<h2>Prerequisite</h2>
http://jakarta.apache.org/jmeter/
+
<h3>JMeter installed on your client computer</h3>
 +
JMeter is a Java application so it can run on Windows, Mac, or Linux. It can be run on the command line or on its graphical client on your desktop. First check if Java is installed in your client computer by opening a console and entering 'java -version'. If it doesn't return a version, first install [https://www.java.com/ Java] on your client. The instructions vary with the operating system.
  
For JMeter FAQ, see:
+
To install JMeter go to the [http://jmeter.apache.org/download_jmeter.cgi JMeter page], download the zip and unzip it to the directory of your choice.
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ
 
  
==See also==
+
<h2>A test plan</h3>
*[http://moodle.org/mod/forum/discuss.php?d=119443 Using Moodle forum discussion on Jmeter Scripts]
+
You can make a test plan from the JMeter client in DIY style. We do not describe that path here, assuming you know JMeter. This page describes how to make a test plan with the scripts built in to Moodle and run it.
*[http://www.open.ac.uk/blogs/XHProf/?page_id=64 JMeter testplan generation Moodle plugin] developed by [http://moodle.org/user/view.php?id=264538&course=5 James Brisland]
+
 
*[http://www.javapassion.com/handsonlabs/javatestjmeter/index.html JavaPassion LAB 1077: JMeter Load Testing]
+
<h3>Make test course</h3>
 +
See https://docs.moodle.org/en/Test_course_generator
 +
 
 +
<h3>Make JMeter test plan</h3>
 +
See https://docs.moodle.org/en/JMeter_test_plan_generator
 +
 
 +
<h2>Running the test plan on JMeter</h2>
 +
To run JMeter open the /bin subdirectory and use either jmeter.bat on Windows or ./jmeter on Linux. This will open the JMeter GUI.
 +
 
 +
First step is to go to File -> Open and select the testplan.jmx file you downloaded above. This will open a tree on the left hand side of JMeter. Open the Warm-up site -> Default site request and enter the protocol (http or https) and Server name or IP. Then go to CSV Users Data and locate your users.csv file under Filename. <b>Repeat </b> this for Moodle Test.
 +
 
 +
Right mouse click on the Test Plan, then Add -> Listener. Choose Aggregate Report so you can follow the run as it happens. Save the changes in your test plan and run it.
 +
 
 +
==References==
 +
* [1] [http://jmeter.apache.org/ Apache JMeter homepage]
 +
* [2] [https://docs.moodle.org/en/Performance_recommendations#Obtain_a_baseline_benchmark Moodle Docs: Performance -> Obtain_a_baseline_benchmark]
 +
* [3] [https://moodle.org/mod/forum/discuss.php?d=377231 Jmeter or loading script/app to simulate concurrent users taking quizzes] (October 2018)
 +
* [4]  [https://moodle.org/mod/forum/discuss.php?d=368620 Has anyone successfully run a jmeter test with 1000 users?] (April 2018)
 +
 
 +
[[Category:Developer tools]]

Latest revision as of 17:55, 7 January 2022

Being the original load testing tool for servers, introduced in 1998(!), JMeter [1] has always been the number one load testing resp. performance measuring tool for Moodle. Around its release 2.5, Moodle developers made the testing process vastly simpler by adding many scripts. The topic of this page is the usage of the two scripts Make test course [2] and Make JMeter test plan [3] and JMeter running on a client machine.

Warning: Do not run these scripts nor JMeter targeting a production system! They generate a large amounts of artificial data and load the server to its limit and beyond, making it to bloat and/or become non-responsive. Don't even run them on a separate Moodle instance in the production server: their effect on the DBMS is undocumented.

Prerequisite

JMeter installed on your client computer

JMeter is a Java application so it can run on Windows, Mac, or Linux. It can be run on the command line or on its graphical client on your desktop. First check if Java is installed in your client computer by opening a console and entering 'java -version'. If it doesn't return a version, first install Java on your client. The instructions vary with the operating system.

To install JMeter go to the JMeter page, download the zip and unzip it to the directory of your choice.

A test plan

You can make a test plan from the JMeter client in DIY style. We do not describe that path here, assuming you know JMeter. This page describes how to make a test plan with the scripts built in to Moodle and run it.

Make test course

See https://docs.moodle.org/en/Test_course_generator

Make JMeter test plan

See https://docs.moodle.org/en/JMeter_test_plan_generator

Running the test plan on JMeter

To run JMeter open the /bin subdirectory and use either jmeter.bat on Windows or ./jmeter on Linux. This will open the JMeter GUI.

First step is to go to File -> Open and select the testplan.jmx file you downloaded above. This will open a tree on the left hand side of JMeter. Open the Warm-up site -> Default site request and enter the protocol (http or https) and Server name or IP. Then go to CSV Users Data and locate your users.csv file under Filename. Repeat this for Moodle Test.

Right mouse click on the Test Plan, then Add -> Listener. Choose Aggregate Report so you can follow the run as it happens. Save the changes in your test plan and run it.

References