KatInterview

Diagnosing a Latency or Throughput Regression in a Microservice Fleet

System DesignModel answer
MediumModel answerSystem Designobservabilitydebugginglatency

Last updated

Describe a disciplined, evidence-driven method for finding and fixing a slowdown in a multi-service system, from first signals through safe validation to long-term prevention.

Your team owns a service that sits in the middle of a larger distributed system. A request enters through a load balancer, reaches your service, which calls a cache and one or more downstream services, and finally hits a database. Users and dashboards start showing that the system has become slower, or that it handles less traffic than before.

Question: How would you approach finding and fixing this kind of performance regression?

Give a practical, step-by-step methodology. Your answer should cover:

  1. Which questions you ask and which signals or metrics you look at first.
  2. How you narrow down where the time is being spent across the client, the network, the services, and storage.
  3. How you test your hypotheses without making things worse in production.
  4. What you do afterward so the same class of problem is caught early next time.

Aim for a structured answer that shows your priorities, the trade-offs you are making, and the pitfalls you would watch out for.

Hints

Hint 1

Before opening any dashboard, decide what exactly changed (mean, tail, throughput, errors), when, and for whom. A sharp step in time, a slow drift, and a problem limited to one slice each suggest different causes.

Hint 2

Separate restoring service from finding the root cause. Think about what you can roll back, shift, or shed quickly, and what evidence you should capture before doing so.

Hint 3

Decompose the request path hop by hop, and compare slow versus fast requests and before versus after. Distributed traces, client-versus-server latency gaps, and per-host or per-version breakdowns are your main tools.

Hint 4

Make every hypothesis falsifiable and test it with the lowest-risk method: canary, feature flag, draining a host, or replayed traffic. Change one variable at a time and define a rollback trigger.