Jmeter 5.4.3

0 views
Skip to first unread message

Taj Barnett

unread,
Aug 4, 2024, 4:02:08 PM8/4/24
to quistanesem
Onceyour Test Plan is ready, you can start your Load Test.The first step is to configure the injectors that will run JMeter, this as for any other Load Testing tool includes: Correct machine sizing in terms of CPU, memory and network OS Tuning Java setup: Ensure you install the latest version of Java supported by JMeter Increase the Java Heap size. By default JMeter runs with a heap of 1 GB, this might not be enough for your test and depends on your test plan and number of threads you want to run Once everything is ready, you will use CLI mode (Command-line mode previously called Non-GUI mode) to run it for the Load Test. Don't run load test using GUI mode !

Using CLI mode, you can generate a CSV (or XML) file containing results and have JMeter generate an HTML report at end of Load Test.JMeter will by default provide a summary of load test while it's running.

You can also have real-time results during your test using Backend Listener.


The easiest way to begin using JMeter is to firstdownload the latest production release and install it.The release contains all of the files you need to build and run most types of tests,e.g. Web (HTTP/HTTPS), FTP, JDBC, LDAP, Java, JUnit and more.


Once you are comfortable with building and running JMeter Test Plans, you can look into thevarious configuration elements (timers, listeners, assertions, and others) which give you more controlover your Test Plans.


JMeter comes with Apache's Xerces XML parser. You have the option of telling JMeterto use a different XML parser. To do so, include the classes for the third-party parser in JMeter's classpath,and update the jmeter.properties file with the full classname of the parserimplementation.


To test a web server using SSL encryption (HTTPS), JMeter requires that animplementation of SSL be provided, as is the case with Sun Java 1.4 and above.If your version of Java does not include SSL support, then it is possible to add an external implementation.Include the necessary encryption packages in JMeter's classpath.Also, update system.properties to register the SSL Provider.


JMeter now includes the JMS API from Apache Geronimo, so you just need to add the appropriate JMS Client implementationjar(s) from the JMS provider. Please refer to their documentation for details.There may also be some information on the JMeter Wiki.


To install a release build, simply unzip the zip/tar file into the directorywhere you want JMeter to be installed. Provided that you have a JRE/JDK correctly installedand the JAVA_HOME environment variable set, there is nothing more for you to do.


To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file.These files are found in the bin directory.After a short time, the JMeter GUI should appear. GUI mode should only be used for creating the test script, CLI mode (NON GUI) must be used for load testing


There are a few environment variables, that can be used to customize the JVM settings for JMeter. An easy way to set those is by creating a file named setenv.bat in the bin directory. Such a file could look like:


It may be necessary to set a few environment variables to configure the JVM used by JMeter. Those variables can be either set directly in the shell starting the jmeter script. For example setting the variable JVM_ARGS will override most pre-defined settings, for example


To set those variables permanently, you can place them in a file called setenv.sh in the bin directory. This file will be sourced when running JMeter by calling the jmeter script. An example for bin/setenv.sh could look like:


If you have developed new JMeter components,then you should jar them and copy the jar into JMeter's lib/ext directory.JMeter will automatically find JMeter components in any jars found here.Do not use lib/ext for utility jars or dependency jars used by the plugins;it is only intended for JMeter components and plugins.


Note that setting the CLASSPATH environment variable will have no effect.This is because JMeter is started with "java -jar",and the java command silently ignores the CLASSPATH variable, and the -classpath/-cpoptions when -jar is used.


If you are testing from behind a firewall/proxy server, you may need to provide JMeter withthe firewall/proxy server hostname and port number. To do so, run the jmeter[.bat] filefrom a command line with the following parameters:


For distributed testing, run JMeter in server mode on the remote node(s), and then control the server(s) from the GUI.You can also use CLI mode to run remote tests.To start the server(s), run jmeter-server[.bat] on each server host.


So, if you want to change the log level for org.apache.http category to debug level for instance, you can simply add (or uncomment) the following logger element in log4j2.xml file before launching JMeter.


As JMeter uses SLF4J as logging API and Apache Log4j 2 as a logging framework since 3.2, not every log level used before 3.2 can match exactly with one of the new available log levels provided by SLF4J/Log4j2. Therefore, please keep the following differences and new suggested practices in mind if you need to migrate any existing logging configurations and logging code.


If JMeter detects an error during a test, a message will be written to the log file. The log file name is defined in the log4j2.xml file (or using the -j option, see below). It defaults to jmeter.log, and will be found in the directory from which JMeter was launched.


The command-line option -j jmeterlogfile allow to process after the initial properties file is read, and before any further properties are processed. It therefore allows the default of jmeter.log to be overridden. The jmeter scripts that take a test plan name as a parameter (e.g. jmeter-n.cmd) have been updated to define the log file using the test plan name, e.g. for the test plan Test27.jmx the log file is set to Test27.log.


Prior to version 2.5.1, JMeter invoked System.exit() when a CLI mode test completed.This caused problems for applications that invoke JMeter directly, so JMeter no longer invokes System.exit()for a normal test completion. [Some fatal errors may still invoke System.exit()]JMeter will exit all the non-daemon threads it starts, but it is possible that some non-daemon threadsmay still remain; these will prevent the JVM from exiting.To detect this situation, JMeter starts a new daemon thread just before it exits.This daemon thread waits a short while; if it returns from the wait, then clearly theJVM has not been able to exit, and the thread prints a message to say why.


The property jmeter.exit.check.pause can be used to configure the delay before printing non-daemon threads.If set to 0 (default value), then JMeter does not print non-terminated threads at the end of the test.


If you wish to modify the properties with which JMeter runs you need to either modify the user.properties in the /bin directory or create your own copy of the jmeter.properties and specify it in the command line.


I'm recording the jmx script using the BlazeMeter Chrome extension. The user logs in, and completes a course and a test. There are many ajax requests being made along the way. Around 350 - 400 steps for the script. Mostly ajax POST request that have a json response.


But when I import that script into JMeter with the "Retrieve all embedded resources" and "Parallel downloads" set to 6, and run it (in the GUI initially with just 1 user), it will get through, say, 7 steps quickly, and then just hang, sometimes for 10+ minutes before advancing to the next step. This doesn't happen if I uncheck "Retrieve all embedded resources", but I don't want to do that since that wouldn't be a realistic test.


If I take that same test and run it with 100 users (from the command line using JVM_ARGS='-Xms4096m -Xmx4096m' sh jmeter -n -t myfolder/mytest.jmx -l myfolder/testresults.jtl), I get Uncaught Exception java.lang.OutOfMemoryError: Java heap space in thread Thread and my computer fan goes nuts.


I have an HTTP Cache Manager configured with only "Use Cache-Control/Expires header when processing GET requests" checked and I've lowered the "Max Number of elements in cache down to 10 since that's the only way I can get the test running at all.


I see that there are other cloud-based testing options, and I've tried a few out now, however I always come to a halt when it comes to configuring how to test logged in users. Seems like most solutions don't support this.


Feels like the kind of thing that lots of people should have come across in the past, but I find almost no one having these issues. What's the right way to load test thousands of logged-in users on a web application?


If JMeter "hangs" for 10 minutes retrieving an embedded resource there is a problem with this specific resource, you can see the response times for each resource using i.e. View Results Tree listener and either raise a bug for this particular "slow" component or exclude it from the scope using HTTP Request Defaults. There you can also specify the timeout, if the request won't return the response within the given timeframe - it will be marked as failed so you won't have to wait for 10 minutes:


Make sure to follow JMeter Best Practices in any case. If your "computer fan goes nuts" it means that CPU usage is very high therefore JMeter most probably won't be able to send requests fast enough so you will get false-negative results.


I already enabled CookieManager.save.cookies=true on user.properties, from the screenshot you could see the session key is actually already there after redirect. But Moodle still doesnt recognize this and doesnt authorize the user.


I Created the course manually and filled it with students accounts from Excel.But the test plan itself I generated it with the Moodle built-in Jmeter Script generator and then tweaked it on the Jmeter app.


I ran into this problem, and yes, the general fix is to tell jmeter to send HTTPS rather than HTTP requests. Tweak Protocol [http] to instead be https on this page: ( _reference.html#HTTP_Request_Defaults)

3a8082e126
Reply all
Reply to author
Forward
0 new messages