Load testing
A load test sends many simulated users at your API at the same time, for a set length of time, and measures how fast and how reliably it answers. Qodex builds the load test from an API scenario you already have, runs it on k6 from up to three regions, and tells you whether your API held up. This page explains how to start a run, what every number and label on the Load tests page means, and what to do when a run does not pass.Load tests appears under Test in the sidebar only when load testing is switched on for your project. If you do not see it, ask your Qodex contact to turn it on.
The short version
A run passes when, in every region it ran from, all three of these held:
If any one of them fails in any region, the run is marked Thresholds breached. That is not a crash or a Qodex error. It means the load test ran to the end and your API was slower, or failed more often, than the limit allows under that much traffic.
Before you start
A load run needs three things. When you have none yet, the page lists them with Done or To do beside each.- An API scenario. Load tests replay API scenarios only, not UI scenarios. Save one from chat or on the Scenarios page.
- An environment. The run sends its traffic to the base URL and variables of the environment you pick. Add one on the Environments page.
- A run left in your allowance. The line under the page title shows your plan and how many load runs you have used. See Your load run allowance.
Start a run
Click Start new run, then fill in:
The box under the fields shows the thresholds the run will be judged on (Passes when p95 < 1000ms, errors < 1%, checks > 99%), how long the run will take, and how much of your allowance it uses. Click Run in N regions to start.
Run again on a past run starts a new one with the same scenario, environment, users, duration, regions and thresholds.
How a run works
Every run has three phases:- Ramp up (30 s). Users are added gradually, from zero up to your Concurrent users number, so your API is not hit by everyone at once.
- Hold. All the users keep running for the Duration you set.
- Ramp down (30 s). Users are removed gradually back to zero.
What the numbers mean
Response time: p50, p90, p95, p99
Every request takes a certain time to get its response back. Qodex lines up all of a region’s response times from fastest to slowest and reports these points along that line:
Why p95 and not the average? An average hides slow requests. If 19 requests take 100ms and one takes 5 seconds, the average is about 350ms, which looks fine, yet one in twenty of your users waited 5 seconds. The p95 shows that slow edge, which is what real users notice. That is why the pass rule is written on p95.
Example. A p95 of 840ms means 95% of requests came back in under 840ms and 5% took longer. With a threshold of 1000ms, this region held its p95 threshold.
Times are written in milliseconds (
412ms) or, from one second up, in seconds (1.40s).
Requests and RPS
Error rate
The Error rate is the share of requests that failed. A request counts as failed when:- it got no response at all (the host could not be reached, the connection was refused, or the secure connection could not be set up), or
- it got a response with a status of 400 or higher (4xx or 5xx).
0.40% means 4 out of every 1,000 requests failed.
Checks rate
Every step of your scenario has checks: its expected status code plus any assertions you added, such as “the body contains anid”. The Checks rate is the share of all those checks, across every request in the run, that passed.
A request can get a fast 200 and still fail a check, for example when the body is missing a field under load. A falling checks rate is a sign your API starts returning wrong answers when it is busy, not just slow ones.
Status codes
The Status codes row counts the responses by class:
Many 429s usually mean a rate limit in front of your API is turning away the load test’s traffic. Many 5xx under load usually mean the API or its database ran out of capacity.
Thresholds
The three thresholds are the pass rule. Each one is checked separately in each region, and the result is shown on the run’s page as a chip:
The chips use k6’s own names:
Runs started from the page use these defaults. Run again keeps the thresholds of the run it repeats.
Run statuses
A run has one status for the whole run, worked out from its regions.
Thresholds breached is about your API. Error is about the run. A breached run measured your API and found it over a limit. An errored run never got a result, for example because the scenario could not be turned into a load test or the region could not start, so there is nothing to judge.
The Load tests page
The usage line
Under the page title, for example Startup · 1 of 1 load run this month · resets Nov 1. It shows your plan, how many load runs you have used in the current window, and when the next one becomes available. Hover it for which runs count.The five tiles
The tiles count the recent runs on the list, not every run the project ever made.
p95 across recent runs
A bar for each recent finished run, oldest on the left. Each bar is that run’s slowest-region p95. A grey bar held the run’s p95 threshold; an amber bar went over it. A rising line of bars means your API is getting slower from run to run.Scenarios under load
One row per scenario with its newest run: the Last result, its p95, how many Runs of it are on the list, and Run again.Recent runs
A cell that reads No responses means requests were sent and none got an answer, so there is no response time to show. See No responses.
The run page
Click any run to open it. The top line shows the users, the hold and ramp, the number of regions, when it started and how long it took. Cancel stops a run in progress; Run again repeats a finished one. Below that is one panel per region with:- the region’s own status;
- Requests, RPS, p95, p99, Error rate and Checks rate;
- Latency: bars for min, p50, p90, p95, p99 and max, so you can see how far the slow end stretches;
- Status codes;
- Thresholds: a chip for each of the three;
- Error: the reason, when the region errored;
- Full report: k6’s own detailed report for that region, opened in a new tab.
No responses
No responses means the run sent requests and not one of them got an HTTP answer. That almost always means the region could not reach your API: the base URL is wrong, the host is private or behind a firewall or VPN, or it only allows traffic from certain IP addresses. In that case there is no response time at all, so Qodex shows No responses instead of a misleading0ms, and the p95 threshold reads not measured, no responses rather than passed.
To fix it, check the environment’s base URL, and make sure the API can be reached from the public internet in the regions you picked. The Full report shows the exact connection errors.
Your load run allowance
Your plan includes a number of load runs per window (for example per month). The usage line and the Runs used tile show where you are.- A run counts once, however many regions it uses.
- A run that never started, or that was cancelled or errored within its first minute without sending any measured load, does not count. It shows Not charged beside its status.
- A run cancelled or errored after that does count, because the load was already sent.
- When the allowance is used up, Start new run is turned off and says when the next run is available.
Common questions
My run says Thresholds breached. Is something broken in Qodex?
My run says Thresholds breached. Is something broken in Qodex?
No. The test ran to the end and measured your API. At least one region went past a limit: p95 at 1000ms or more, 1% or more of requests failed, or 1% or more of checks failed. Open the run and look at the Thresholds chips in each region: the amber ✗ shows which limit was crossed.
Every request returned 200, so why did the run fail?
Every request returned 200, so why did the run fail?
The p95 threshold is about speed, not success. If 5% or more of requests took a second or longer, the p95 threshold is breached even when every response was a 200. Look at the Latency bars: p95 at or above 1.00s is the cause.
The scenario passes when I run it on its own, but the load test shows a high error rate.
The scenario passes when I run it on its own, but the load test shows a high error rate.
Three common causes. Under load your API may return 429 (rate limited) or 5xx (overloaded): check Status codes. A step that expects a 4xx status still counts as a failed request (see Error rate). Or the run cannot reach the host at all: see No responses.
Why is the p95 different in each region?
Why is the p95 different in each region?
Each region measures from its own location. A region far from your servers adds network distance to every request, so its p95 is higher. The page judges the run on its slowest region, because your users in that part of the world see that time.
What is the difference between Thresholds breached and Error?
What is the difference between Thresholds breached and Error?
Thresholds breached means the run measured your API and it was over a limit. Error means the run could not produce a result at all, so nothing was judged. Hover the Error pill, or open the run, to see why.
What does Mixed results mean?
What does Mixed results mean?
The regions finished differently, for example one passed and another breached, or one breached and another errored. Open the run to see each region’s panel.
Why is RPS lower than I expected?
Why is RPS lower than I expected?
RPS is averaged over the whole run, including the 30-second ramps when fewer users are active. Each user also waits half a second before going through the scenario again, and a slow API means each user gets through fewer requests.
Can I change the thresholds?
Can I change the thresholds?
Runs started from the page use the defaults: p95 < 1000ms, errors < 1%, checks > 99%. Run again keeps the thresholds of the run it repeats.
Related
API scenarios
Build the API scenario a load test replays.
Run tests
Run scenarios once, on a schedule, or from CI.