Performance engineering
Performance testing is often left to the last weeks of a project, run once against an undersized environment, and reported as a pass or fail. Performance engineering is different. It starts with targets agreed with the business, uses tests to find the system’s real limits, and feeds what it learns back into the architecture while there’s still time to change it.
For a test architect, it’s one of the clearest ways to influence design: a load test that shows the database saturating at a third of the expected peak changes architecture decisions faster than any review meeting.
Diagram
Section titled “Diagram”- Build the workload from real usage, such as the mix of journeys, data sizes and peak rates, scaled to the agreed target.
- Run it against a production-like system and capture metrics and traces from every tier.
- Find the first resource to saturate and compare the results with the targets.
- Fix the bottleneck or adjust the design, then run again until the targets are met with margin.
Kinds of performance test
Section titled “Kinds of performance test”| Test | Question it answers | Typical shape |
|---|---|---|
| Load | Does it meet targets at expected peak? | Ramp to the target load and hold |
| Stress | Where does it break, and how? | Keep increasing load past the target |
| Spike | Can it absorb a sudden surge? | Jump from normal to many times normal |
| Soak (endurance) | Does it degrade over hours or days? | Moderate load for a long time; watch memory, connections and disk |
| Scalability | Does adding capacity add throughput? | Repeat at different sizes and compare |
| Capacity | How much headroom is left at today’s peak? | Run against production-sized data and infrastructure |
How it works
Section titled “How it works”- Start from targets, not tools. Agree measurable quality attribute scenarios first: “on sale day, checkout handles 5,000 orders a minute with p95 under 800 ms and under 0.1% errors.”
- Model the workload realistically. Use production analytics for the mix of journeys, think times, data sizes and cache hit rates. A test that hits one endpoint with one record measures a cache, not the system.
- Use percentiles, not averages. The p95 and p99 are what unhappy users experience.
- Test against production-like environments and data volumes. A database with a thousand rows behaves nothing like one with a billion.
- Instrument everything. Without observability, a failed load test tells you that it’s slow, not where.
- Find one bottleneck at a time. Fix the first resource to saturate, then test again; the next one is often somewhere else entirely.
- Watch the shared dependencies: databases, connection pools, third-party APIs and rate limits are the usual first failures, not the web servers.
- Make it continuous. Run a smaller performance test in the pipeline on every significant change to catch regressions early, and the full test before major events.
- Finds limits before customers do, especially for launches and seasonal peaks.
- Gives the architecture evidence: decisions on caching, queues, scaling and data design are based on measurements.
- Prevents over-provisioning by showing how much capacity is actually needed.
- Production-like environments are expensive, and so are realistic data volumes.
- Third parties may forbid load testing their production APIs; you’ll need virtual services.
- Results can mislead if the workload model is unrealistic.
When to use it
Section titled “When to use it”- Before launches, sales events, enrollment periods and filing deadlines.
- After major architecture changes: a new database, a cloud migration, splitting a monolith.
- Continuously, in a smaller form, for systems where performance is a key quality attribute.
When to avoid it
Section titled “When to avoid it”Don’t build a full performance lab for an internal tool with a handful of users. A quick check of the slowest pages and queries is enough.
Common pitfalls
Section titled “Common pitfalls”- Testing once, late, when the architecture can no longer change.
- Averages that look fine while one request in twenty times out.
- A test environment a tenth of production’s size, with results scaled up by guesswork.
- Load generators that are the bottleneck themselves.
- Ignoring the database, then discovering it saturates long before the application tier.
Related pages
Section titled “Related pages”- Test strategy and the test portfolio
- Test environments and test data
- Scenario: the site falls over at peak
- Scenario: the database is the bottleneck
- SLOs and error budgets
Further reading
Section titled “Further reading”Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.