Production Incident Diagnosis and Distributed Systems Troubleshooting Questions
Debugging distributed systems under fire: diagnosing latency and reliability regressions, root-causing across service boundaries, reading traces and metrics during an incident, and reasoning about complex production failures. Covers the investigative method for hard-to-reproduce, multi-service problems. The operational counterpart to resilient design.
Compare strong consistency (for example linearizability) and eventual consistency from an SRE troubleshooting perspective. Discuss how each model affects availability and performance, the common failure modes each produces, and the kind of monitoring and alerting you'd set up to detect problems specific to each model.
Sample Answer
Direct answer. From a troubleshooting seat, the practical difference is what kind of anomaly each model produces and therefore what you'd actually alert on: strong consistency tends to fail as unavailability (the system refuses a request rather than serve a wrong answer), while eventual consistency tends to fail as staleness (the system serves an answer, just possibly an outdated one).
Structured elaboration.
- Availability and performance trade-offs. Strong consistency (linearizability) typically requires coordination among replicas before a read or write completes, which costs latency and, during a partition or replica outage, can mean the system refuses to serve requests rather than risk an inconsistent answer. Eventually consistent systems typically stay available and fast during the same conditions, at the cost of potentially serving stale data.
- Common failure modes, by model. A strongly consistent system's common failure mode is elevated latency or outright unavailability when coordination is slow or a quorum can't be reached; the system is 'failing safe' by refusing rather than guessing. An eventually consistent system's common failure mode is silent staleness: reads succeed and look normal, but the data may not reflect the latest write, and unlike an outright failure, this doesn't announce itself.
- What to monitor for strong consistency. Coordination latency (how long consensus or quorum operations take), quorum-availability metrics (can the system currently reach a quorum, meaning enough replicas to form the majority that must agree before a read or write is confirmed, and how close is it to not being able to), and the RATE of request rejections or timeouts due to coordination failure, since a rising rejection rate under strong consistency is your early warning of a coordination problem before it becomes a full outage.
- What to monitor for eventual consistency. Replication lag directly (the most direct proxy for how stale a read might be), and, where feasible, some measure of actual observed staleness (comparing values across replicas periodically, or tracking how often a read-after-write pattern actually returns fresh data) since lag alone doesn't tell you how often it actually causes a user-visible problem.
- Why this matters operationally. An SRE tuning alerts for a strongly consistent system should watch coordination health and rejection rates; an SRE tuning alerts for an eventually consistent system should watch lag and staleness directly, because 'the system is up and answering requests' tells you nothing about whether those answers are current.
Worked example. Consider two services with the same read volume: one backed by a consensus-based store (replicas must agree via a voting protocol before a change is committed), one by an asynchronously replicated store. During a network blip lasting 30 seconds, the consensus-backed service might show a spike in request latency or a burst of rejected writes (because it can't reach quorum), which shows up clearly as an availability dip on a standard error-rate dashboard. The asynchronously replicated service, during that same 30-second blip, would likely show NO change in its error rate or latency at all, because it keeps serving from local replicas regardless; the only signal would be a spike in replication lag, which is invisible unless you're specifically monitoring for it. A team that only tracks error rate and latency (assuming those catch every real reliability problem) would correctly catch the first service's incident and completely miss the second one, even though both experienced a real, if different, degradation.
Trade-offs and pitfalls. The common mistake is applying the same monitoring playbook (error rate and latency) to both kinds of systems and assuming that's sufficient; an eventually consistent system needs staleness-specific monitoring that a strongly consistent system doesn't, precisely because its failure mode doesn't show up as errors. It's also worth remembering these aren't the only two options: many real systems mix models (strong consistency for a narrow, critical write path, eventual consistency elsewhere), so the monitoring strategy often needs to match each PATH's actual guarantee, not the system as a whole.
You're in the on-call rotation and receive alerts that API p95 latency has increased 3x and error rates have risen across several services. Lay out a step-by-step failure-mode analysis using metrics, logs, and distributed traces to isolate the root cause, including which experiments you would run to narrow the search (for example isolating individual downstreams or replaying traffic) and how you would validate a proposed fix safely in production. Include quick mitigation steps you might take while you're still investigating.
Sample Answer
Direct answer. A 3x jump in p95 with errors rising across several services is a signal that something shared or upstream degraded, not that every service independently broke at once, so the investigation should start by finding what those services have in common rather than debugging them one at a time.
Structured elaboration.
- Find the common dependency. Check whether the affected services share a downstream call: a database, a cache, an authentication service, a service mesh sidecar, or a shared piece of infrastructure like DNS or a load balancer. Distributed tracing is the fastest tool for this: pull a handful of slow traces from different affected services and see where the time is actually going. If every trace bottoms out in the same downstream span, you've found your candidate cause in minutes instead of hours. Logs from the affected services for the same window are worth pulling alongside the traces, specifically scoped to the shared downstream call: an explicit error, timeout, or connection-refused message in the logs directly confirms what the trace can only imply, and often narrows 'the auth service is slow' down to something as concrete as 'the auth service is throwing a connection-pool-exhausted exception,' which is a more actionable finding than latency alone.
- Correlate with metrics. Once you have a candidate, check that dependency's own metrics (its error rate, its latency, its saturation) for the same time window. If its p95 or error rate jumped at the same moment your services' did, that's strong corroborating evidence.
- Run targeted experiments to confirm, not just infer. If you suspect a specific downstream, isolate a request to that path alone (bypassing the rest of the flow if you can) and see whether it reproduces the slowdown. Replaying a sample of real traffic against a canary (a small slice of live production instances running the candidate change) or a shadow environment (a copy of the system that receives a duplicate stream of real traffic but whose responses are discarded, used purely to observe behavior safely) is another way to confirm the same hypothesis without risking more production traffic.
- Mitigate while you confirm. Depending on what you find, options include failing over to a healthy replica, shedding non-critical load off the shared dependency, or temporarily degrading a feature that depends on the slow path (serving cached or stale data instead of failing).
- Validate the proposed fix the same way you validated the hypothesis: with a canary, not a blanket rollout. Deploy the candidate fix (a scale-out, a rollback, a config change) to a small slice of the affected service's instances first, and compare that slice's error rate and latency against the untreated rest over the next several minutes before widening it. If the canary slice doesn't recover, the root-cause hypothesis was wrong or incomplete, and that's better discovered on a small slice of traffic than on all of it.
Worked example. Say traces from three of the affected services all show a 300 to 400ms span on a call to the shared authentication service, while every other span in those traces looks normal. You check the auth service's own dashboard and see its p99 latency also jumped 3x at the same timestamp, and its CPU is pegged. That converges on a specific, testable hypothesis (the auth service itself is overloaded) rather than three separate mysteries. A quick check of the auth service's own recent changes and traffic volume tells you whether it's a capacity problem (traffic grew faster than provisioned capacity) or a regression (a recent deploy made it slower per request) so you know whether the mitigation is scaling it out or rolling it back.
Trade-offs and pitfalls. The main trap is debugging each affected service in isolation, which multiplies your investigation time by the number of services and can lead different responders to different, contradictory hypotheses. The other trap is stopping at 'auth service is slow' without confirming WHY, since 'scale it out' and 'roll back the last deploy' are very different mitigations that fix different root causes; guessing wrong burns time you don't have during an active, multi-service incident.
Users report inconsistent account balances across regions. The system uses eventually consistent replication with conflict-resolution rules. Describe how you'd determine whether this is a bug, replication lag, or correct-but-surprising eventual-consistency behavior. Propose fixes (strong consistency for the critical path, causal guarantees, compensating transactions) and discuss the trade-offs of each.
Sample Answer
Direct answer. Inconsistent balances need a definitive test, not a guess: compare the SAME account's state across regions using the system's own conflict-resolution rules to determine whether the current values are what those rules would actually produce, since only that tells you whether you're looking at a bug or working-as-designed eventual consistency.
Structured elaboration.
- Reconstruct the write history for an affected account. Pull every write (with timestamps and originating region) to that account's balance across all regions during the relevant window. This is the ground truth you'll check the current state against.
- Apply the documented conflict-resolution rule by hand to that history. If the rule is, say, 'last-write-wins by timestamp', manually determine what the final balance SHOULD be according to that rule, and compare it against what each region actually shows. If they match, the system is behaving as designed (which may still be a product or business problem, just not a bug). If they DON'T match, the conflict-resolution logic itself has a bug, which is a much more serious finding since it means the intended consistency model isn't even being honored.
- If it's working as designed, quantify how OFTEN and how LONG the inconsistency window actually is, since 'eventually consistent' as a design still needs bounded windows for something as sensitive as balances; a discrepancy that resolves in under a second is very different from one that persists for minutes.
- If it's a genuine bug in conflict resolution, this needs to be treated with more urgency given the financial stakes: contain further divergence (potentially by pausing writes to the affected accounts or region while you fix the logic), then work out how to reconcile the accounts that already diverged incorrectly.
- Propose fixes matched to the finding. If the system is working as designed but the inconsistency window is unacceptable for balance data specifically, strong consistency for that critical path (even if the rest of the system stays eventually consistent) is a reasonable, scoped fix: not every piece of data needs the same consistency guarantee, and balances are a natural candidate for stronger guarantees than, say, a view count. Causal consistency (ensuring that writes which are actually causally related, such as a user's own prior writes, or a write made after reading another value, are seen in that same order by every reader and every region, while writes that are genuinely unrelated and concurrent can still be observed in different orders in different places) is a middle ground. Compensating transactions (detecting a conflict after the fact and issuing a correcting transaction, with an audit trail) are appropriate when strong consistency isn't practical for the whole system but correctness still needs to be guaranteed eventually.
Worked example. Say the write history shows two writes to the same account from two regions within 150ms of each other (a legitimate near-simultaneous transaction, not a bug in how the writes were made), and the documented rule is last-write-wins by timestamp. Applying that rule by hand to the two timestamps says the balance should now reflect the LATER of the two writes; but Region A's replica still shows the value from the EARLIER write, three minutes after both writes completed. That's a genuine conflict-resolution bug: the rule isn't being applied correctly, or Region A never received or processed the later write's conflict-resolution signal at all. That's a materially different, more urgent finding than 'it's just eventual consistency doing its job', and changes the response from 'explain the trade-off to the team' to 'stop write acceptance on affected accounts and fix the propagation bug before more accounts diverge'.
Trade-offs and pitfalls. For financial data specifically, 'eventually consistent, usually fast' is often not an acceptable design even when it's working exactly as intended, because the business cost of a customer briefly seeing a wrong balance can be real (support tickets, trust, in some jurisdictions regulatory exposure); this is why strong consistency for the critical balance-mutation path, even inside an otherwise eventually-consistent system, is a common and justified exception rather than an architectural inconsistency. Compensating transactions need a genuinely reliable detection mechanism to be trustworthy: if conflicts can go undetected, 'we compensate for conflicts' is not actually a guarantee, just a hope. Causal consistency sits between the two on cost as well as guarantee: it's cheaper to provide globally than full strong consistency, since truly unrelated writes across different users or accounts still don't need to be globally ordered, but implementing it correctly means tracking causal dependencies through the system (commonly via version vectors or similar per-write metadata), which is real engineering complexity a naive eventually-consistent design doesn't carry, and it still leaves an inconsistency window open for writes a given reader has no causal relationship to.
You observe high tail latency (p99) for a microservice under load, even though the median latency remains acceptable. Outline a step-by-step troubleshooting plan, including instrumentation, reproducing the load pattern, targeted mitigations, and how you'd validate the fixes in production without risking further user impact.
Sample Answer
Direct answer. When p99 is bad but the median is fine, the problem is affecting a MINORITY of requests in a specific way, so averaging or median-based dashboards will actively hide it; the investigation has to specifically pull out the slow tail and ask what's different about those requests.
Structured elaboration.
- Isolate the slow requests specifically, don't look at aggregate dashboards. Filter your tracing or logging to just the requests above, say, the 95th or 99th percentile latency threshold, and look for what they have in common: a specific endpoint, a specific customer or tenant, a specific payload size or shape, a specific instance or availability zone, or a specific time-of-day pattern.
- Check for resource contention that only bites intermittently. A thread pool or connection pool that's usually adequate can occasionally saturate under a burst, causing a small fraction of requests to queue while most sail through; this produces exactly a good-median-bad-tail signature. Garbage-collection pauses have the same shape: most requests are unaffected, a small fraction land during a pause and get delayed.
- Check for a specific slow dependency call that only some requests make. If a feature flag, a conditional code path, or a specific customer's data shape triggers an extra downstream call (a cache miss requiring a database lookup, for example) for only a subset of requests, the median (mostly fast, cache-hit requests) looks fine while the tail (the subset needing the extra call) is slow.
- Reproduce under load, targeting the specific pattern found in step 1. Once you have a hypothesis (say, large payloads are slow), a load test that specifically varies that dimension can confirm it without waiting for it to reoccur naturally in production.
- Validate the fix without risking more user impact. Roll a fix out to a small percentage of traffic first and specifically watch the SAME tail-latency metric you used to find the problem, not just the aggregate, since a fix could improve the median while barely touching the tail if you mis-diagnosed the cause.
Worked example. Say filtering to the slowest 1% of requests shows they're disproportionately concentrated on one specific API key, and further digging shows that customer's requests average 50 times larger payloads than typical traffic (large batch uploads versus the typical small requests). The service's payload-parsing step is O(n) in a way that's invisible at typical sizes but adds real milliseconds at 50x the size, and if that customer represents roughly 1 to 2% of total request volume, that lines up closely with a p99 (but not median) impact. The mitigation is either optimizing the parsing step's complexity or, as a faster stopgap, routing especially large payloads to a separate processing path so they don't compete for the same resources as typical small requests.
Trade-offs and pitfalls. The trap here is trusting a healthy-looking median or average as evidence nothing is wrong; those aggregates are exactly the metric that HIDES this class of problem by construction, since a small fraction of slow requests barely moves the median at all. It's also worth being skeptical of 'it's probably just noise' when the tail is consistently bad rather than randomly bad: consistent tail badness usually has a specific, findable cause, while genuinely random noise (network jitter, for example) tends to look different in the data.
Monitoring shows that adding more instances of a microservice increased average and p95 latency instead of reducing it. Walk through a debugging checklist explaining possible causes (for example shared-resource contention, DNS or iptables issues, connection-pool exhaustion, or leader-election thrashing), how you'd gather evidence for each, and the remedial action for each cause.
Sample Answer
Direct answer. This is a genuinely counter-intuitive result, since adding instances should spread load and reduce latency, so the debugging checklist has to specifically look for mechanisms where MORE instances create MORE overhead or contention rather than simply assuming the scaling itself is broken.
Structured elaboration.
- Shared-resource contention. If the new instances all compete for the same downstream resource (a database, a cache, a shared connection pool with a fixed total size), adding instances doesn't add capacity to that shared resource, it just adds more competitors for the same fixed pie; check whether a shared downstream's own load or connection count grew proportionally to the new instance count, and whether ITS latency (not just this service's) got worse at the same time.
- DNS or iptables-level issues. A load balancer or service-discovery mechanism that takes non-trivial time to register or fully propagate new instances can cause uneven traffic distribution during scale-up (some instances overloaded while others are still ramping up); at the OS level, an inefficient iptables ruleset (iptables is the Linux kernel's packet-filtering and routing system, commonly used under the hood to implement service load-balancing rules in container networking) can scale poorly with a growing number of backend targets, adding real per-packet overhead as the instance count grows.
- Connection-pool exhaustion, from a different angle than shared-resource contention: if EACH instance opens its own pool of connections to a downstream, more instances can mean MORE total connections than the downstream can handle, even if each instance's own pool looks reasonably sized in isolation.
- Leader-election thrashing, if this service participates in any kind of coordination or leader election: more instances competing for leadership, or more instances triggering more frequent rebalancing in whatever coordination mechanism is in use, can itself consume real resources and add latency, especially if the coordination overhead scales poorly with instance count.
- Gather evidence for each candidate rather than guessing. For each of the above, there's a specific, checkable signal: shared-resource metrics correlated with instance count and latency; load-balancer target-registration timing and per-instance traffic distribution; per-instance versus aggregate connection counts against the shared downstream's own limits; and coordination-service metrics (rebalance frequency, election frequency) if relevant.
- Remedial actions per cause. Shared-resource contention needs the shared resource itself scaled or partitioned, not just the calling service. Load-balancer or iptables issues need investigation of the specific networking layer causing the overhead, which may mean a different load-balancing algorithm or container-networking mode. Connection-pool exhaustion needs a TOTAL connection budget considered across all instances, not just per-instance. Leader-election thrashing needs either fewer participants in the coordination (a subset act as candidates, not every instance) or a coordination mechanism that scales better.
Worked example. Suppose per-instance connection-pool size is a fixed 20 connections to a shared database, and the database's own max-connections limit is 200; at 8 instances, that's 160 total possible connections, comfortably under the limit. Scaling to 15 instances pushes the theoretical maximum to 300, which exceeds the database's 200-connection limit; once actual usage approaches that ceiling, connections start queueing or getting rejected, and EVERY instance (not just the newest ones) experiences worse latency waiting for a connection slot, which is exactly the paradox described: more instances made the shared resource, not any individual instance, the bottleneck. The fix is either reducing per-instance pool size as instance count grows (keeping the total bounded) or increasing the database's connection limit and capacity to match, with the total connection budget explicitly tracked as a fleet-wide constraint rather than a per-instance setting nobody re-evaluates as the fleet grows.
Trade-offs and pitfalls. The core lesson worth internalizing here is that per-instance settings (pool sizes, timeouts, cache sizes) that look reasonable in isolation can become a fleet-wide problem purely from being multiplied across a growing instance count; any config that's 'per instance' should be evaluated against what happens at your MAXIMUM realistic instance count, not just today's count. It's also worth being skeptical of your own instinct here: 'add more instances' is such a common, usually-correct scaling response that it's easy to reach for it again as the FIX when it was actually the trigger.
Unlock Full Question Bank
Get access to all 34 Production Incident Diagnosis and Distributed Systems Troubleshooting interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.