All jobs / Backend developer / Performance
Backend developer interview question · 3–5 years
An endpoint takes 1.5 seconds at p95. The container’s CPU sits at 8% and the CPU profiler shows almost nothing.
What do you look at next?
The strongest answer
Wall-clock time rather than CPU: a trace or timed spans across the request showing how long it waits on the database, on downstream calls and on the connection pool — low CPU with high latency means waiting
Why it works
Exactly — a CPU profiler cannot see waiting. Spans across the whole request show where the time actually goes.
What a good answer covers
- Low CPU means waiting.
- Measure wall clock, not CPU.
- Trace the spans across the request.
- Find out what it waits on.
Answers that fall short
- Close, but not the strongest: The database — a slow query is the likeliest cause, so I would start with the slow query log
A good first guess and often right; make it a measurement — the trace tells you whether the database is even on the critical path. - Weak: Add more instances; if each request is slow, more of them will bring the p95 down
More instances help a queue, not a request that spends its time waiting; each copy waits just as long. - Red flag: Raise the timeout so the requests stop failing, and close the ticket
Raising the timeout hides the latency from your alerts and leaves the user waiting longer.
Who gets asked this
More Performance questions
- The interviewer asks: “The cache expires and 2,000 requests hit the database at once. How do you prevent…
- Under load, someone raises the connection pool from 20 to 200 per instance. Throughput drops and p95 gets…
- The interviewer asks: “How do you know we can take 3× traffic on Monday?” Strongest answer?
- The interviewer asks: “The bill doubled but QPS didn't. Where do you look?” Strongest answer?
- A teammate opens a pull request that rewrites a service “for performance”. What do you ask for before you…
- The interviewer asks: “The API is idle but requests hang on 'opening a connection.' What's going on?”…
- The interviewer asks: “The API returns 429. What should a client do?” Strongest answer?
- The interviewer asks: “You add Cache-Control to a JSON API. What do you watch for?” Strongest answer?