The JMeter image used is the https://hub.docker.com/r/rbillon59/jmeter-k8s-base Each tag of that Docker image is a JMeter version
To use a specific version, just change the JMETER_VERSION env var in the docker-compose.yaml
file
jmeter-master:
build: &common-build
context: .
args:
- JMETER_VERSION=5.4.1
These images are based on openjdk 16 and are compatible for x86_64 and arm64 architectures
Be sure to have Docker up and ready on your host and docker-compose installed
Create a repository from this template then clone it with :
git clone <REPO>
scenario
folder, inside a folder named after the JMX (without the extension). See example tree belowdata
folder, child of scenario
modules
folder, child of scenario
.env
file. These variables will be exported and usable inside your scenario as Jmeter properties ${__P()}
(see scenario/my-scenario/my-scenario.jmx example).env
file at the repo root. Just set the name of the JMeter project to run. Like JMX_FOLDER=my-scenario
data
andmodules
are in thescenario
folder and not below inside the<project>
folder because, in some cases, you can have multiple JMeter projects that are sharing the JMeter modules (that's the goal of using modules after all).
Below a visual representation of the file structure
+-- .env
+-- scenario
| +-- data
| +-- modules
| +-- my-scenario
| +-- my-scenario.jmx
| +-- .env
In JMeter just put the filename in the path of your CSV Data Set Config
: Be sure your filename have a .csv suffix (in lowercase)
Do the same for the Include Controller
, just use the filename without any path (with the extension)
To launch your test in a one liner fashion :
source scenario/my-scenario/.env && sudo docker-compose -p jmeter up --scale jmeter-slave=${nbInjector} -d
.env
will give you the ability to use $nbInjector in the docker-compose command line. (optionnal):warning: Use the
-p jmeter
option for every docker-compose command
You can visualize your performance test on host:30000 with the grafana attached. (login: admin password: admin)
At the end of the test, JMeter will create a report in the report/your-scenario
directory
When you are done you can do
docker-compose -p jmeter down
to shutdown influxdb, grafana as well
Tips :
Options can be set in the .env file of your project
XMX
optional : Set the java heap (default 1g)
XMS
optional : Set the java heap (default 1g)
host
optional : Set the default request hostname on which perform the test (default jsonplaceholder.typicode.com)
port
optional : Set the default request port on which perform the test (default 443)
protocol
optional : Set the default request protocol (default https)
threads
optional : Set the number of virtual users to create (default 10)
duration
optional : Set the duration of the test in seconds (default 600)
rampup
optional : Set the time needed to create the total threads number (dafault 60)
nbInjector
optional : Set the number of injectors needed to run the test (default 1)