Load testing
Point a load test at one request or a whole folder, choose how many virtual users to run and for how long, and watch throughput and latency live. Add thresholds to get a pass or fail verdict. Every run is saved with every request it made, so you can inspect it later, compare it with an earlier run and export it.
A load test sends a lot of traffic. Run it against your own servers, or with the permission of whoever runs them. Many APIs rate limit or block clients that send too much.
Starting a load test
There are three ways to open a load test tab:
- Right click a request or a folder in the sidebar and choose Load test…. The target is picked for you.
- Open the Load tests panel from the activity rail and click New load test.
- Run New load test from the command palette.
Then configure the run and press Start run.
Configuration
| Field | Default | Range | Meaning |
|---|---|---|---|
| Target | Request runs one request. Collection runs every request of a folder, in sidebar order. The box under them opens a menu with a search field: the requests grouped by folder, with their method, or the folders with their number of requests. Type to filter, ↑ ↓ to move and Enter to choose. | ||
| Virtual users | 50 | 1 to 500 | How many users send requests at the same time, once the ramp-up is over. |
| Duration | 60 s | 1 s to 24 h | How long the run lasts, counted from the start, ramp-up included. |
| Ramp-up | 10 s | 0 s to 24 h | How long it takes to start every virtual user. Users start at even intervals: with 50 users and 10 s, one every 200 ms. |
| Think time | 0 ms | 0 to 600,000 ms | The pause each virtual user takes after one pass over the target, before starting the next. |
| Stop on errors | On | Ends the run early when the error rate goes above 5%, once at least 50 requests have completed. | |
| Reuse connections | On | Each virtual user keeps its connection open and reuses it (keep-alive), like a real client. Off, every request opens a new connection and closes it, see connections. |
A value outside its range is brought back into it when the run starts. Load tests use the active environment.
Thresholds
Under Thresholds (“fails the run if missed”) you can set goals that decide whether a run passes. Press Add threshold and pick a metric; the menu lists the metrics that have no row yet, so each metric has at most one threshold. Remove a row with its button.
| Metric | Rule | Unit | Value of a new row |
|---|---|---|---|
| p50 | passes when the median latency is below the limit | ms | 100 |
| p95 | passes when the p95 latency is below the limit | ms | 250 |
| p99 | passes when the p99 latency is below the limit | ms | 500 |
| Errors | passes when the error rate is below the limit | % | 1 |
| Requests/s | passes when the throughput is at least the limit | requests per second | 100 |
A limit is a number of zero or more, with a comma or a period as the decimal separator; the error rate limit cannot be above 100. A row whose text is not a valid limit is ignored when the run starts. A run passes when every threshold is met, over the whole run, and is not passed when any one is missed. Thresholds never stop a run: that is what Stop on errors is for. They are saved with the run, so an old run is checked against the goals it was started with.
How a run works
- Each virtual user is a separate thread that loops over the target: one request, or every request of the folder in order, then the think time, then again, until the duration is over or you press Stop run.
- Every iteration runs the full pipeline: pre-request script, variables, HTTP, post-response script.
- Each virtual user has its own copy of the session variables. A collection that starts with a login request whose post-response script calls
env.set("token", …)works as expected: each user logs in and uses its own token for the next requests. - Requests that use an OAuth 2.0 profile, as their auth or through
oauthToken(), get its token once, before the virtual users start, and every iteration reuses it until it expires, when it is renewed. A load test never opens the browser: with the authorization code grant, sign in first, with Send or Sign in now. - Stopping takes effect in well under a second, even during a long think time.
- With Reuse connections on, each virtual user has its own connections, so 50 users against one server keep about 50 connections open.
- The run happens on your machine. Your own CPU and network are part of the measurement, so for serious numbers use a machine close to the server.
Connections
With Reuse connections on, the default, a virtual user opens a connection with its first request and sends the next ones over it, as browsers and API clients do. Over HTTPS the TLS handshake happens once per user, not once per request, so the run measures your API rather than the cost of connecting.
Turn it off to measure clients that always connect from scratch: every request opens a new connection, with its TCP connect and TLS handshake, and closes it afterwards. Expect fewer requests per second and higher latencies, mostly over HTTPS, and a server that may run out of ports or sockets sooner.
A request to a server whose certificate is not trusted (with Invalid certificates set to Send with warning) is verified once per virtual user, and its later requests are sent without verification straight away.
Reading the results
The results update live while the run is in progress and keep their layout once it ends. Charts, tables and the tabs below work on the whole run, or on a window of it, see Selecting a window.
Header
The header shows the run number (Run #3), a badge with its state, and a line with how the run connected (Keep-alive or New connections) and when it started, as a day and a time (for example “Today 14:32”). The states are Running, Finished (the full duration elapsed) and Stopped (by hand or by Stop on errors). When Start cannot begin a run, because no request or folder is chosen, the folder has no requests or a request cannot be read, an error says why above the results and nothing else changes: the run shown and the entry in the panel keep their state. While the run is in progress the header shows a progress bar; once it ends it shows the Compare with and Export menus.
Verdict
When the run had thresholds and has ended, a strip under the header says Thresholds passed or Not passed followed by how many were missed (“1 of 3”). Next to it there is one chip per threshold with its rule (for example p99 < 50 ms or Requests/s ≥ 1,800), the value the whole run reached, and a check or a cross.
Tabs
The results have four tabs: Summary, Latency, Requests and Errors. Requests and Errors show a count: the requests of the run or window, and the requests that failed. A run saved before Postino kept every request has no detail for the last three tabs and says so, see Run history.
Summary
- Requests/s, p50, p95, p99, Errors, Total
- Six figures. Requests/s is the throughput over the run. p50, p95 and p99 are latency percentiles: p95 is 120 ms means that 95% of requests took 120 ms or less (nearest rank, so every value shown is a latency that actually happened). Errors is the share of requests that failed: a request counts as an error when it timed out, could not be sent, its pre-request script threw, or its status was 400 or higher. Failed tests and post-response script errors are not counted. Total is the number of requests completed. When you compare with another run, each figure also shows its change, colored as better or worse. When a threshold covers a figure, a line under it says goal followed by the rule, green when met and red when missed.
- Performance over time
- A chart with one point per second and two vertical axes, which grows to fill the height the window leaves free under the results: the left one for Requests/s (req/s), the right one for the latencies p50, p95 and p99 (ms). The virtual users are a gray area in the background with no axis of its own: it peaks at half the height of the chart, and labels give its values (“50 VUs” at the end of each plateau, “ramp-up 10 s” at the foot of the ramp). While a run is still ramping up, a label at the live edge shows the count it is ramping up to (“35 → 50 VUs”) and a dashed outline shows the rest of the configured profile. When you compare with another run, a dashed line shows the p95 of that run. A red horizontal line marks each latency threshold (“p95 goal 250 ms”). The legend above the chart turns each series on and off. Hover the chart to see a crosshair and the values of every visible series for that second.
- Per request
- One row per request of the target, with its method, count, p50, p95, p99, error rate and a Status bar: one colored segment per class of status (2xx, 3xx, 4xx, 5xx, then timeouts and failures). Hover the bar to see each status code with its reason, its number of responses and its share. An error rate above 1% is highlighted. The last row, All requests, has the figures of the whole run or window. A run without per request detail has no status bars.
Latency
How the response times of each request are spread. The controls at the top choose what the histogram shows:
- Request: All requests, or one of them. Each request has its own color in the whole tab.
- Linear or Log: the scale of the latency axis. A log axis gives the same room to requests of very different speeds.
- Include errors: off by default, so a fast 429 or a slow timeout does not bend the profile of a request. On the right, the tab says how many responses it counts and how many errors it left out.
- Latency distribution
- A histogram up to the p99.9 of what it shows; the last bar also holds the slower responses. With all requests, the bars are stacked by request and each request's peak is labeled with its name and p50, so a run that mixes a fast and a slow request reads as two profiles instead of one. With one request, the axis zooms to its own range with finer intervals, and dashed lines mark its p50, p95 and p99. On a linear axis the intervals have a round width, shown in the caption (“responses per 50 ms bin”); on a log axis there are 72 of them. Hover an interval to see its range, its responses per request and their share.
- Percentiles
- The count, p50, p90, p95, p99 and slowest response (max) of all requests, then of each one. Click a row to focus that request in the histogram and the curve.
- Latency by percentile
- One line per request, from the fastest response (min) to the p99.9, on log axes: how slow the slowest 10%, 1% and 0.1% of the responses were. A flat line is a request with steady times; a line that climbs at the right has a tail. While a request is focused, the others are dimmed. Hover to read every line at a percentile.
When you compare with another run, the Latency tab shows it too, on the same scale: a dashed outline over the histogram (scaled to this run's number of responses, so the shapes compare; the tooltip adds that run's share), dashed lines in the curve, and under each percentile the change against that run, green when faster and red when slower (“±0” below a millisecond). The other run's saved requests are read in the background, so it shows up a moment after you pick it; a run saved without them is left out of this tab. During a run the Latency tab updates live.
Selecting a window
Once the run has ended, drag across the chart to select a stretch of time, in whole seconds. Everything in the results then covers only that window: the figures, the per request table and its statuses, the Latency, Requests and Errors tabs and their counts. A Window chip next to the tabs shows the range; click the chart or the chip to clear it and go back to the whole run. The threshold verdict always judges the whole run. The window is not available while the run is in progress, or for a run without per request detail.
Requests
Every request the run made, in a table with the columns # (the position in the run), Time (since the start), VU (the virtual user, from 1), Request (method and URL), Status, Latency (with a bar) and Size of the response. Click a header to sort; the default is slowest first, and latency and size start from the largest value. A line shows how many requests match and the column used to sort them. The bar above the table filters:
- Search URL or request matches part of the URL or of the request name, ignoring case.
- A status control: All, one class of status codes (2xx, 4xx, ...) for each class the run had, Timeout and Failed.
- Latency keeps the requests at or above a value (Any, or ≥ a round number of milliseconds based on the run).
- VU keeps the requests of one virtual user.
- Only errors keeps the requests counted as errors.
If nothing matches, the table says No request matches the filters. The table is virtualized, so a long run stays quick to scroll.
Errors
One card for each kind of error in the run or window: an HTTP status (“429 Too Many Requests”), a timeout (“No response in 30 s”) or a failure (“Request failed”). A card shows the number of requests and their share, a small chart of when they happened over the whole run, First · last (the time of the first and the last one), the Affected requests, and an example: the status and the first 160 characters of the body of the first error of that kind (or the error text for a timeout or failure). View requests opens the Requests tab filtered to that status with Only errors on. With no errors the tab says No errors (or No errors in this window).
Comparing runs
The Compare with menu in the header lists the earlier runs of the same target, each with its day and requests per second, and No comparison. Picking a run changes the results in place, there is no separate panel:
- Each figure of the Summary shows its change against that run. Requests/s, latencies and Total change as a percentage of the previous value. The error rate changes in percentage points: going from 2% to 5% is +3 pt.
- Higher is better for Requests/s and Total; lower is better for the latencies and Errors. The change is colored accordingly.
- The chart draws the p95 of that run as a dashed line.
- The Latency tab shows that run on the same scale, see Latency.
- The Markdown and PDF exports say which run they were compared with.
Compare runs with the same configuration, or the difference says more about the settings than about your API.
Exporting
The Export menu saves the run to a file you choose (the suggested name is run-0003.md, with the run number and the extension of the format) and shows a notification with the path when it is done. The files cover the whole run, or only the selected window, see below.
A big run can take a few seconds to export. When an export takes longer than a moment, a window titled Exporting PDF (or the format chosen) shows what it is doing (Computing the statistics, Computing the latencies, Building the PDF, Saving the file), a progress bar with the percent done and a Cancel button. Cancelling stops the export, shows Export cancelled and saves nothing: a file that already had that name is left as it was.
| Format | Content |
|---|---|
Markdown (.md) | The summary, the thresholds and the verdict, the figures with their comparison, the per request table with a Statuses column (“200 98.6 %, 429 1.4 %”) and an All requests row, the Latency percentiles of each request (count, p50, p90, p95, p99 and max, errors left out) and the error groups. GitHub flavored Markdown. The charts have no Markdown form and are left out. |
PDF (.pdf) | An A4 report on white paper, ready to attach: the verdict and thresholds, the figures, the performance chart, the per request table with a status bar per row, an All requests row and a legend of the exact status codes, the Latency section (a small histogram of each request on its own axis with its p50, p95 and p99, the percentiles table and the latency by percentile chart, errors left out) and the error groups. The charts are drawn as vectors. |
CSV (.csv) | One row per request. The menu shows how many rows it will have. |
JSON (.json) | The whole run for other tools: the run and its configuration, the summary, the thresholds with the value reached and whether each passed, the series per second (requests per second, virtual users, p50, p90, p95, p99), the histogram, the statuses, the per request statistics, the error groups with an example and every request. |
Markdown and PDF follow the interface language, with numbers formatted for it. CSV and JSON are for programs: their column and key names are always English, numbers use a period as the decimal separator, and times and latencies are plain numbers in milliseconds.
The CSV has the columns id, time_ms, vu (from 1), method, request, url, status (the HTTP code, timeout or failed), latency_ms (three decimals), size_bytes and error (1 or 0). The JSON has the top level keys run, summary, thresholds, series, histogram, statuses, per_request, errors and requests. For a run without per request detail the CSV has no rows and the JSON an empty requests list, and the Markdown and PDF reports have no Latency section and no status per request (a single line gives the statuses of the whole run).
While a window is selected, the menu has a checkbox Only the window followed by the range. With it on, every format covers just that window and the file name includes the seconds (run-0003-34-46s.md). With it off, the files cover the whole run.
Copy summary as Markdown, also Ctrl Shift C (Cmd Shift C on macOS) while a load test tab is active, puts the Markdown report on the clipboard instead of in a file. It is handy for a pull request or an issue comment.
Run history
Every run is saved in .postino/runs/ inside the workspace, numbered 0001, 0002 and so on, as two files: 0001.json holds when it started, what it targeted, its configuration (without request bodies or secrets), its thresholds and the final metrics; 0001.samples.csv.gz holds every request the run made, compressed. See Files and folders. Previous runs lists the runs, newest first, with how each one connected (Keep-alive or New connections), and opening one shows its results exactly as when it ended, including the Requests and Errors tabs, the window selection and the exports.
Runs saved by older versions of Postino still open. They have no .samples.csv.gz file, so their Latency, Requests and Errors tabs say Runs saved by older versions of Postino have no per request detail, they cannot select a window, and their CSV and JSON exports have no requests. Their figures and chart are the ones that were saved. Runs saved before the Reuse connections option existed always opened new connections, and show as such.
The Load tests panel of the sidebar lists the runs of the current session with their state and p95.
Whether to commit .postino/runs/ is up to you. Committing it keeps a performance history next to the code; ignoring it keeps the repository small. A run keeps one line per request, so a long run can take a lot of space. See Working with git.
From the command line
postino load runs the same load test in a terminal, with a live dashboard, or with progress lines in a CI pipeline. It saves the run to the same history, so the app shows it, compares it and exports it like any other. --fail-if conditions such as 'p95>500ms' make a pipeline fail when a goal is missed, and --report writes the same reports as Export. The options are in the command line reference. postino runs lists, shows and compares the saved runs, and postino report exports one, from the app's runs as well.
$ postino load crud/ --env staging --vus 20 --duration 2m --fail-if 'p95>500ms' --report run.pdf
Tips
- Start small: 5 users for 30 seconds tells you whether the setup works before you push harder.
- Use a ramp-up. Starting hundreds of users at once measures the connection storm, not steady state.
- A think time of a few hundred milliseconds makes virtual users behave more like real ones.
- Keep tests in the post-response script cheap: they run on every iteration.
- Set thresholds before you start, so a regression shows as Not passed instead of a number you have to remember.
- Watch the Status bars of the per request table: a fast run full of 429 or 503 responses is not a fast API.