Skip to content
RED SAGSkills
mediumBackend Developer interview question

Users say one API endpoint has become slow in production. How do you find and fix the cause?

What the interviewer wants to hear

  • Confirm with metrics: latency percentiles, error rate, when it started
  • Use tracing to find which span is slow
  • Check recent deploys, traffic and data growth
  • Database analysis: slow query log, EXPLAIN ANALYZE, missing index, N+1
  • Fix, verify with metrics, and add alerts or tests

Model answer

First I confirm the problem with metrics: look at p50, p95 and p99 latency for that endpoint, the error rate, and exactly when it started. Then I check what changed around that time: a deploy, a traffic spike, a big data import or a dependency slowdown. Next I use distributed tracing, such as OpenTelemetry with Jaeger or Datadog, to see which part of the request takes the time: database, an external API call or our own code. If it is the database, I check the slow query log and run EXPLAIN ANALYZE to find full scans, missing indexes, N+1 patterns or lock waits. If it is CPU, I profile. After fixing, for example adding an index or batching queries, I verify the latency graph has recovered and add an alert on p95 so we catch it earlier next time.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Backend Developer questions