Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Load up a free Java-based tool to impose load on web sites, whether it needs it or not


This tutorial explains how to install JMeter … for fun and profit.


  • Sign up for the mailing list at: http://jmeter.apache.org/mail.html

  • https://github.com/apache/jmeter

  • https://twitter.com/ApacheJMeter

  • https://groups.google.com/forum/#!forum/jmeter-plugins

Install Java Dependency

JMeter is written in Java for cross-platform sweetness.


  1. Change the Java Heap appropriate to your machine:

    HEAP="-Xms512m -Xmx2148m"
    • http://java.dzone.com/articles/java-8-permgen-metaspace

    • http://www.infoq.com/news/2013/03/java-8-permgen-metaspace

  2. Verify whether the JAVA_HOME environment points to the JRE or JDK installation folder:

    echo $JAVA_HOME

    The response on my Mac:

  3. Verify whether the JAVA_HOME/bin folder has been properly added to the PATH environment variable.

    javac -version

    The response should be similar to the above:

    javac 1.8.0_102

Install JMeter

There are several ways to obtain a running instance of JMeter, listed from easiest to most difficult:

A) You don’t need a local machine if you use the cloud service Blazemeter or Flood.io

B) Pull an image from Docker Hub within a Google Compute or AWS cloud instance.

C) Use the Dockerfile to build your own Docker image containing JMeter.

D) Use Homebrew to install JMeter natively on you Mac.

E) Download installer to install locally.

CAUTION: If you are in a large enterprise, confer with your security team before installing. They often have a repository such as Artifactory or Nexus where installers are available after being vetted and perhaps patched for security vulnerabilities.

Blazemeter SaaS

You don’t need a local machine if you use the cloud service

The SaaS vendor was purchased by CA in 2017.

Users of Blazemeter can use their add-on test framework.

Blogs about this:

  • https://www.artofsoftwaredevelopment.com/performance/performance-testing-in-the-cloud-with-jmeter-aws

Images from DockerHub.com

A Docker image is ready to run, after having Docker build it based on a Dockerfile.

There are many JMeter images on DockerHub.

The most popular:

   docker pull cirit/jmeter

It runs Jmeter 2.13 + Debian OS + Java Server JRE 8 on https://cloud.docker.com/

Another image containing a JMeter server include:

   docker pull justb4/jmeter

The image used in the flood.io SaaS service is:

docker pull floodio/jmeter


  • https://www.youtube.com/watch?v=sl2mfyjnkXk
  • https://docs.docker.com/docker-cloud/builds/automated-build/

Use Homebrew package manager on Mac

  1. Create a folder container.

    brew update
    brew install jmeter --with-plugins

    It downloads from:
    https://www.apache.org/dyn/closer.cgi?path=jmeter/binaries/apache-jmeter-3.3.tgz into:

    🍺  /usr/local/Cellar/jmeter/3.3: 2,924 files, 131.4MB, built in 1 minute 14 seconds

    Alternately, if it’s already installed:

    brew upgrade jmeter

    PROTIP: As with other package managers, Brew does not save JMeter in your Mac’s Applications folder.

Download installer from developers

Even if you’re not intending to download, go here to see the dates of each version.

  1. Download binary installer from:



  2. In Finder, double-click the file to unzip to folder:


  3. Move the folder to a folder with a path containing no spaces, such as:

    PROTIP: Putting the folder in your home folder would avoid issues with permissions.

    cd ~/Downloads
    mv apache-jmeter-3.3  ~/jmeter
    cd jmeter

    export PATH=”$HOME/jmeter:$PATH”

Set Path

On Mac/Linux:

  1. In a Text Editor, edit file ~/.bash_profile

    subl ~/.bash_profile

  2. Insert these lines to make JMeter within the Path sought for executables:

    # Following https://wilsonmar/github.io/jmeter-install ::
    export PATH="/usr/local/Cellar/jmeter/3.3/libexec/bin:$PATH"
    export JMETER_HOME=/usr/local/Cellar/jmeter/3.3/libexec  # if installed using Homebrew

    WARNING: Package managers may install older versions than what is available for direct download.

  3. Close existing terminals or refresh on each window:

    source ~/.bash_profile
  4. Verify $JMETER_HOME


JMeter folders

  1. List folders and top-level files:

    ls -al


    tree -L 1

    The folders:

    • bin contains executables, jar, and properties files
    • docs
    • extras contains miscellaneous files including samples using the Apache Ant tool
    • lib contains library utlity jar files
    • lib/ext contains JMeter components and add-ons
    • licenses contains legal text
    • printable_docs contains the usermanual in html and a demos folder containing jmx files

Invoke Blank JMeter GUI

On a Mac:

  1. Go to $JMETER_HOME/bin and run:

    chmod 555 jmeter.sh

    Alternately, invoke the JMeter GUI program using the link:

    open /usr/local/bin/jmeter

    Alternately, if you are using Windows:


    In response, a DOS window should appear with


    [version] is the jre version installed on the system.

    If it does not happen, either the environment settings are incorrect, or there are several JREs installed on the system.

    Either way, the response:

    Don't use GUI mode for load testing, only for Test creation and Test debugging !
    For load testing, use NON GUI Mode:
    jmeter -n -t [jmx file] -l [results file] -e -o [Path to output folder]
    & adapt Java Heap to your test requirements:
    Modify HEAP="-Xms512m -Xmx512m" in the JMeter batch file

    The default JMeter GUI:


    PROTIP: Press command+Q to Quit out of the JMeter GUI.

Sample test.jmx

  1. Open another Terminal and be at:

    cd $JMETER_HOME/extras/
  2. View JMeter example files that comes with the installer:

    ls *.jmx

    The response is:


    PROTIP: JMeter test scripts are defined within XML-formatted files.

  3. Remove graphic data writers for batch.

  4. Set Up at Least One Thread Group:

    PROTIP: A JMeter thread group contains both the automated script (URLs, etc.) and the load scenario. This is unlike LoadRunner, which has scripts in files folders separate from the Scenario (.lrs) file.

    In thread groups is defined the number of users to simulate. Each user is emulated by a separate thread.

    The ramp-up period tells JMeter how long it should take to reach the desired number of threads chosen.

    Set the number of iterations to process each user in the group with the Loop Count.

    Click on the thread group to see the load configurations. Expand a thread group to see the steps of the load script.

  5. Set up Samplers:

    Samplers emulate the actual work done within clients. When JMeter executes samplers, it writes down the results such as: start time, duration, success, response messages, etc.

    Listeners are used to view results. The most commonly used sampler is the HTTP Request, which sends a HTTP or HTTPS request to a web server.

  6. Add Timers:

    Set the duration of the delay from one request to the next. The specification is how many seconds JMeter waits before navigating from the homepage to the features page.

  7. Add Configuration Elements:

    This manages elements like the cache and the cookies, during test runs.

    Adding the “HTTP Cache Manager” and the “HTTP Cookie Manager” simulates the browser’s behavior.

    See this.

  8. Add Assertions:

    These define pass or fail criteria for the test.

    Let’s say you want to make sure your site or app responds within 100 milliseconds.

    You can set a Duration Assertion to specify that if any response lasts longer than 100 milliseconds, the sample will be marked as “failed.”

    The most important assertion to know is the Response Assertion. This covers 99% of your needs - so no wonder it’s so popular! You can use it to test the URL, response body, messages, embedded resources, redirects, headers and more. This assertion gives you loads of flexibility as it lets you test regular expressions rather than text patterns. JMeter handles regular expressions in a very similar way to Perl - except you don’t enclose the expression in //’s.

  9. Add Listeners

    Listeners display the results of a sampler.

    Listeners can be viewed in various formats (table, graph, tree, or log file).

    Listeners can be added anywhere in the test - but only collect data (listens) to elements on the same level or below.

    The most commonly used listener is “View Results Tree”, which presents in the GUI all test plan results in a user-friendly tree structure.

    Other listeners include Assertion Results, Aggregate Report and Beanshell Listener.

    WARNING: Disable all your listeners as they use up a lot of memory.

  10. Add a Thread Group component by right-clicking on the name of a test plan to select ‘Add’, then choose the component to set up and configure.

JMeter commands

  1. To view information:

    jmeter -h

    The response:

    Writing log file to: /Users/mac/jmeter.log
  2. To view all possible command line options:

    jmeter -?

    The response has the version at the right edge (3.1 at time of writing):

    Writing log file to: /Users/mac/jmeter.log
     _    ____   _    ____ _   _ _____       _ __  __ _____ _____ _____ ____     
    / \  |  _ \ / \  / ___| | | | ____|     | |  \/  | ____|_   _| ____|  _ \   
      / _ \ | |_) / _ \| |   | |_| |  _|    _  | | |\/| |  _|   | | |  _| | |_) | 
     / ___ \|  __/ ___ \ |___|  _  | |___  | |_| | |  | | |___  | | | |___|  _ <  
    /_/   \_\_| /_/   \_\____|_| |_|_____|  \___/|_|  |_|_____| |_| |_____|_| \_\ 3.1 r1770033  
    Copyright (c) 1999-2016 The Apache Software Foundation
       print command line options and exit
    -h, --help
       print usage information and exit
    -v, --version
       print the version information and exit
    -p, --propfile <argument>
       the jmeter property file to use
    -q, --addprop <argument>
       additional JMeter property file(s)
    -t, --testfile <argument>
       the jmeter test(.jmx) file to run
    -l, --logfile <argument>
       the file to log samples to
    -j, --jmeterlogfile <argument>
       jmeter run log file (jmeter.log)
    -n, --nongui
       run JMeter in nongui mode
    -s, --server
       run the JMeter server
    -H, --proxyHost <argument>
       Set a proxy server for JMeter to use
    -P, --proxyPort <argument>
       Set proxy server port for JMeter to use
    -N, --nonProxyHosts <argument>
       Set nonproxy host list (e.g. *.apache.org|localhost)
    -u, --username <argument>
       Set username for proxy server that JMeter is to use
    -a, --password <argument>
       Set password for proxy server that JMeter is to use
    -J, --jmeterproperty <argument>=
       Define additional JMeter properties
    -G, --globalproperty <argument>=<value>
       Define Global properties (sent to servers)
       e.g. -Gport=123
        or -Gglobal.properties
    -D, --systemproperty <argument>=<value>
       Define additional system properties
    -S, --systemPropertyFile <argument>
       additional system property file(s)
    -L, --loglevel <argument>=<value>
       [category=]level e.g. jorphan=INFO or jmeter.util=DEBUG
    -r, --runremote
       Start remote servers (as defined in remote_hosts)
    -R, --remotestart <argument>
       Start these remote servers (overrides remote_hosts)
    -d, --homedir <argument>
       the jmeter home directory to use
    -X, --remoteexit
       Exit the remote servers at end of test (non-GUI)
    -g, --reportonly <argument>
       generate report dashboard only, from a test results file
    -e, --reportatendofloadtests
       generate report dashboard after load test
    -o, --reportoutputfolder <argument>
       output folder for report dashboard
    ## Run JMeter in Batch
    The format of command line:
    jmeter -n -t .../Test.jmx -l .../test.jtl -e -o [Path to output folder]
    where: -n tells JMeter to run in non-GUI mode -t the path to source .jmx script to run the script that comes with the JMeter installation. -l test .jtl -j the name of JMeter run log file. -p or
    to preced a JMeter property file to use -q or --addprop to precede JMeter property file(s) Aditionally, JMeter has several other parameters that can be used for running in non-GUI mode. -R lists remote servers to run. -H proxy server hostname or ip address. -P proxy server port. ### Shutdown and Abort run Running JMeter in non-GUI (batch) mode means there is no Menu which listens to keystrokes such as Control + '.'. However, JMeter in non-GUI mode listens for commands on port 4445 (set at default in the JMeter property jmeterengine.nongui.port). If that port is being used (i.e. by another JMeter instance), JMeter tries the next higher port, continuing until it reaches the port defined in JMeter property jmeterengine.nongui.maxport, which defaults to 4455 (10 more than the default). Since the JVM calls class files from ApacheJMeter.jar, the CLASSPATH variable needs to be in the PATH along with ApacheJmeter.jar, because inside these files is this string:
    java -cp %~dp0ApacheJMeter.jar org.apache.jmeter.util.ShutdownClient StopTestNow %*
  3. Gracefully shutdown using these scripts the installer puts in the JMeter /bin directory.


    Alternately, shutdown immediately:


    The commands will only be accepted if the script is run from the same host.

Servers in user.properties

Specify the various slave servers the master JMeter server uses.

  1. Use your favorite text editor instead of vi to edit properties file:

    cd $JMETER_HOME/bin
    vi user.properties
  2. Specify slave computers IP addresses, separated by commas. Example:


    All on the same subnet?

    CAUTION: All instances of JMeter should have the same version.


    Slave is the system running jmeter-server, which takes commands from the GUI and send requests to

    Target servers, the web server under test

    Master is the JMeter system running Jmeter GUI controlling the server which controls slaves.


There are many plug-ins various people have developed for JMeter:

Plugins Standard, Extras, ExtrasLibs, WebDriver, Hadoop, etc.

Install Sample Apps under Test

PROTIP: Learn to use JMeter targeting a sample app so you can follow tutorials step by step, to equip you for troubleshooting the unknown.

These are the bare mininum JARs required by JMeter 2.9+ and the HTTPSampler used.

Other samplers have different library JAR dependencies:

  • ApacheJMeter_core.jar
  • jorphan.jar
  • avalon-framework-4.1.4.jar
  • ApacheJMeter_http.jar
  • commons-logging-1.1.1.jar
  • logkit-2.0.jar
  • oro-2.0.8.jar
  • commons-io-2.2.jar
  • commons-lang3-3.1.jar

Integrate JMeter with Apache Ant

  1. Install the JMeter Ant Task






JMeter makes use of the keytool utility (available in JRE/JDK) so you need to ensure your configuration is correct, read this wiki page before starting.

Report review

The Ant task creates a report like this:

jmeter ant html blazemeter

Record Custom Script

  1. Install the JMeter Chrome Extension which filters only the URL’s to be load tested.


    See How to Cut Your JMeter Scripting Time by 80% using Blazemeter’s “Smart JMX” to generate script files from proxy recordings.

    The recording has Automatic Extractors that does auto-parameterization (also known as “auto-correlation” of values with variables it creates).

JMeter ThreadGroup and Samplers.



In a Continuous Integration environment, we would incorporate JMeter runs within a Jenkinsfile.

Blogs about this topic:

  • http://www.theserverlabs.com/blog/?p=280


In addition to scanning code, SonarQube maintains a history of test runs. http://www.sonarplugins.com/jmeter

Look into this

Generate JMeter Code from Swagger


What others have written:

  • https://www.guru99.com/introduction-to-jmeter.html

  • http://biscminds.blogspot.fr/2011/12/quick-jmeter-setup-on-mac.html

  • http://zacster.blogspot.com/2008/03/quick-howto-to-setup-jmeter.html