Skip to main content
New to Testkube? Unleash the power of cloud native testing in Kubernetes with Testkube. Get Started >

Distributed JMeter Example

info

This Workflows functionality is not available when running the Testkube Agent in Standalone Mode - Read More

Testkube has built-in support for parallelising any testing tool - check out the Parallelization documentation for details and examples.

The below example shows how to distribute a JMeter test across a configurable number of nodes

  • Read JMX configuration from Git repository (spec.content.git)
  • Start 5 remote workers (spec.services.slave.count)
    • Distribute them evenly across nodes (spec.services.slave.use[0] - distribute/evenly template is setting common pod.topologySpreadConstraints)
    • Reserve 1/8 CPU and 128MB memory for each instance (spec.services.slave.container.resources)
    • Wait until they will accept connection at port 1099 (spec.services.slave.readinessProbe)
  • Run JMeter controller against all the remote workers (spec.services.steps[0].run)
    • It uses {{ services.slave.*.ip }} as an argument - services.slave.*.ip will return list of IPs, and they will be joined by comma (,) to convert to text
Distributed JMeter Workflow
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: distributed-jmeter-example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/jmeter/executor-tests/jmeter-executor-smoke.jmx
container:
workingDir: /data/repo/test/jmeter/executor-tests
services:
slave:
use:
- name: distribute/evenly
count: 5
logs: always
timeout: 30s
image: anasoid/jmeter:5.6-plugins-21-jre
command:
- jmeter-server
- -Dserver.rmi.localport=60000
- -Dserver_port=1099
- -Jserver.rmi.ssl.disable=true
container:
resources:
requests:
cpu: 128m
memory: 128Mi
readinessProbe:
tcpSocket:
port: 1099
periodSeconds: 1
steps:
- name: Run tests
run:
image: anasoid/jmeter:5.6-plugins-21-jre
shell: |
jmeter -n \
-X -Jserver.rmi.ssl.disable=true -Jclient.rmi.localport=7000 \
-R {{ services.slave.*.ip }} \
-t jmeter-executor-smoke.jmx

The Log Output from this test:

Distributed JMeter Log Output