Skip to main content
prescale investigate does everything prescale run does — ramp virtual users, find what breaks first, and report the break point — then goes further. Once the ramp identifies the culprit route, investigate runs an active second-pass probe: baseline vs loaded latency, a static-vs-dynamic comparison, and error/header forensics. The result is a classified bottleneck type, a confidence level, and a concrete list of things to try. The whole process is fully local and deterministic — no LLM, no external service.

Basic usage

Example output

After the ramp, PreScale prints a standard verdict followed by the 🔬 Diagnosis block:
Numbers are illustrative — your results depend on your app and infrastructure.

How it works

investigate runs in two phases:
1

Load ramp

Identical to prescale run: virtual users ramp from 1 to --max-users, holding each level for --stage-seconds. PreScale records throughput, latency percentiles, and error rates at every step and identifies the first level that crosses the latency wall or error threshold.
2

Active diagnosis probe

Once the culprit route is known, PreScale fires a series of targeted probes against it:
  • Baseline vs loaded latency — a single request at 1 user is compared to the culprit’s p95 at peak load. A large delta (e.g. 28 ms vs 2 100 ms) points to a resource that saturates under concurrency.
  • Static vs dynamic comparison — a static asset (CSS, JS, an image) is tested at the same load level. If the static file responds fine while the dynamic route degrades, the problem is inside the application layer, not the network or web server.
  • Error and header forensics — response status codes, Retry-After, X-RateLimit-*, CF-Cache-Status, and similar headers are inspected to narrow down the category (connection pool exhaustion, rate limiting, CDN misconfiguration, etc.).
The evidence is combined into a bottleneck classification with a confidence level, and PreScale emits a prioritised “Try this” list of concrete remediation steps.

Fix prompt

After the diagnosis, investigate prints a fix prompt: plain text to paste into Claude Code, Cursor or any coding agent. It says where it broke, at how many users, the likely cause, the evidence and the fixes, and asks the agent for the smallest change that fixes the cause and to re-run prescale investigate to confirm. It’s built from the run itself, with no model, and never includes response bodies, secrets or credentials from the URL. It’s also in --json and saved runs as fix_prompt, in the HTML report (prescale show <id> --html), and in the PR comment from the GitHub Action.

Journeys

When your repo has journeys in prescale/journeys/, investigate ramps them the way prescale run does, then diagnoses the journey step that breaks first. The step is probed with the journey’s own state: its 1-user latency comes from replaying the journey from the start (log in, add to cart, then place the order), so a step that needs a token or a cart id is measured the way a real user reaches it. The journey’s other steps play the part static assets play for URLs: if they held while this step failed, the limit is something this step uses, such as a database pool.
If the journeys ramped together starved the culprit journey (it broke with fewer of its own users than it held alone), the evidence says so too. If every journey held on its own but they broke ramped together, investigate diagnoses the step that broke in the combined run: that’s journeys competing for something they share. A step that answers an unexpected 4xx under load (a 409, a 401) is classified as unexpected_answer, not as a pool or a queue. The 1-user baseline replays the journey for about 2 seconds after a 1-second pause, within --max-rps; if too few replays reach the step, the evidence says there’s no baseline. --urls investigates URLs instead.

Options

string
The URL to investigate. Optional — if you omit it, PreScale re-investigates the most recent saved run’s target URL. See Re-investigating a saved run below.
integer
default:"200"
Peak virtual users to ramp to during the load phase. PreScale steps through load levels from 1 up to this number, holding each level for --stage-seconds.
float
default:"5.0"
How many seconds to hold each load level before stepping up. Increase this for a more thorough measurement; decrease it for a faster iteration cycle.
string
An extra route to include in the ramp, relative to the base URL (e.g. --path /api/search). Repeatable. The culprit is chosen from all routes tested, and the diagnosis probe focuses on whichever one breaks first.
float
Cap aggregate requests per second across all virtual users. A safety ceiling for shared staging environments. By default there is no cap.
boolean
default:"false"
Skip the interactive confirmation prompt for non-local targets. Required in CI and when using --json. See the Safety note below.
string
Replica mode: start your app with COMMAND (for example "npm run build && npm start"), test it on the local URL, then stop it and everything it started. No host is involved. The URL must be local, and the command is never saved or uploaded. See Replica mode.
float
default:"600"
Seconds to wait for the app started by --app to answer. Production builds can take minutes.
boolean
default:"false"
Confirm you have the host’s permission to load-test the target. Vercel, Netlify and Cloudflare restrict load testing; without this, PreScale asks first, or stops in --json mode. Also set by PRESCALE_HOST_PERMISSION=1. See Host rules.
boolean
default:"false"
Emit the full Result document — including the investigation block — as JSON to stdout instead of the human-readable terminal output.
string
Directory where PreScale reads and writes saved run JSON files. Defaults to ./.prescale. Pass the same value you used with prescale run if you changed the default.
integer
Exit with a non-zero status code if the app survives fewer than N concurrent users. Use this as a CI gate alongside --i-own-this and --json.
string
Investigate only this journey (repeatable). Default: every journey in prescale/journeys/.
boolean
default:"false"
Skip ramping the journeys together, so there’s no interference check.
boolean
default:"false"
Investigate URLs even when prescale/journeys/ has journeys.
string
Let journeys that change data (POST, PUT, PATCH, DELETE) run against this non-local host, e.g. a staging host. Repeatable. Without it, such journeys only run against local hosts.
string
default:"prescale/journeys"
Where the journey files are.

Safety

investigate sends real traffic — a full ramp plus a handful of diagnostic probes — to your target. The same safety rules that apply to prescale run apply here:
  • Local hosts are tested without any prompt.
  • All other hosts show a confirmation panel before the ramp starts.
  • Hosts that restrict load testing (Vercel, Netlify, Cloudflare) get no load until you confirm you have the host’s permission. See Host rules.
Pass --i-own-this to skip the prompt in CI or --json mode, and --host-permission for a restricted host you have permission for. Or test your app’s own build locally with Replica mode and skip all three.
Always point prescale investigate at a staging or preview URL, not production, unless you fully understand the traffic volume it will generate.

Re-investigating a saved run

Run prescale investigate with no URL and it looks up the most recent saved run in .prescale/runs/, reads its target URL, and re-investigates it:
This is useful when you’ve already run prescale run and want a deeper diagnosis without typing the URL again, or when you want to check whether a fix you deployed has changed the bottleneck classification. If you store runs in a non-default directory, pass --store DIR so PreScale knows where to look:
The Bottleneck Types reference page at reference/bottleneck-types describes every classification PreScale can emit — what each bottleneck means, how it is detected, and what “high / medium / low confidence” signifies.