Senior · Testing and performance
Benchmark versus load test
Why can a faster microbenchmark still make production slower?
Try explaining this aloud before opening the answer. State your assumptions and trace a boundary case.
Reveal a strong answer
A microbenchmark isolates a chosen code path; production includes concurrency, queueing, network calls, larger inputs and allocations that interact with GC. Benchmark data must resemble the actual workload.
Report allocations and compare repeated runs under controlled conditions. Avoid dead-code elimination, including setup in the timed loop unintentionally, and changing several things at once.
A load test needs an arrival model, duration, warmup, resource budget and latency distribution including failures. A closed-loop client can hide overload by sending less when the server slows; inspect offered and achieved load.
Common trap
Average latency and a single benchmark run conceal p99 regression and instability.
Try it
Optimization improves ns/op but doubles retained buffers. What evidence decides whether to ship?
Worked solution
Compare allocation/live-heap profiles and request throughput/p99 at the same offered load and container budget. Include burst and sustained phases. A local speedup may be a service-level regression under memory pressure.
Change the constraint
Why should timeouts and rejected requests remain in the load-test report?
How did you do?
Self-assessment, not a compiler pass or interview score. Explain the reasoning unaided before marking understood.
Not marked. Progress stays on this browser, separate from course completion.
Primary references
Checked 2026-10-20. Use documentation for your pinned runtime, driver and tool version.