Performance and load testing
Why test performance
An API that's right but slow — or right until a busy day — still fails people. What performance and load testing are, the kinds of load test (smoke, load, stress, spike, soak), and what each one answers.
The Testing APIs lessons ask is the answer right? Performance testing asks the next question: is it right fast enough — and does it stay that way when many people use it at once?
An API can pass every functional test and still fail on the first busy morning:
- the sale starts, 3,000 people arrive in a minute, and checkout takes 40 seconds — then answers
503; - everything is fine at 9 am, slow by noon, and down by 4 pm, because something fills up a little with every request;
- the API is quick, but the database behind it handles one query at a time, so the 51st user waits for the other 50.
None of that shows up when one tester sends one request. It only shows up under load: many requests, at the same time, for a while.
Load testing in one paragraph
A load test pretends to be many users. A tool sends the same requests real users would, from many simulated users at once (or at a set number of requests per second), for minutes or hours, and measures every answer: how long it took, and whether it worked. The result says how the API behaves at that load — and, if you push hard enough, where it starts to fail.
The kinds of load test
The same idea, with different shapes — each answers a different question:
| Kind | Shape | Answers | Typical |
|---|---|---|---|
| Smoke | A handful of users, briefly | Does the test itself work? (Right URL, valid token, checks pass) | 2 users, 30 s |
| Load (average load) | The load you expect on a normal day | Is it fast enough on a normal day? | Your usual users, 5–15 min |
| Stress | Ramp up beyond normal | How far can it go, and how does it fail? | 2–5× normal, rising |
| Spike | A sudden jump, then back down | Does it survive a burst — and recover after? | 5 → 50 → 5 users |
| Soak (endurance) | Normal load for a long time | Does it stay fast over hours? — memory leaks, filling disks, growing queues | Normal load, 1–8 h |
| Capacity / breakpoint | Keep raising until it breaks | What's the most it can take? | Rising requests per second |
Always smoke first
Before any big test, run a smoke test: a tiny load for half a minute. It catches the boring mistakes — wrong address, expired token, a check that never passes — in 30 seconds instead of after half an hour of useless load.
What "normal load" means
To run a load test you need a number: how many users, or requests per second, is normal? Find it from production logs or monitoring (requests per minute at the busiest hour), from the business ("we expect 2,000 orders an hour during the sale"), or from an estimate you write down and revisit. A test at a made-up load measures something — just not necessarily something that matters.
What you get out of it
A load test answers questions people actually ask:
- "Will it cope with the sale?" — a load test at the expected peak.
- "How many servers do we need?" — capacity tests, before and after adding one.
- "Did this release make it slower?" — the same test before and after, compared (goals and regressions).
- "Why does it fall over at lunchtime?" — a soak test that shows what grows over time.
- "What fails first?" — a stress test, watched alongside the server's own monitoring (finding the bottleneck).
A word before you start
A load test is real traffic. Against a system you don't own, it can look like an attack, get your network blocked, or take the system down for real users. Read testing safely and realistically before you point a load test at anything shared.
Key takeaways
- Functional tests ask is it right?; performance tests ask is it right fast enough, under real load, for long enough?
- Smoke (does the test work) → load (a normal day) → stress (beyond normal) → spike (a burst) → soak (hours) → capacity (the breaking point).
- Base "normal load" on real numbers, smoke-test first, and only load-test what you're allowed to.
In the app: Performance tests · Test types