We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

Skip to content
devvkit
$devvkit learn --librarie apache-jmeter-guide

Apache JMeter Guide

[load-testing][gui][java][enterprise]
Performance & Profiling
Install
brew install jmeter
# or: download from https://jmeter.apache.org/
unzip apache-jmeter-*.zip
cd apache-jmeter-*/bin
./jmeter  # or jmeter.bat on Windows

JMeter is the most feature-complete load testing tool: it handles HTTP, HTTPS, SOAP/REST, JDBC (direct database load), JMS, FTP, and even gRPC via plugins. The GUI lets you build test plans visually with thread groups, samplers, listeners, and assertions.

For real work, ditch the GUI and use CLI (`jmeter -n -t plan.jmx -l results.jtl`). Parameterize test plans with JMeter properties (`-Jusers=100`). The HTML reporting dashboard (`-e -o report/`) generates professional charts.

JMeter supports distributed testing: one controller and multiple worker nodes. Use plugins from JMeter Plugins Manager for additional samplers (WebSocket, gRPC, Kafka). For simple API load tests, k6 or Vegeta are lighter alternatives.

CLI Mode

Run CLI test· Non-GUI execution.
jmeter -n -t test-plan.jmx -l results.jtl
jmeter -n -t test-plan.jmx -l results.jtl \
  -Jthreads=100 -Jrampup=30 -Jduration=300 \
  -JHOST=api.example.com -JPORT=443 \
  -e -o ./report  # Generate HTML dashboard
CLI properties· Override defaults.
jmeter -n -t plan.jmx -l results.jtl \
  -q user.properties \
  -Djmeter.save.saveservice.output_format=csv \
  -Djmeter.save.saveservice.response_data=true \
  -Jusers=200 -Jloops=10

Assertions

Response assertion· Fail on bad response.
<!-- In test plan: Response Assertion -->
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion">
  <boolProp name="Assertion.test_field">ResponseCode</boolProp>
  <stringProp name="Assertion.test_string">200</stringProp>
  <boolProp name="Assertion.assume_success">false</boolProp>
</ResponseAssertion>

# CLI equivalent via property:
echo "assertion.type=ResponseCode\nassertion.pattern=200" > assertions.properties

Parameters

Parameterized CSV· Read data from CSV.
# users.csv
username,password
alice,pass1
bob,pass2

# JMeter: CSV Data Set Config
# Variable Names: username,password
# Recycle on EOF: False
# Usage in request: ${username}, ${password}
Trick: dynamic body· Randomized request payload.
# Using __Random function:
${__Random(1,1000)}_${__time(yyyyMMddHHmmss)}

# Using __StringFromFile:
${__StringFromFile(bodies.csv,,,)}

# In HTTP Request body:
{"email": "user${__counter(TRUE)}@test.com", "score": ${__Random(10,100)}}

Dashboards

HTML dashboard· Generate report.
jmeter -n -t plan.jmx -l results.jtl -e -o ./dashboard
# Opens: ./dashboard/index.html
# Shows: APDEX, latency percentiles, throughput chart, active threads

Distributed

Distributed setup· Controller + workers.
# On each worker:
jmeter-server -Dserver.rmi.ssl.disable=true

# On controller:
jmeter -n -t plan.jmx -l results.jtl \
  -R worker1:1099,worker2:1099 \
  -Dclient.rmi.localport=60000 \
  -Dserver.rmi.ssl.disable=true \
  -Jremote_threads=50
Plugins Manager· Install extra samplers.
# Download plugins-manager.jar to lib/ext/
# CLI install:
java -jar plugins-manager.jar --install jpgc-graphs-basic
java -jar plugins-manager.jar --install jmeter-plugins-webdriver
java -jar plugins-manager.jar --list-available