Performance engineering
On this page 9 topics
Overview
Topics
- Profiling
- benchmark design
- bottleneck elimination
Learn first
4.5 h of practice (estimate)
Learning outcomes
- Design benchmarks (JMH for code, load tests for systems) that measure what matters and avoid common traps.
- Remove bottlenecks in order of impact and stop when the target is met.
- Detect performance regressions in CI.
- Communicate performance results with uncertainty and context.
Lessons
Lab and exercises
Lab
SRC-016-LAB1 · Meet the latency target
Outcomes: 1–4 · Time: ~4.5 h Bring checkout p99 within the SLO at 10× forecast load. Baseline with a constant-rate load test, profile, remove bottlenecks in order, and stop at the target. Add a performance regression check to CI, then seed a regression. Acceptance: before/after evidence; CI catches a seeded regression.
Exercises (assessment: performance report review)
| ID | Outcome | Task |
|---|---|---|
| SRC-016-EX01 | 1 | Review a JMH benchmark with an unused result and constant input; list the traps and rewrite it. |
| SRC-016-EX02 | 1 | Design a load test plan for checkout at 1×, 5×, and 10× forecast: workload mix, arrival model, duration, pass criteria. |
| SRC-016-EX03 | 2 | Given a table of step shares of p99 (45, 25, 15, 10, 5), choose the order of work and the likely maximum gain from the first fix. |
| SRC-016-EX04 | 3 | Design the CI regression check: benchmark set, baseline, tolerance, failure behavior. |
| SRC-016-EX05 | 4 | Rewrite "p99 improved from 800 ms to 400 ms" as an honest report line with context and uncertainty. |
| SRC-016-EX06 | 2 | Case: the team wants to rewrite the JSON library to save 3% of checkout time. Give your recommendation. |
Show solutions
- EX01 Traps: dead-code elimination and constant folding. Consume via
Blackholeor return, use@Stateinputs with variety, add forks, warm-up and measurement. - EX02 Mix by real traffic proportions, constant arrival rate, steps, long enough for steady state, pass if p99 and error rate meet the SLO at 10×.
- EX03 Order by share; the first fix at 45% could remove up to 45% at best; re-measure after each since shares change.
- EX04 Small stable JMH subset plus a smoke load test on dedicated hardware; compare with main baseline; tolerance from measured noise; fail with a report.
- EX05 For example: "Checkout p99 fell from 800 ms (95% CI 780 to 820) to 400 ms (385 to 415) over five 20-minute runs at 10× forecast, on the staging environment with stubbed payment latency; production may differ in cache hit rates."
- EX06 Decline: even removing it entirely gains at most 3%; spend effort on the largest remaining bottleneck.
- Outcome 3 is also covered by the lab CI check and Q07-Q08; outcome 4 by Q10.
Workplace evidence: a measured performance improvement you delivered.
Quiz
Outcomes: O1 benchmark design · O2 bottleneck removal · O3 CI regression detection · O4 reporting.
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
Performance report review (SRC-016 assessment): critique a given report and present SRC-016-LAB1 evidence. Pass: at least 8/10 on the quiz, before/after results with variance, and a CI check that fails on a seeded regression.
Common mistakes
JMH-free microbenchmarks; optimizing non-bottlenecks; single-run results.
Assessment
Performance report review.
Workplace evidence
A measured performance improvement you delivered.
Career relevance
Cost-performance optimization (SRA-007).