Performance testing
On this page 8 topics
Overview
Topics
- k6 or Gatling
- load
- stress
- spike
- soak testing
Learn first
3 h of practice (estimate)
Learning outcomes
- Distinguish load, stress, spike, and soak tests and what each reveals.
- Write k6 (or Gatling) scenarios with realistic traffic mixes and think time.
- Report latency percentiles and throughput, and avoid coordinated omission.
- Correlate test results with profiles and metrics to find the bottleneck.
Lessons
Lab and exercises
Lab
MID-046-LAB1 · Shop under load
Outcomes: 1–4 · Time: ~3 h Run load, spike, and 2-hour soak tests of checkout from a separate machine with a realistic traffic mix and data set. Write a report naming the first bottleneck. Acceptance: report with percentiles, graphs, and evidence.
Exercises (assessment: report review)
| ID | Outcome | Task |
|---|---|---|
| MID-046-EX01 | 1 | For four scenarios (flash sale, nightly leak, capacity planning, recovery after overload), pick the test type and justify it. |
| MID-046-EX02 | 2 | Write a k6 script for browse, add to cart, and checkout with think time and thresholds. |
| MID-046-EX03 | 2 | Make the script use varied users and SKUs from a data file. |
| MID-046-EX04 | 3 | Rewrite a closed-loop scenario as an arrival-rate scenario and explain the change in the results. |
| MID-046-EX05 | 3 | Given a latency histogram, report p50, p95, p99 and explain why the average misleads. |
| MID-046-EX06 | 4 | Given a graph of p95 and pool-wait metrics, state the bottleneck hypothesis and the next measurement. |
| MID-046-EX07 | 1–4 | Review a sample report: list what is missing (percentiles, load generator location, data realism, evidence). |
Show solutions
- EX01 Flash sale: spike; nightly leak: soak; capacity planning: stress or load to saturation; recovery: stress with a drop back to normal.
- EX02
options.thresholdsfor p95 and failure rate; a default function with three requests andsleepcalls. - EX03
SharedArrayloaded from JSON/CSV and a random pick per iteration. - EX04
executor: 'constant-arrival-rate'withpreAllocatedVUs; the slow system now shows rising latency and dropped iterations instead of hidden lower throughput. - EX05 State the three percentiles; the average sits between them and hides the tail.
- EX06 Hypothesis: connection pool saturation; measure pool wait, active connections, and slow queries; then retest after adjusting one setting.
- EX07 Missing items are fixed one by one; reject reports that quote only averages or ran on the same machine as the system under test.
Outcome 1 is also checked by the lab (three test types) and quiz Q01-Q02.
Quiz
Outcomes: O1 test kinds · O2 k6 scenarios and workloads · O3 percentiles and coordinated omission · O4 finding the bottleneck.
A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.
Practical part
Seven exercises MID-046-EX01 to EX07 plus the load, spike, and soak lab. Pass: at least five exercises and a report with percentiles, graphs, and evidence of the first bottleneck.
Common mistakes
Averages instead of percentiles; testing from the same machine; unrealistic data sets.
Assessment
Report review.
Career relevance
Capacity planning (SRC-004) and the MID gate.