Skip to content

Load Testing

recon load fires one request many times with a fixed number of concurrent workers and reports latency percentiles, status counts and an SLA verdict. Use it for quick local benchmarks and as a CI gate on p99 latency and error rate.

Terminal window
recon load "List Students"
Load Lab: GET http://127.0.0.1:4500/_sandbox/local/v1/students (local) [SLA PASS]
Requests: 100 ok / 0 fail (4536.6 RPS in 0.02s)
Latency (ms): min=0.92 p50=2.04 p95=3.37 p99=3.95 max=4.03

With no -n and no --duration, the CLI sends 100 requests with 10 concurrent workers.

Add SLA budgets to make the exit code meaningful:

Terminal window
recon load "List Students" -n 50 --p99-budget-ms 0.01
Load Lab: GET http://127.0.0.1:4500/_sandbox/local/v1/students (local) [SLA FAIL]
Requests: 50 ok / 0 fail (4113.7 RPS in 0.01s)
Latency (ms): min=0.66 p50=2.23 p95=3.13 p99=3.47 max=3.47
! p99 latency 3.47ms exceeded budget 0.01ms

This exits with code 1.

<TARGET> is a saved request ID or name, or a raw http:// or https:// URL. A raw URL is sent as a GET with no headers or body. The request’s template is resolved once, against --env (default: the workspace default_env), before the run starts. Every request in the run is identical, so values that a template generates are not regenerated per request.

The request’s # @assert lines are evaluated on every response.

Before any request is sent, Recon runs the resolved request through the Outbound Secret Firewall once. If it is blocked, nothing is sent:

Terminal window
recon load "Stripe Prod Key Leak Check" -n 5
error E_FIREWALL_BLOCKED: Blocked secret `PROD_STRIPE_KEY` bound for `api.stripe.com` from being sent to unauthorized host `127.0.0.1`.
hint: Switch environment or update secret allowed_hosts.

Exit code 1.

Recon schedules requests one at a time. Each request waits for a free slot from a pool of -c slots, so at most -c requests are in flight. The run ends when all requests have completed.

With --rps R, request number i (0-based) is not started before i / R seconds after the start. The concurrency limit still applies, so a slow server can keep the rate below R.

Recon starts -c workers. Each worker sends a request, waits for the response, and repeats until the deadline (closed loop). When the first worker reaches the deadline, the others stop after their current request. Requests still in flight at the deadline are allowed to finish and are counted.

With --rps R, workers share one schedule: the i-th request overall waits until i / R seconds after the start. A worker stops when its next slot would fall after the deadline.

Terminal window
recon load "List Students" --duration 2 --rps 25 -c 4 --format json
{
"request_name": "List Students",
"env_name": "local",
"method": "GET",
"url": "http://127.0.0.1:4500/_sandbox/local/v1/students",
"total_requests": 50,
"succeeded": 50,
"failed": 0,
"error_rate": 0.0,
"elapsed_secs": 1.961721399,
"achieved_rps": 25.4878190274561,
"min_ms": 0.432,
"mean_ms": 0.7602599999999999,
"p50_ms": 0.501,
"p90_ms": 1.12,
"p95_ms": 1.79,
"p99_ms": 4.431,
"p999_ms": 4.431,
"max_ms": 4.431,
"status_counts": {
"200": 50
},
"sla_passed": true,
"sla_failures": [],
"firewall_cleared": true
}
You pass Mode
Nothing Count mode, 100 requests.
-n N (N above 0) Count mode, N requests. --duration is ignored if also given.
--duration S only (S above 0) Duration mode.
-n 0 Treated as unset. With --duration, duration mode runs. Without it, 50 requests are sent.
--duration 0 only 50 requests in count mode.

--rps values that are zero, negative or not finite are ignored. -c 0 is raised to 1.

Each request’s latency is measured from just before the send until the full response (or error) is back, in microseconds, and recorded in an HdrHistogram with 3 significant digits. Values are clamped to the range 1 µs to 3600 s.

A request succeeds when its status is below 400 and all of its assertions pass. Everything else fails, including transport errors such as connection refused or timeouts. Transport errors are recorded with status 0.

Field Meaning
request_name Name of the saved request, or GET <url> for a raw URL.
env_name Environment used.
method HTTP method.
url Resolved URL with secret values scrubbed.
total_requests Requests completed.
succeeded Requests with status below 400 and passing assertions.
failed All other requests.
error_rate failed / total_requests, from 0.0 to 1.0.
elapsed_secs Wall time of the run.
achieved_rps total_requests / elapsed_secs.
min_ms, mean_ms Minimum and mean latency.
p50_ms, p90_ms, p95_ms, p99_ms, p999_ms 50th, 90th, 95th, 99th and 99.9th percentile latency.
max_ms Maximum latency.
status_counts Count per status code. 0 means a transport error.
sla_passed true if no SLA budget was exceeded.
sla_failures One message per exceeded budget.
firewall_cleared Always true in a returned report. A blocked request produces an error instead of a report.

Human output shows only min, p50, p95, p99 and max. Use --format json for p90, p99.9, mean and the status counts.

Load runs are not written to the Flight Recorder.

Flag Fails when
--p99-budget-ms <MS> p99_ms is greater than MS. Message: p99 latency <x>ms exceeded budget <y>ms.
--max-error-rate <F> error_rate is greater than F (a fraction, 0.0..=1.0). Message: error rate <x>% exceeded threshold <y>%.
Terminal window
recon load "Create Enrollment" -n 20 -c 5 --env staging --max-error-rate 0.5
Load Lab: POST http://127.0.0.1:4500/_sandbox/staging/v1/enrollments (staging) [SLA FAIL]
Requests: 0 ok / 20 fail (7287.2 RPS in 0.00s)
Latency (ms): min=0.31 p50=0.62 p95=0.78 p99=0.96 max=0.96
! error rate 100.00% exceeded threshold 50.00%
Exit code Meaning
0 Run finished and every configured budget held.
1 A budget was exceeded, or the firewall blocked the request (E_FIREWALL_BLOCKED).
2 The target was not found (E_NOT_FOUND) or another error occurred (E_CLI_RUNTIME), for example a template variable that cannot be resolved.
Terminal window
recon load nothing
error E_NOT_FOUND: request `nothing` not found in collections
hint: Pass a valid HTTP(S) URL or saved request ID/name.
Flag Default Description
<TARGET> required Saved request ID or name, or a raw http(s) URL.
--env <NAME> workspace default_env Environment for template variables.
-n, --requests <N> 100 (when --duration is not set) Total requests.
-c, --concurrency <N> 10 Maximum requests in flight, or number of workers in duration mode.
--duration <SECS> none Run for this many seconds. Used only when -n is not set.
--rps <R> none Pace requests to at most R per second overall.
--p99-budget-ms <MS> none p99 latency budget.
--max-error-rate <F> none Error-rate budget as a fraction.

The global transport flags (--proxy, --ca-cert, --client-cert, -k, --cookies, --cookie-jar and others) apply. The cookie jar is saved after the run. See the CLI Reference.

The CLI applies no environment or host restriction and no upper limit on -n or -c. Only the MCP tool is restricted (see below).

  • Web Studio: the Load Lab tab in the response inspector runs the selected request against the active environment. Fields: Requests (default 50), Concurrency (default 10), Target RPS, p99 SLA (ms), and Max Error %, which is a percentage and is divided by 100 before it is sent. Results show the SLA verdict, achieved RPS, mean and p99 latency, error rate, a percentile chart (min to max, including p90 and p99.9) and status counts, with status 0 shown as ERR. See Web Studio.
  • HTTP API: POST /api/v1/load/run with body {request, env?, config}. config takes concurrency (required inside config), total_requests, duration_secs, target_rps, p99_budget_ms and max_error_rate. If config is omitted, the defaults are 10 concurrent and 50 requests. A firewall block returns the firewall error. See HTTP API.
  • MCP: recon_load_test takes request or url, method, env, total_requests (default 50), concurrency (default 5), p99_budget_ms and max_error_rate. It has no duration or rate options. It rejects total_requests outside 1..=500 and concurrency outside 1..=25 with E_AGENT_POLICY_DENIED. After the normal agent policy check, it allows only loopback targets (localhost, 127.0.0.1, ::1) or environments listed in agent_policy.allow_load_envs, and denies any host in agent_policy.blocked_hosts. See MCP Tools.