Senior · Testing and performance
CPU, heap, block and trace
Which diagnostic would you collect first for a p99 incident?
Try explaining this aloud before opening the answer. State your assumptions and trace a boundary case.
Reveal a strong answer
Start from the symptom and resource signals. CPU saturation suggests a CPU profile; growing live memory suggests a heap profile; lock waits suggest mutex/block profiles; scheduling and cross-goroutine timing often need a runtime trace.
Different profiles answer different questions. Allocation-space shows churn while in-use space shows retention at capture time. A blocked network call may explain latency without appearing as a hot CPU stack.
Collect safely with limited overhead and protected access. Compare equivalent load windows and correlate with request/queue/dependency metrics. Do not expose profiling endpoints publicly or attach high-cardinality private request data to metrics.
Common trap
The largest CPU function is not automatically the source of a latency tail caused by waiting.
Try it
CPU is low, goroutine count rises and requests wait for DB connections. What do you inspect?
Worked solution
Inspect pool checkout metrics, goroutine stacks, slow/long transactions and connection ownership. More CPU profiling alone is unlikely to resolve a dependency wait. Bound intake while recovering the underlying capacity.
Change the constraint
What evidence distinguishes a deadlock from a healthy service that is simply overloaded?
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.