JMeter¶
PerfShop integrates Apache JMeter as two complementary Docker services that together form a browser-driven load testing platform:
perfshop-jmeter— ajustb4/jmeter:5.5container that stays permanently idle. It never starts a shot on its own; it waits for an execution order delivered throughdocker exec.perfshop-jmeter-ui— a Node.js / Express application that provides a web control interface: scenario tree browsing, JMX editor, shot launching, log streaming, HTML report retrieval, and live metrics exposure.
The pair lets a student launch a complete shot without ever opening a terminal, while preserving the full power and compatibility of standalone JMeter.
Source of truth
This page is drawn from the perfshop-jmeter and perfshop-jmeter-ui blocks of docker-compose.desktop.yml / docker-compose.build.yml, from the content of the jmeter/ folder (scenarios/, scripts/, plugins/), and from the 9 Node modules in jmeter-ui/src/ (server.js, config.js, i18n.js, docker.js, security.js, auth.js, jmx-parser.js, scenarios.js, jmeter.js).
Architecture of the pair¶
flowchart TB
subgraph browser["Browser (instructor or student)"]
UI["JMeter UI<br/>http://localhost:3005"]
end
subgraph jmui["perfshop-jmeter-ui<br/>(Node 24, Express, port 3005)"]
direction TB
SRV["server.js"]
AU["auth.js<br/>(8h session + CSRF + rate limit)"]
SC["scenarios.js<br/>(tree, CRUD)"]
JP["jmx-parser.js<br/>(.jmx editing)"]
JM["jmeter.js<br/>(launch + status + logs)"]
DK["docker.js<br/>(Docker API, relay socket)"]
SRV --> AU
SRV --> SC
SRV --> JP
SRV --> JM
JM --> DK
end
subgraph jm["perfshop-jmeter<br/>(justb4/jmeter:5.5, idle)"]
ENT["entrypoint:<br/>cp /plugins/*.jar ... && tail -f /dev/null"]
JAR["jmeter.jar"]
PP[/"Prometheus plugin<br/>:9270 (during a shot)"/]
ENT --- JAR
JAR --- PP
end
subgraph vols["Shared volumes<br/>(bind mounts)"]
SCEN["./jmeter/scenarios"]
SCRIPTS["./jmeter/scripts"]
RESULTS["./jmeter/results"]
PLUGS["./jmeter/plugins"]
LOGS["./jmeter/logs"]
end
subgraph obs["Observability"]
PROM["prometheus<br/>(jmeter job, scrape :9270)"]
LOKI["loki<br/>(tail jmeter.log)"]
GRAF["grafana<br/>(perfshop-jmeter-live dashboard)"]
end
DOCK[/"perfshop-docker-relay<br/>/run/docker-relay/docker.sock"/]
UI -->|HTTPS| SRV
DK -->|talks to the relay| DOCK
DOCK -.->|docker exec perfshop-jmeter<br/>jmeter -n -t ... -l ...| JAR
jm --- vols
jmui --- vols
PROM -->|scrape 5s| PP
LOKI -->|tail| LOGS
PROM --> GRAF
LOKI --> GRAF
The key point: perfshop-jmeter-ui does not launch JMeter inside its own container. It goes through the Docker API — by way of the perfshop-docker-relay relay, which grants it that container only — to run the equivalent of docker exec perfshop-jmeter jmeter -n -t .... This ensures that shots run inside the official JMeter image, with all its dependencies and classpath already configured, and without penalizing the UI's performance with the JMeter JVM.
perfshop-jmeter — permanent idle container¶
Docker Compose configuration¶
| Key | Value |
|---|---|
| Image | justb4/jmeter:5.5 (variable JMETER_IMAGE) |
container_name |
perfshop-jmeter |
| Network | perfshop-network |
restart |
unless-stopped |
| Entrypoint | /bin/sh -c "cp /plugins/*.jar /opt/apache-jmeter-5.5/lib/ext/ 2>/dev/null \|\| true && echo '[JMeter] Plugins installed' && tail -f /dev/null" |
Why the tail -f /dev/null entrypoint?¶
The justb4/jmeter:5.5 image is designed to run a single shot and exit — its classic CI usage. PerfShop needs the opposite: a container that stays up permanently so we can:
- Copy plugins once at startup (via
cp /plugins/*.jar ...) - Launch shots on demand through
docker execwithout paying the cost of a fulldocker run(image pull, container creation, volume mounting) - Preserve state between shots (temporary files, aggregated logs)
tail -f /dev/null is the standard trick for keeping a Docker container alive indefinitely without burning CPU.
Plugins copied at startup¶
The ./jmeter/plugins folder is bind-mounted at /plugins and contains one external plugin:
| Plugin | File | Role |
|---|---|---|
| JMeter Prometheus Listener | jmeter-prometheus-plugin-0.6.0.jar |
Exposes the metrics of a running JMeter shot on a Prometheus HTTP endpoint (default port 9270) |
The plugin is copied to /opt/apache-jmeter-5.5/lib/ext/ when the container starts. Once the container is in place, JMeter automatically loads the plugin at every shot — it becomes usable in scenarios through the Prometheus Listener element on the JMeter side.
Bind-mounted volumes¶
| Bind mount | Mount point | Access | Role |
|---|---|---|---|
./jmeter/scenarios |
/scenarios |
read-only | JMX scenario files (versionable sources) |
./jmeter/scripts |
/scripts |
read-only | Groovy/Java scripts used by some samplers |
./jmeter/results |
/results |
read-write | Shot outputs (CSV/JTL files + HTML reports) |
./jmeter/plugins |
/plugins |
read-only | External plugins to inject in lib/ext/ |
./jmeter/logs |
/jmeter-logs |
read-write | JMeter logs (read by Promtail for Loki) |
The same folders are also mounted on the perfshop-jmeter-ui side (under /app/scenarios, /app/scripts, /app/results, /app/plugins), read-write: the UI is what drops the scenarios (upload, editor). The JMeter container only reads its inputs: a plan is code (Groovy), so a shot cannot rewrite a shipped scenario, the load-accounts file or a plugin — the write fails with "Read-only file system". It only writes its results and its log.
Environment variables¶
| Variable | Default | Role |
|---|---|---|
HEAP |
-Xms256m -Xmx${JMETER_MAX_RAM:-512}m -XX:MaxMetaspaceSize=128m |
JVM options passed to JMeter |
JMETER_CUSTOM_PLUGINS_FOLDER |
/plugins |
Folder scanned by JMeter for additional plugins |
Sizing the JMeter heap
The JMETER_MAX_RAM variable controls JMeter's -Xmx. 512 MB is enough for a shot with a few hundred virtual threads; beyond that, this value must be raised in .env before up -d to avoid OutOfMemoryError on the injector side (which would otherwise unfairly be blamed on the SUT).
Shipped scenario catalog¶
The ./jmeter/scenarios folder contains several ready-to-use JMX files,
organized into themed subfolders:
| Scenario | Defaults (vUsers, duration) | Usage |
|---|---|---|
simple-api-products.jmx |
5, 5 min | Minimal shot against the products API — example and smoke test |
baseline-nominal.jmx |
10, 5 min | Nominal reference shot before any chaos injection |
parcours-metier-nominal.jmx |
5, 5 min | Full business journey T01–T10 (login → order) without chaos scripting |
E2E/parcours-complet-e2e.jmx |
10, 2 h | Full end-to-end journey; 2 h is the duration written in the plan, not a minimum duration |
Fonctionnel/ |
20 to 50, 5 to 10 min | Load plans for functional chaos: catalog (F3), orders (F1 and F2), product pages (F4); 30 to 60 s ramp-up |
Master/ |
20, 20 and 10 (one value per group), 10 min | Master plan full-chaos-master.jmx: three thread groups in parallel (catalog, orders, product pages) |
These values are the ones written in the plans: they apply to a shot launched from the command line, without -Jusers
or -Jduration. JMeter UI always passes its own (10 vUsers and 5 minutes when the form opens); for Master/, the
number entered applies to each of the three groups, that is three times that number of threads. Apart from the target
and the live-metrics settings (prometheus.port, prometheus.ip), JMeter UI passes no other plan property
(ramp_time of the nominal plan, restock_period of the E2E plan, order_product_id of the Master plan…): these
keep the value written in the plan.
Load capacity
The 500 load accounts (load1–load500) do not amount to a capacity of 500 vUsers: each journey takes the
next account in the file, which starts over once its 500 lines have been read.
For the two journey plans, parcours-metier-nominal.jmx and E2E/parcours-complet-e2e.jmx, stock sets a
limit: each journey orders one unit of a product, and an order for a product that is out of stock is refused
with 409. The E2E plan restocks once a minute; the nominal plan only restocks at startup. The load and
the duration a plan can sustain are therefore estimated from its pauses and from the reference stocks of the
products it orders.
Measured without errors on the E2E plan on 2026-10-06, on a French-language platform: four 10-minute shots at fewer than 10 vUsers, and one 2-minute shot at 10 vUsers. No heavier or longer shot has been measured for this page — not even the setting written in the plan, 10 vUsers for 2 h.
Injector memory: see "Sizing the JMeter heap" above.
Stock: a plan that orders prepares its dataset
Stock is checked when ordering: an order above the stock is refused with 409
(Business Chaos — Stock and restock). Plans that order prepare it:
parcours-metier-nominal.jmx and E2E/parcours-complet-e2e.jmx restock in a setUp Thread Group
(POST /api/chaos/student/business/restock, student mode) — the E2E plan also restocks every 60 s
(-Jrestock_period, -Jrestock_threads=0 to turn it off) — and their keywords lead to products with enough
stock for the settings written in the plans; Fonctionnel/checkout-stress-f1f2.jmx and
Master/full-chaos-master.jmx order product 18
(-Jorder_product_id), with protected stock, with a load account drawn from users.csv (-Jtest_email /
-Jtest_password to force your own). Restock applies to the whole room.
User data file — jmeter/scripts/users.csv¶
The users.csv file is the authentication dataset shared by all scenarios
that call POST /api/auth/login. It is mounted in the JMeter container at /scripts/users.csv.
Format (501 lines: 1 header + 500 data rows):
userEmail,userPassword,userName
load1@perfshop.com,<password>,Load User1
load2@perfshop.com,<password>,Load User2
...
load500@perfshop.com,<password>,Load User500
The second field holds the account's password; this page does not reproduce it.
JMeter configuration in the JMX files:
| CSVDataSet property | Value | Reason |
|---|---|---|
filename |
/scripts/users.csv |
Docker path (bind mount ./jmeter/scripts → /scripts) |
shareMode |
shareMode.all |
All threads share a single pointer: each journey takes the next line of the file |
ignoreFirstLine |
true |
Skips the userEmail,userPassword,userName header |
recycle |
true |
Loops back to the start once all 500 lines are consumed |
stopThread |
false |
A thread never stops due to lack of available accounts |
shareMode.all vs shareMode.thread
With shareMode.thread (the former value), each thread re-read the CSV from the beginning
independently — two threads could use the same account simultaneously, causing cooldown
anti-duplicate errors on the backend. With shareMode.all, the pointer advances across all
threads: each journey takes the next line. An account is only handed to another thread while it is still
in use if 500 lines have been read in the meantime: many threads, or one journey that drags on (read in
the plans, not measured).
Account source: Flyway migration V2__data_users.sql (present in migration-fr/
and migration-en/). Passwords are BCrypt-hashed at strength 10 in the database
(prefix $2b$10$). The CSV contains passwords in plaintext — required so that
JMeter can send them to POST /api/auth/login, which performs the BCrypt comparison on the backend.
perfshop-jmeter-ui — Express Node.js¶
Docker Compose configuration¶
| Key | Value |
|---|---|
| Base image | node:24.15.0-alpine (bumped in B0, 2026-05-19) |
working_dir |
/app |
command |
sh -c "npm ci --omit=dev && node src/server.js" |
| Exposed port | 3005 (host) → 3005 (container), variable JMETER_UI_PORT |
With docker-compose.desktop.yml, the image is not built from a Dockerfile: the source code is mounted as a bind mount (./jmeter-ui:/app) and npm ci --omit=dev runs at startup; with docker-compose.build.yml, it is built from jmeter-ui/Dockerfile. The node_modules are persisted in a named volume (jmeter-ui-modules:/app/node_modules) so they are not lost on each restart.
Critical bind mounts¶
| Bind mount | Mount point | Role |
|---|---|---|
./jmeter-ui |
/app |
Node.js source code (hot-reload during editing) |
./jmeter/scripts |
/app/scripts |
Flat uploads (POST /api/upload), users.csv data, authors registry .owners.json — read and write |
./jmeter/scenarios |
/app/scenarios |
Read/write JMX files; authors registry .owners.json |
./jmeter/results |
/app/results |
Reports and JTL files; JMeter UI writes the state of the shot (.runstate.json) and the starter of each shot (<shot>.owner.json) there, and deletes reports |
./jmeter/plugins |
/app/plugins |
Read the list of plugins |
docker-relay-jmeter-ui (named volume, read-only) |
/run/docker-relay |
Docker relay socket: the equivalent of docker exec in perfshop-jmeter, nothing else |
jmeter-ui-modules (named volume) |
/app/node_modules |
Cache for Node dependencies |
No more direct access to the Docker daemon
Up to the previous version, perfshop-jmeter-ui mounted /var/run/docker.sock: full access to the host Docker daemon. It now talks to the perfshop-docker-relay relay, which grants it only the state of perfshop-jmeter, commands in that container alone (test run, report, stop, reading the JMeter log) and the reading of its own container log; any other call is refused (403) and logged — see Docker socket: the relay. This does not waive the rest: a JMeter plan still runs in perfshop-jmeter, and this service must never be directly exposed to the internet. A reverse proxy with strong auth and IP restriction remains mandatory for any public exposure.
Environment variables¶
| Variable | Default | Role |
|---|---|---|
PORT / SCRIPTS_UI_PORT |
3005 |
HTTP port of the Node server |
PUBLIC_JMETER_URL |
http://localhost:3005 |
Public URL exposed to the browser |
JMETER_TARGET_INTERNAL |
http://perfshop-app:8080 |
"Direct backend" target (bypasses nginx) |
JMETER_TARGET_EXTERNAL |
PUBLIC_API_URL |
Equivalent public target via reverse proxy |
JMETER_TARGET_FRONTEND |
PUBLIC_FRONTEND_URL |
Frontend target (for front-end shots) |
JMETER_PROMETHEUS_PORT |
9270 |
Port exposed by the Prometheus plugin on the JMeter side |
PROMETHEUS_INTERNAL_URL |
http://perfshop-prometheus:9090 |
Internal Prometheus URL for live metric queries |
PERFSHOP_API_INTERNAL |
(mandatory, fail-fast) | Internal backend URL for health checks |
JMETER_CONTAINER_NAME |
perfshop-jmeter |
Name of the target container for docker exec — the relay grants that name only: changing it means changing docker-relay/src/policy.js too |
DOCKER_SOCKET |
/run/docker-relay/docker.sock (compose files) |
Docker API socket: the relay's. Without the variable, the code falls back to /var/run/docker.sock, which the service no longer mounts |
JMETER_MAX_RAM |
512 (or 1024 depending on target) |
Max heap passed to JMeter |
GRAFANA_URL |
PUBLIC_GRAFANA_URL |
Deep link to the perfshop-jmeter-live dashboard from the UI |
PERFSHOP_LANG |
fr or en |
Language of the UI and server-side translations |
SESSION_SECRET |
perfshop-jmeter-ui-secret (dev) |
Session cookie signing secret — fail-fast if left at default value with NODE_ENV=production |
The 9 modules in src/¶
| Module | Lines | Role |
|---|---|---|
server.js |
103 | Express orchestration, session, middlewares, route mounting, window.__CONFIG__ injection via HTML marker |
config.js |
51 | Environment variable reading and validation at startup |
i18n.js |
51 | Loads translation bundles from public/i18n/{fr,en}.json |
docker.js |
94 | Low-level Docker API client (Detach:true mode) through the Unix socket of the relay |
security.js |
47 | csrfProtection and rateLimit(windowMs, maxHits) middlewares |
auth.js |
68 | Login/logout/status + requireAuth middleware + PUBLIC_PATHS list |
jmx-parser.js |
137 | Parsing and editing of JMX files (XML structure) |
scenarios.js |
218 | Tree, CRUD, upload, scenario editing |
jmeter.js |
548 | Launch, stop, status, logs, results, live metrics (central module) |
Injecting configuration into the page¶
The server exposes the browser configuration via a stable HTML marker placed in public/index.html:
When serving /, the server:
- Reads
public/index.html - Looks for the
<!-- @CONFIG_INJECT@ -->marker - Replaces it with
<script>window.__CONFIG__ = {...};</script> - If the marker is absent, logs an error and falls back to injecting before
</head>
This mechanism avoids double-loading config + HTML and ensures that the browser-side JavaScript has access to PUBLIC_CONFIG before any other script.
Exposed REST endpoints¶
| Method | Route | Module | Auth | Role |
|---|---|---|---|---|
POST |
/api/auth/login |
auth.js | public (rate-limited) | Authentication |
POST |
/api/auth/logout |
auth.js | session | Session close |
GET |
/api/auth/status |
auth.js | public | Current session state |
GET |
/api/scenarios/tree |
scenarios.js | session | Full JMX tree |
GET |
/api/scenarios/parse?path= |
scenarios.js | session | Read a JMX for the editor: model, read-only flag (readOnly) and its reason (readOnlyReason: delivered, not_owner, owner_unknown) |
POST |
/api/scenarios/upload |
scenarios.js | session | Upload a JMX into the tree — same name: 409, then explicit replacement (overwrite); shipped plan or another account's plan: 403; name taken up to letter case: 409 error.scenario.name_taken_case |
POST |
/api/upload |
scenarios.js | session | Flat upload into jmeter/scripts (no button in the interface) — same name as another account's file: 403 |
POST |
/api/scenarios/save |
scenarios.js | session | Edit a JMX from the editor (via jmx-parser) — shipped plan or another account's plan: 403 |
POST |
/api/scenarios/move |
scenarios.js | session | Move a JMX — shipped plan or another account's plan: 403 |
DELETE |
/api/scenarios/file |
scenarios.js | session | Delete a JMX — shipped plan or another account's plan: 403 |
POST |
/api/run |
jmeter.js | session | Launch a shot (docker exec perfshop-jmeter jmeter -n -t ...) |
POST |
/api/stop |
jmeter.js | session | Stop the current shot (stoptest.sh then SIGTERM) — reserved to the account that started it and to the instructor: 403 otherwise (shared platform) |
GET |
/api/status |
jmeter.js | session | Current state (running, PID, elapsed time, JMX), starter (startedBy) and the session's right to stop (canStop) |
GET |
/api/logs |
jmeter.js | session | Streaming of the latest lines of jmeter.log |
GET |
/api/results |
jmeter.js | session | List of available reports in /results, with the plan (script), the starter (startedBy) and the session's right to delete (canDelete) |
GET |
/api/results/:id |
jmeter.js | session | Report details |
DELETE |
/api/results/:id |
jmeter.js | session | Delete a report — reserved to its starter and to the instructor: 403 otherwise (shared platform) |
GET |
/api/metrics-live |
jmeter.js | session | Queries Prometheus and returns live metrics for the current shot |
GET |
/api/jmeter-container/status |
jmeter.js | public | Status of the perfshop-jmeter container (UP/DOWN) |
GET |
/api/jmeter/status |
jmeter.js | public | Public alias for external monitoring |
Security¶
Three successive layers protect the UI:
flowchart LR
REQ["HTTP request"]
REQ --> S1["CSRF protection<br/>(global)"]
S1 --> S2["Rate limiting<br/>(POST /api/auth/login<br/>10 attempts / min / IP)"]
S2 --> S3["Auth gate<br/>(apiAuthGate on /api/*<br/>except PUBLIC_PATHS)"]
S3 --> S4["requireAuth<br/>(per-route middleware)"]
S4 --> H["Handler"]
| Layer | Detail |
|---|---|
| CSRF | Token generated per session, verified on all mutating requests (POST, PUT, DELETE) |
| Rate limit | rateLimit(60_000, 10): 10 login attempts per minute per IP, then HTTP 429 |
| Session | express-session 8 hours, httpOnly cookie, secure conditional on HTTPS, sameSite lax over HTTP and none over cross-site HTTPS |
| Auth gate | apiAuthGate on /api/* with explicit PUBLIC_PATHS list (/api/auth/*, /api/jmeter/status, /api/jmeter-container/status) |
| requireAuth | Systematic per-sensitive-route middleware — double safety net even if the auth gate is misconfigured |
Shared platform: one shot at a time¶
One platform serves the whole class, and JMeter UI runs one shot at a time. During a shot, every connected page shows
it: the ▶ Start Test button greyed out ("A test is already running on the platform: wait for it to end"), the
"Running" pill, the plan and parameters of the shot, and "Started by <account>". A click sent before the page saw the
shot gets "❌ A test is already running" (POST /api/run: 409). Only the account that started the shot and the
instructor (superadmin account) stop it: for the others, ⏹ Stop stays greyed out, and POST /api/stop answers
403 ("Only the person who started this test and the instructor can stop it"). GET /api/status gives each session
the starter (startedBy) and its right to stop (canStop). The instructor right is read at login: a session opened
before this rule (2026-10-19) logs in again to stop someone else's shot; a shot whose starter is unknown (state saved
before it) is stopped by the instructor only.
Student accounts: one per student, JMeter and Scripts rights, created in one gesture with their Squash TM
account by ./build.sh <target> --comptes (Class accounts); by hand as a fallback, chaos
console › ⚙️ Administration button (page "Admin account management", ➕ Create account button). An account
without a tool's right is refused there: "Access denied — this account does not have … access".
Reports and uploaded plans (2026-10-20): each belongs to the account that made it — the starter of the shot, the
uploader of the plan. Only that account and the instructor delete a report; only they move, replace, edit or delete an
uploaded plan. For the others, 🗑 is greyed out in the list of reports ("Deletion reserved for the person who
started this test and the instructor", also said on click and to screen readers), the scenario tree offers neither
delete nor drag on another account's plan and shows its author ("by <account>"), the editor opens it read-only (fields
disabled), and the API answers 403 (error.report.not_owner, error.scenario.not_owner, which invites to rename
one's file to upload one's own). The list of reports shows the plan and the starter of each shot. A report or a plan
older than this rule, or put in the folder by hand, has no known author: only the instructor deletes it
(error.scenario.owner_unknown). On a case-sensitive folder (Linux, NAS), a name that differs from an existing plan by
letter case only is refused to everyone: 409 error.scenario.name_taken_case, with no offer to replace. The owners
are kept in jmeter/results/<shot>.owner.json and in jmeter/scenarios/.owners.json and jmeter/scripts/.owners.json
(ignored by git); an unreadable registry is set aside (.owners.json.illisible-<timestamp>), never rewritten, and its
plans stay the instructor's. After a rollback of the fix, delete these two registries before applying it again: they
would credit the former author with a plan replaced in the meantime.
Limit: a plan written to harm
The results folder stays writable from a plan (the JMeter container writes its results there, and
.runstate.json): a plan crafted to harm can delete another's report there, or rewrite its owner file before
deleting it through the API. The rule stops deletions through the interface, not a plan written for that. Keeping
finished reports out of that folder belongs to the hardening.
The shipped plans open read-only in the JMeter UI editor (a form, without the XML); their full file can be read in
Forgejo, without an account: repository perfshop-ci/perfshop-tests, folder jmeter/scenarios/ (see
Forgejo).
State recovery on restart¶
At startup, server.js calls await recoverRunState() (defined in jmeter.js, line 520). This function:
- Reads a persistence file that records the state of the last running shot
- If a shot was active at the UI container crash, queries Docker to check whether it is still running in
perfshop-jmeter - If so, reattaches the UI to that shot (the student finds their running shot again after a UI service restart)
- If not, marks the shot as cleanly terminated
This is the standard cross-container resilience pattern: the live state (the shot) lives in one container, the metadata state (who, when, which JMX) lives in the other, and synchronization happens at startup.
Full shot flow¶
sequenceDiagram
autonumber
actor F as Instructor
participant UI as Browser<br/>(jmeter-ui)
participant SRV as perfshop-jmeter-ui<br/>(Node)
participant SOCK as perfshop-docker-relay<br/>(Docker relay)
participant JM as perfshop-jmeter<br/>(idle)
participant PROM as prometheus
participant LOKI as loki
participant GRAF as grafana
F->>UI: Login (email/password)
UI->>SRV: POST /api/auth/login
SRV-->>UI: 200 + session cookie
F->>UI: Selects scenario.jmx
UI->>SRV: GET /api/scenarios/tree
SRV-->>UI: JMX tree
F->>UI: Clicks "Launch"
UI->>SRV: POST /api/run {script: "Master/full-chaos-master.jmx", virtualUsers, durationSec, …}
SRV->>SOCK: docker exec perfshop-jmeter jmeter -n -t /scenarios/... -l /results/...
SOCK->>JM: exec
JM->>JM: Starts the shot
JM->>PROM: exposes :9270/metrics (Prometheus plugin)
loop During the shot
UI->>SRV: GET /api/status (polling)
SRV-->>UI: {running: true, elapsed, ...}
UI->>SRV: GET /api/metrics-live
SRV->>PROM: PromQL on jmeter_*
PROM-->>SRV: metrics
SRV-->>UI: {tps, latency_p95, errors, ...}
UI->>SRV: GET /api/logs
SRV->>JM: tail of jmeter.log (command in the container, via the relay)
JM-->>SRV: log lines
SRV-->>UI: recent logs
end
Note over JM,LOKI: In parallel, Promtail reads /jmeter-logs/jmeter.log<br/>and pushes it to Loki (static_configs job)
JM->>JM: Shot ends, HTML report generated in /results
UI->>SRV: GET /api/results
SRV-->>UI: list of reports
F->>UI: Clicks the report → opens HTML in an iframe
F->>GRAF: Opens the perfshop-jmeter-live dashboard
GRAF->>PROM: PromQL (jmeter_*)
GRAF->>LOKI: LogQL ({job="jmeter-log"})
Observability integration¶
Prometheus metrics (during a shot)¶
The JMeter Prometheus Listener plugin exposes, for the entire duration of a shot, an HTTP endpoint :9270/metrics inside the perfshop-jmeter container. Prometheus scrapes this job every 5 seconds with honor_labels: true, which lets the plugin define its own breakdown labels (by sampler name, HTTP code, etc.) without collision with the scrape labels.
The Grafana dashboard perfshop-jmeter-live (22 panels mixing Prometheus and Loki) consumes these metrics directly; details in ../observability/dashboards.md.
Loki logs¶
The ./jmeter/logs/jmeter.log file is read by Promtail through a dedicated static_configs job. The Loki label is {job="jmeter-log"} and lets the jmeter-live dashboard display the latest log lines in real time alongside the latency curves. See ../observability/loki.md.
Vector logs → OpenSearch¶
Vector also collects Docker logs from perfshop-jmeter and indexes them in OpenSearch under perfshop-jmeter* via the service_family = "jmeter" routing rule (vector.toml). See ../observability/opensearch.md.
Further reading¶
- QA overview
- Scripts UI — the same Node + Docker relay pattern, but for driving
perfshop-test-runner perfshop-jmeter-livedashboard- Prometheus and JMeter PromQL