load-testing-overview
Teaches load and performance testing from zero: a tool-selection table choosing between k6, JMeter, Gatling, Locust, and Artillery from observable project facts; the six load profiles (smoke, average-load, stress, spike, soak, breakpoint); open vs closed workload models; why percentiles beat averages; turning a run into a pass/fail CI gate with a first runnable k6 script; a performance-incident triage workflow (confirm with a k6 smoke run, flame-graph the hot path, check slow queries, localize the cause); and full Gatling (Simulation DSL, injectOpen/injectClosed, setUp().assertions()) and Locust (HttpUser + @task locustfile, headless / distributed runs, CSV gating) deep dives in references. Use when a service needs performance coverage and the tool, load profile, or pass/fail threshold has not been decided yet, or when a live performance incident needs cause localization.
Install with skills.sh (any agent)
npx skills add testland/qa --skill load-testing-overviewload-testing-overview
Load testing drives concurrent, sustained traffic at a deployed system and measures what happens to response time, throughput, and errors while that traffic runs. It assumes correctness and asks whether the system stays fast and correct under load, and where it stops being either. It needs a deployed environment, realistic data volumes, and a real network path; run one against a laptop dev server and you measured the laptop.
Pick a tool from what is already in the repo
Five tools cover almost every case. Read the table top to bottom and stop at the first row that is true of your project. The rows are ordered so that hard constraints (protocol, who authors the tests) beat preferences (language).
| Observable fact about your project | Pick | Why |
|---|---|---|
| You must generate load over JDBC, JMS, LDAP, FTP, SMTP/POP3/IMAP, TCP, or raw shell commands, not only HTTP | JMeter | It is the only one of the five with those built in: JMeter lists Web HTTP/HTTPS, "SOAP / REST Webservices", FTP, "Database via JDBC", LDAP, "Message-oriented middleware (MOM) via JMS", "Mail - SMTP(S), POP3(S) and IMAP(S)", "Native commands or shell scripts", and TCP (JMeter home (opens in new window)) |
| Non-programmers (manual QA, ops) must build and maintain the tests themselves | JMeter | It is "a 100% pure Java application" with a "Full featured Test IDE" GUI for recording and building plans (JMeter home (opens in new window)) |
| The team's build is Maven, Gradle, or sbt and the testers are JVM developers | Gatling | "Since 3.7, Gatling supports writing tests in Java, Scala, and Kotlin" and installs through those build tools (Gatling install (opens in new window)) |
| The test logic needs arbitrary Python (an internal SDK, pandas, a crypto lib) | Locust | Tests are plain Python: from locust import HttpUser, task in a locustfile.py (Locust quickstart (opens in new window)) |
| You want the load profile declared as data, not code, and Node is already installed | Artillery | The test script is YAML: config.phases "defines how Artillery generates new virtual users (VUs) in a specified time period" (Artillery test script (opens in new window)) |
| Anything else: HTTP/gRPC/WebSocket service, JS or TS team, tests must live in git | k6 | Scripts are JavaScript, the runner is a single binary, and it natively supports HTTP/1.1, HTTP/2, WebSockets, and gRPC (k6 protocols (opens in new window)) |
Two follow-on constraints that change the answer:
If you truly have no constraint, choose k6. It has the shortest path from zero to a failing build, which is the only path that matters at the start.
When the table lands on Gatling or Locust, the full authoring deep dive lives in this skill: references/gatling.md (Simulation class DSL, injectOpen vs injectClosed, setUp().assertions() as the CI gate, Maven/Gradle/sbt runs) and references/locust.md (HttpUser + @task locustfile structure, headless and distributed runs, CSV-based CI gating). For k6 and JMeter, use the dedicated k6-load-testing and jmeter-load-testing skills.
The six load profiles
Newcomers say "load test" for all six of these and then argue past each other. Each name answers a different question, and the profiles are defined by k6 as follows (k6 test types (opens in new window)):
| Profile | Question it answers | Shape |
|---|---|---|
| Smoke | Does the script itself work, and is the system sane at trivial load? | Low VUs, seconds to a couple of minutes |
| Average-load | How does the system behave under expected normal conditions? | Average production VUs, 5 to 60 minutes |
| Stress | What happens when demand exceeds the expected average? | VUs above average, 5 to 60 minutes |
| Spike | Does the system survive a sudden, short, massive surge? | Very high VUs, a few minutes |
| Soak (endurance) | Is it still reliable after hours of continuous operation? | Average VUs, hours |
| Breakpoint | Where is the capacity ceiling? | Ramp up incrementally until it breaks |
Two of these are routinely confused. Stress holds an above-average load steady and watches how the system copes; breakpoint keeps increasing load until the system fails, so its output is a number (the ceiling), not a verdict. Soak uses ordinary load and long duration on purpose: it exists to catch memory leaks, connection-pool exhaustion, and log-disk growth, which a 10-minute run cannot see.
Run smoke first, always. A broken script under 300 VUs produces a very convincing graph of nothing.
Open vs closed workload models
This is the single most misunderstood idea in the field, and it decides whether your numbers mean anything.
Why it matters: under a closed model, when the system slows down, your test automatically applies less load, which hides the problem exactly when it starts. k6 names this: "In some testing literature, this problem is known as coordinated omission" (k6 open vs closed (opens in new window)).
Real user traffic on a public web service is open (people keep arriving whether or not you are coping); Gatling frames it the same way, noting open systems "have no control over the number of concurrent users" while closed systems cap that number (Gatling workload models (opens in new window)). Closed is the right model for a fixed-size worker pool, a call-centre queue, or a system behind a hard concurrency limit.
For how each tool names its open and closed executors, and the Gatling "users means open, not closed" trap spelled out, see references/tool-executors.md.
Run your first test with k6
Install (k6 install (opens in new window)):
brew install k6 # macOS
choco install k6 # Windows, Chocolatey
winget install k6 --source winget # Windows, winget
docker pull grafana/k6 # any platformWrite script.js:
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
vus: 10,
duration: '30s',
thresholds: {
http_req_duration: ['p(95)<500'], // 95th percentile under 500ms
http_req_failed: ['rate<0.01'], // under 1% failed requests
},
};
export default function () {
const res = http.get('https://your-service.example.com/health');
check(res, { 'status 200': (r) => r.status === 200 });
sleep(1);
}Run it (k6 running (opens in new window)):
k6 run script.js
k6 run --vus 10 --duration 30s script.js # same shape, set from the CLIWhat success looks like: a live progress table during the run, then an end-of-run summary in which every threshold line is marked with a green check. http_req_duration reports avg, min, med, max, p(90), and p(95) (k6 metrics (opens in new window)). If any threshold fails, "the little green checkmark next to the threshold name would be a red cross and k6 would exit with a non-zero exit code" (k6 thresholds (opens in new window)). That non-zero exit is your entire CI gate: no plugin, no parser, no dashboard.
That first run is a smoke test. Only after it is green should you raise VUs or switch to an arrival-rate executor.
Percentiles, not averages
Report and gate on percentiles. An average response time is a single number produced by summing everything and dividing, so a handful of 8-second requests disappear into thousands of 40ms ones. The p95 and p99 are the response times that 5% and 1% of requests exceeded, which is the experience of your slowest users and, on a page that makes 20 backend calls, the experience of most sessions.
This is why every tool in the list exposes percentiles as first-class threshold targets: k6 with http_req_duration: ['p(95)<200'] (k6 thresholds (opens in new window)) and Artillery with p95: 200 in its ensure block (Artillery ensure (opens in new window)).
Practical rules, which are practitioner convention rather than a documented standard:
A test without a threshold is just a graph
If a run cannot fail, nobody will ever act on it. Define the pass/fail budget before the run, and derive the numbers from your service level objectives, not from whatever the first run happened to produce.
k6 states this directly: "Thresholds are the pass/fail criteria that you define for your test metrics. If the performance of the system under test (SUT) does not meet the conditions of your threshold, the test finishes with a failed status" (k6 thresholds (opens in new window)). Set abortOnFail on a threshold to stop the run the moment the condition goes false instead of burning the full duration (k6 thresholds (opens in new window)).
Artillery's ensure extension is the same idea in YAML: "Artillery can validate if a metric's value meets a predefined threshold. If it doesn't, it will exit with a non-zero exit code" (Artillery ensure (opens in new window)).
The k6 guidance on where to run these is worth taking seriously: "As a general rule on pre-release environments, we should run our larger tests with quality gates, Pass/Fail criteria that validate SLOs or reliability goals," but "Unless your verification process is mature, do not rely entirely on Pass/Fail results to guarantee the reliability of releases" (k6 automated performance testing (opens in new window)). Gate the short smoke and average-load runs in CI; run stress, spike, soak, and breakpoint on a schedule against a dedicated environment.
Performance incident workflow
When an alert, APM spike, or customer report signals a live performance incident, the goal is to localize the dominant cause under time pressure. Required inputs: the affected endpoint (or service name) plus the observed symptom (p95 latency, error rate, CPU saturation, or DB load). Do not proceed without an endpoint.
Step 1 - Confirm and reproduce
Run a smoke k6 script against the affected endpoint to confirm the symptom is reproducible and measure its current magnitude. Per k6 running docs (opens in new window), a minimal confirmation run with a thresholds block:
export const options = {
stages: [{ duration: '60s', target: 20 }],
thresholds: {
http_req_duration: ['p(95)<500'],
http_req_failed: ['rate<0.01'],
},
};Run it with --summary-export=summary.json --quiet and parse the result:
jq -r '.metrics | to_entries[] | select(.value.thresholds) | .key + ": " + (.value.thresholds | to_entries | map("\(.key) -> \(if .value.ok then "PASS" else "FAIL" end)") | join(", "))' summary.jsonPer k6 thresholds docs (opens in new window), a non-zero exit and "ok": false on a threshold confirms the regression is deterministic before investing in deeper diagnosis. If the run passes all thresholds, the incident may be intermittent or already resolved - state that explicitly and stop.
Step 2 - Flame-graph the hot path
With the service running under the k6 load from Step 1, capture a CPU profile using flame-graph-analyzer: run the runtime-appropriate profiler (py-spy / async-profiler / Go pprof / clinic.js flame) for 30 seconds under live load, sort folded stacks by sample count, surface the top 5 leaf frames, and classify each (CPU-bound hot algo, allocator pressure, lock contention, reflection overhead). The widest leaf in the flame graph is the hot path per Brendan Gregg's canonical flame-graph reference (opens in new window). If the flame graph shows DB-bound frames (e.g. pg_send_query_blocking, mysql_send_query) as the dominant cost, the bottleneck is database-side - proceed directly to Step 3 and skip app-side remediation. If a flame graph cannot be captured (no profiler available, no access to the process), state the blocker; do not guess the hot path from code review alone.
Step 3 - Detect slow queries
If Step 2 points to DB-bound cost (or is inconclusive), use db-query-plan-analyzer: capture EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON, SETTINGS) for the suspect query (PostgreSQL) or EXPLAIN ANALYZE (MySQL 8.0+) per pg-explain docs (opens in new window), identify the dominant plan node (Seq Scan, Sort spill, Nested Loop with high inner-side row count), and emit the candidate CREATE INDEX or query rewrite. Find the hottest node with jq:
jq '[.. | objects | select(.["Node Type"] and .["Actual Total Time"]) | {node: .["Node Type"], time: .["Actual Total Time"]}] | sort_by(-.time) | .[0]' plan.jsonStep 4 - Localize and recommend
Combine the k6 confirmation delta, the flame-graph top frame, and the slow-query plan node into a single cause statement, one of:
Emit a triage report: symptom confirmed (observed vs budget), flame-graph findings table (rank, sample share, leaf stack, category), slow-query findings if DB-bound, the localized cause paragraph, and recommended actions ordered by impact - ending with a re-run of the k6 confirmation test after the fix. If the cause is still inconclusive after Steps 2 and 3, the introducing commit is unknown: hand off to the regression-bisector agent (qa-flake-triage) in its perf-measurement mode to bisect for it.
Traps that catch newcomers first
The seven mistakes that most often invalidate a first effort - load testing the generator itself, running JMeter's GUI as the generator, one URL / one account, presenting a closed-model VU count as capacity, skipping warm-up, extrapolating from a scaled-down environment, and recording latency without error rate - are detailed with citations in references/traps.md.
Related skills
Optional deeper dives, if you have them installed: k6-load-testing (including latency-percentile interpretation in its references), jmeter-load-testing, flame-graph-analyzer, db-query-plan-analyzer. Gatling and Locust deep dives live in this skill's references/gatling.md and references/locust.md.
Gatling deep dive
View source (opens in new window)Gatling deep dive
Gatling tests are Simulation classes in Java / Kotlin / Scala / JS / TS that compose http() / scenario() / exec() DSL builders and run via the Gatling Maven / Gradle / sbt plugin (per gatling-tutorial (opens in new window)). Supported protocols span HTTP, WebSocket, Server-Sent Events, JMS, gRPC, and MQTT (gatling-readme (opens in new window)).
Install
The current version + matching plugin is documented at docs.gatling.io (opens in new window) - pin to a specific release rather than LATEST. Minimum Maven dependencies: the Gatling Maven plugin (build) plus gatling-charts-highcharts (test scope, for HTML report generation). For Gradle / sbt, the equivalents are gatling-gradle-plugin and sbt-gatling. See gatling-tutorial (opens in new window) for the canonical project-init flow.
Simulation class structure
Per gatling-tutorial (opens in new window), every Gatling test extends Simulation and uses three DSL builders:
| Builder | Purpose |
|---|---|
http(...) | HTTP protocol config: base URL, default headers, share-connection settings. |
scenario(...) | A named sequence of user actions. |
exec(...) | Executes one request or a chain of actions within a scenario. |
Java example:
package com.example.load;
import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;
import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;
public class OrdersSimulation extends Simulation {
HttpProtocolBuilder httpProtocol = http
.baseUrl("https://staging.example.com")
.acceptHeader("application/json")
.header("Authorization", "Bearer " + System.getenv("API_TOKEN"));
ScenarioBuilder ordersScenario = scenario("Order lifecycle")
.exec(
http("Create order")
.post("/orders")
.body(StringBody("{\"sku\":\"SKU-1\",\"qty\":2}"))
.check(status().is(201))
.check(jsonPath("$.order_id").saveAs("orderId"))
)
.pause(1)
.exec(
http("Read order")
.get("/orders/#{orderId}")
.check(status().is(200))
);
{
setUp(
ordersScenario.injectOpen(
rampUsersPerSec(1).to(20).during(Duration.ofMinutes(1)),
constantUsersPerSec(20).during(Duration.ofMinutes(2))
)
)
.protocols(httpProtocol)
.assertions(
global().responseTime().percentile(95).lt(500),
global().failedRequests().percent().lt(1.0)
);
}
}(Adapted from gatling-tutorial (opens in new window) DSL primitives.)
Injection profiles
Per gatling-tutorial (opens in new window):
Open workload - injectOpen. New users arrive continuously during the test window. Use when modeling realistic traffic that doesn't depend on user response time.
ordersScenario.injectOpen(
nothingFor(Duration.ofSeconds(5)), // warmup grace
rampUsersPerSec(1).to(50).during(Duration.ofMinutes(1)), // ramp to 50 RPS over 1 min
constantUsersPerSec(50).during(Duration.ofMinutes(5)) // hold 50 RPS for 5 min
)Closed workload - injectClosed. A fixed pool of users repeats actions. Use when modeling sessions / connection-pool behavior where total concurrency matters more than arrival rate.
ordersScenario.injectClosed(
rampConcurrentUsers(0).to(100).during(Duration.ofMinutes(1)),
constantConcurrentUsers(100).during(Duration.ofMinutes(5))
)Most public APIs are Open; session-bound systems (databases, video streams) are Closed.
Assertions
Per gatling-tutorial (opens in new window), setUp().assertions(...) defines the CI gate criteria. Every assertion is a chain of selectors:
| Selector | What it asserts |
|---|---|
global().responseTime().percentile(95).lt(500) | Global p95 response time < 500 ms. |
global().failedRequests().percent().lt(1.0) | < 1% of requests failed globally. |
details("Create order").requestsPerSec().gte(20) | Specific request name throughput. |
forAll().responseTime().mean().lt(300) | Mean across every named request < 300ms. |
Failed assertions cause Gatling to exit non-zero - the canonical CI gate.
Running
mvn gatling:test # Maven: all simulations
mvn gatling:test -Dgatling.simulationClass=com.example.load.OrdersSimulation
./gradlew gatlingRun # Gradle: all
./gradlew gatlingRun-com.example.load.OrdersSimulation # Gradle: one
sbt 'Gatling/test' # sbt (Scala)The Maven plugin places HTML reports under target/gatling/<simulation>-<timestamp>/.
Reports
Per gatling-readme (opens in new window), each run produces an HTML report under <output>/<simulation>-<timestamp>/index.html with per-request response-time distributions and percentiles, a throughput timeline, an active-users-over-time chart, and pass/fail status per assertion. For machine-readable output, parse <output>/.../js/stats.json - it contains the same data the HTML report renders.
CI integration
A GitHub Actions workflow that runs the Gatling Maven build on pull requests touching simulation files and on a nightly schedule. A failed setUp().assertions(...) exits the Maven build non-zero and fails the job; the HTML report is uploaded regardless via if: always().
# .github/workflows/gatling.yml
name: load-test
on:
pull_request:
paths: ['src/test/java/**/*Simulation.java']
schedule:
- cron: '0 4 * * *'
jobs:
gatling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Run Gatling
env:
API_TOKEN: ${{ secrets.STAGING_API_TOKEN }}
run: mvn -B gatling:test
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
with:
name: gatling-report
path: target/gatling/
retention-days: 14For Gradle, swap the run step for ./gradlew gatlingRun; for sbt, sbt 'Gatling/test'.
Anti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
Using injectClosed for an open-traffic API | Models the wrong system; results don't predict prod behavior. | Match the workload model: open API -> injectOpen; session-bound -> injectClosed. |
| Hardcoded URLs / tokens in the Simulation | Tests bind to one environment. | System.getenv("API_BASE_URL") + System.getenv("API_TOKEN"). |
Missing pause() between requests | Hammering at full rate doesn't model real users. | pause(1) or pause(Duration.ofSeconds(1), Duration.ofSeconds(3)) for randomized think time. |
Asserting only failedRequests | A 30-second response that succeeds passes the gate but breaks UX. | Always pair with percentile latency assertions. |
Open-workload with rampUsersPerSec(0).to(1000) over 10s | Synthetic spike; not realistic; client-side bottlenecks corrupt metrics. | Realistic warm-up then sustained load; spike tests are a separate scenario. |
| Saving auth-token discovery inside the scenario | Each VU re-authenticates on every iteration; auth endpoint becomes the bottleneck. | Authenticate once in before { ... } block; share the token across the whole simulation. |
Limitations
References
Locust deep dive
View source (opens in new window)Locust deep dive
Locust tests are Python classes inheriting from HttpUser; each @task-decorated method is an action a virtual user can take (locust-quickstart (opens in new window)). Workflow: write locustfile.py, run locust, observe the live dashboard or run headless for CI.
Install
pip install locust(Per locust-quickstart (opens in new window), current stable is the 2.x series.) For a per-project install (preferred for CI determinism):
pip install -r requirements-load.txt # contains 'locust>=2.43'Authoring
Minimal locustfile
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 3) # 1-3 seconds between tasks per user
def on_start(self):
# Runs once per virtual user when they start
self.client.post("/login", json={"user": "test", "pass": "secret"})
@task
def index_page(self):
self.client.get("/")
@task(3) # weighted - runs 3x as often as unweighted tasks
def view_item(self):
self.client.get("/items/42")(Adapted from locust-quickstart (opens in new window).)
| Construct | Purpose |
|---|---|
HttpUser | Base class; provides self.client (a Requests-style HTTP client). |
@task | Marks a method as a callable VU action. |
@task(N) | Weighted task - gets N "lottery tickets" vs. unweighted's 1. |
wait_time = between(min, max) | Random pause between tasks per VU. |
on_start(self) | Runs once per VU at startup (auth, session setup). |
on_stop(self) | Runs once per VU before exit (cleanup). |
self.client.<verb>(...) | Standard Requests-like methods that auto-track latency / errors. |
Naming requests for clean stats
The default request name is the URL path; for parameterized URLs use the name= kwarg to keep the stats grouped:
@task
def view_item(self):
item_id = random.randint(1, 1000)
# name= rolls /items/42, /items/43, ... up under one "/items/[id]" row
self.client.get(f"/items/{item_id}", name="/items/[id]")Without name=, the stats table fragments into thousands of near-duplicate rows.
Running
Interactive (Web UI)
locust -f locustfile.pyOpen http://localhost:8089; configure VU count + spawn rate + host in the browser; observe the live charts. The default mode for authoring / tuning.
Headless (CI)
Per locust-quickstart (opens in new window):
locust --headless --users 10 --spawn-rate 1 -H http://your-server.com| Flag | Purpose |
|---|---|
--headless | Run without the web UI (CI mode). |
--users <N> | Peak concurrent users. |
--spawn-rate <N> | Users spawned per second until peak is reached. |
--host <url> | Target host (override host attribute on the user class). |
--run-time <dur> | Total run duration (e.g. 5m, 30s); auto-stops at expiry. |
--csv <prefix> | Write <prefix>_stats.csv, <prefix>_stats_history.csv, <prefix>_failures.csv, <prefix>_exceptions.csv. |
--html <file> | Write a final HTML report. |
A typical CI invocation:
locust -f locustfile.py \
--headless \
--users 100 \
--spawn-rate 10 \
--run-time 5m \
--host https://staging.example.com \
--csv results \
--html report.html \
--exit-code-on-error 1--exit-code-on-error 1 tells Locust to exit non-zero if any request failed during the run - the canonical CI gate.
Distributed mode
Per locust-quickstart (opens in new window):
# On the master node
locust -f locustfile.py --master --headless --users 1000 --spawn-rate 50 --host https://staging.example.com
# On each worker node
locust -f locustfile.py --worker --master-host master.internalThe master coordinates; workers generate the actual load. Use this when a single machine can't generate enough VUs (typically beyond ~1000 VUs depending on the target's response time and the worker's CPU).
Reports
Locust outputs three CSVs on --csv <prefix>:
| File | Content |
|---|---|
<prefix>_stats.csv | Aggregate per-request stats: count, avg, p50, p90, p95, p99. |
<prefix>_stats_history.csv | Per-second time-series of the same metrics. |
<prefix>_failures.csv | Per-failure rows: name, reason, count. |
<prefix>_exceptions.csv | Python exception stacks (if any task raised). |
The HTML report (--html) renders charts from the same data - for human review.
CI integration
# .github/workflows/locust.yml
name: load-test
on:
pull_request:
paths: ['tests/load/**']
schedule:
- cron: '0 4 * * *'
jobs:
locust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install locust
- name: Run Locust headless
env:
API_TOKEN: ${{ secrets.STAGING_API_TOKEN }}
run: |
locust -f tests/load/locustfile.py \
--headless \
--users 50 \
--spawn-rate 5 \
--run-time 3m \
--host https://staging.example.com \
--csv results \
--html report.html \
--exit-code-on-error 1
- name: Custom threshold gate
run: |
# Fail if p95 > 500ms on any endpoint
python - <<'PY'
import csv, sys
with open('results_stats.csv') as f:
for row in csv.DictReader(f):
if row['Name'] == 'Aggregated':
continue
p95 = float(row['95%'])
if p95 > 500:
print(f"::error::p95 {p95}ms on {row['Name']} (>500 budget)")
sys.exit(1)
PY
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: locust-reports
path: |
results_stats.csv
results_stats_history.csv
results_failures.csv
report.html
retention-days: 14The custom Python gate parses results_stats.csv - Locust's --exit-code-on-error only fails on errors; latency budgets need the post-run check.
Anti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Hardcoded URLs in the locustfile | Tests bind to one environment. | Read host from os.environ or pass via -H. |
Missing name= on parameterized URLs | Stats fragment into 1000s of rows; reports unreadable. | Always specify name= for variable URL segments. |
Low wait_time to "stress more" | Hammering at full rate doesn't model real users; client CPU saturates. | Use between(1, 3) or longer; if the goal is a target RPS, use --users × wait_time to compute. |
| Running interactive (Web UI) in CI | Locust waits for the user to click "Start swarming"; CI hangs. | Always --headless with --users / --spawn-rate / --run-time. |
Skipping --exit-code-on-error | Locust exits 0 even with failures; CI sees green. | Always include the flag. |
| Single-master 1000+ VUs from one machine | CPU saturates the load generator before the target. | Distribute via --master / --worker. |
Limitations
References
How each tool expresses open vs closed workload models
View source (opens in new window)How each tool expresses open vs closed workload models
Open holds arrival rate constant; closed holds concurrency constant. This table maps the two models onto the five tools, with the exact executor / injection names each one uses.
| Tool | Open (arrival rate held constant) | Closed (concurrency held constant) |
|---|---|---|
| k6 | constant-arrival-rate, ramping-arrival-rate | constant-vus, ramping-vus, shared-iterations, per-vu-iterations (k6 executors (opens in new window)) |
| Gatling | injectOpen(...) with atOnceUsers(nbUsers), rampUsers(nbUsers).during(duration), constantUsersPerSec(rate).during(duration), rampUsersPerSec(rate1).to(rate2).during(duration), stressPeakUsers(nbUsers).during(duration) | injectClosed(...) with constantConcurrentUsers(nbUsers).during(duration), rampConcurrentUsers(fromNbUsers).to(toNbUsers).during(duration) (Gatling injection (opens in new window)) |
| Artillery | arrivalRate (new VUs per second), rampTo, arrivalCount (Artillery test script (opens in new window)) | not the native model |
| JMeter | not the native model | Thread Group: a thread count, a ramp-up period, and a loop count, where "Each thread will execute the test plan in its entirety and completely independently of other test threads" (JMeter test plan (opens in new window)) |
| Locust | approximated with constant_throughput wait time, "an adaptive time that ensures the task runs (at most) X times per second" (Locust locustfile (opens in new window)) | the default: a fixed user count plus wait_time |
The Gatling trap, spelled out
rampUsers(n).during(d) and atOnceUsers(n) are open model profiles despite the word "users": they inject n users into the system over the window and never cap how many are inside at once. The closed equivalents are the ones with "Concurrent" in the name, constantConcurrentUsers and rampConcurrentUsers, and they live under injectClosed (Gatling injection (opens in new window)). The two families cannot be mixed in one injection profile.
Traps that catch newcomers first
View source (opens in new window)Traps that catch newcomers first
The mistakes that most often invalidate a first load-testing effort. Each one produces numbers that look real but measure the wrong thing.
Related skills
db-query-plan-analyzer
Reads `EXPLAIN` / `EXPLAIN ANALYZE` output from PostgreSQL, MySQL, or SQLite - identifies the dominant cost (sequential scan, nested loop, sort spill, missing index, type-cast preventing index use), proposes the specific index or query rewrite to fix it, and emits the candidate `CREATE INDEX` statement. Use when load testing or production telemetry shows the database as the bottleneck and the team needs targeted query-level remediation.
flame-graph-analyzer
Reads CPU flame-graph output from py-spy (Python), async-profiler (JVM), Go pprof, or Node.js `perf_hooks` / clinic.js: identifies the hot path (top sample-time frames), classifies the bottleneck (CPU-bound vs lock contention vs allocator pressure), and proposes the next investigation step. Use when a perf regression is bisected to a commit but the hot path inside it is unclear; for tail-latency percentiles use the latency-percentiles reference in k6-load-testing, and for a slow SQL hot path use db-query-plan-analyzer.
jmeter-load-testing
Authors Apache JMeter `.jmx` test plans (Thread Groups + HTTP samplers + assertions + listeners) in the JMeter GUI, runs them headlessly via `jmeter -n -t plan.jmx -l results.jtl`, generates an HTML dashboard with `-e -o`, and gates CI on JTL parsing. Use when the project has an existing JMeter investment, needs JVM-native load tooling, or works in domains with strong JMeter community support (banking, telecom, enterprise).
k6-load-testing
Authors k6 JavaScript load-test scripts (VU loops + checks + sleeps), configures the `options` block with `stages` (ramp-up patterns) and `thresholds` (p(95) latency, error rate), runs via `k6 run script.js` or `--vus / --duration` ad-hoc flags, and uses thresholds as the CI pass/fail signal. Includes a latency-percentile interpretation reference: tail ratio (p99/p50), bimodal-distribution detection, coordinated omission and why naive p99 is optimistic, and constant-vus vs constant-arrival-rate executors. Use when the project ships HTTP / WebSocket / gRPC load tests and the team wants developer-friendly JavaScript authoring, or when a k6 threshold passes but the system still feels slow.
lighthouse-perf
Configures Lighthouse CI (`@lhci/cli`) to audit Web Vitals (LCP, INP, CLS) on every PR, asserts against canonical thresholds (LCP ≤2.5s, INP ≤200ms, CLS ≤0.1 at the 75th percentile), uploads Lighthouse reports as build artifacts, and posts deltas as PR comments. Includes a budget-authoring reference: per-route LCP/INP/CLS thresholds by traffic class (cached / dynamic / api-heavy / form-heavy / media-heavy) via `assertMatrix`, plus `budget.json` resource-size caps (JS / CSS / images / total bytes). Use when the project ships a web frontend and the team needs continuous Web Vitals monitoring tied to PR gating, or needs its first Lighthouse budgets drafted.
perf-budget-gate
Builds a unified release-readiness gate that aggregates verdicts from any combination of k6 / JMeter / Gatling / Locust load runners and Lighthouse CI Web Vitals, applies severity-aware pass/fail thresholds, and emits a single go / no-go decision with per-metric deltas vs the main-branch baseline. Posts the delta as a PR comment when the team has the integration set up. Use when authoring a CI step that gates a deployment on cross-runner perf compatibility.
slo-load-test-plan
Turns a service's SLOs and endpoint traffic mix into a named scenario matrix: one scenario per SLO boundary condition, a load profile (smoke, average-load, stress, soak, spike, breakpoint) per scenario, an open or closed workload injection model, a threshold expression derived from the SLO the scenario guards, and an error-budget calculation that sets the soak run's failure allowance. Stays runner-agnostic and fixes the pass/fail line before any tool is configured. Use when an SLO document and an endpoint list both exist but nobody has decided which load runs to make, what shape of load each carries, or what number would count as a failure.
web-vitals-inp-deep
Deep INP (Interaction to Next Paint) testing: decomposes input delay, processing duration, and presentation delay via the web-vitals/attribution build, asserts per-interaction INP budgets in Playwright using PerformanceObserver plus the web-vitals visibilitychange flush, and identifies long tasks blocking the main thread. Use when a page feels unresponsive while LCP and CLS are green, or to gate key interactions (form submit, modal open, route change) under an INP budget in CI. Covers interactions only - for page-load Web Vitals gating use lighthouse-perf; for service-worker cache-strategy latency use the qa-pwa plugin's service-worker skills.