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.
A critical API shows intermittent authentication failures logged across multiple regions. Design a troubleshooting plan that includes hypothesis generation, quick experiments to isolate the responsible component (the identity provider, the network, or the client SDK), and a safe rollback path if a configuration change turns out to be the cause.
Sample Answer
Direct answer. Multi-region intermittent auth failures need a component-isolation approach: the identity provider, the network path, and the client SDK are three independent things that could each cause exactly this symptom, so the plan has to generate evidence that points at ONE of them specifically rather than guessing.
Structured elaboration.
- Form specific, testable hypotheses for each candidate component. Identity-provider issue: if the IdP itself is degraded or rate-limiting, its own health metrics or status page would show it, and the failures should correlate with IdP-side load or incidents rather than any property of your own regions. Network issue: if it's connectivity between specific regions and the IdP, the failures should correlate with WHICH region a request originates from, not with any property of the request itself. Client SDK issue: if a specific SDK version has a bug (a token-refresh race condition, a misconfigured timeout), the failures should correlate with SDK version or client type, regardless of region or IdP health.
- Run quick, targeted experiments to test each hypothesis. A synthetic auth request sent directly to the IdP from each region, bypassing the normal client SDK entirely, isolates whether the failure reproduces without the SDK in the loop (ruling the SDK in or out). Comparing failure rates specifically by originating region isolates whether it's network-related. Comparing failure rates by SDK version (if you have multiple versions deployed, which is common during a rollout) isolates whether it's a client-side bug.
- Correlate against the intermittency pattern itself. Is the intermittency correlated with TIME (suggesting a periodic issue, like a token-refresh cycle or a scheduled IdP maintenance window) or genuinely random? A time-correlated pattern narrows the search significantly.
- Safe rollback path if a configuration change is the cause. If recent evidence points at a configuration change (an IdP-side setting, a network policy, an SDK config value) that coincides with when the intermittent failures started, have a tested, fast path to revert that specific change, and validate that reverting it actually resolves the failures in at least one affected region before considering it confirmed and rolling the revert out everywhere.
Worked example. Suppose the synthetic direct-to-IdP requests (bypassing the SDK) STILL show the same intermittent failure pattern in every region, at roughly the same rate as normal traffic. That rules out the SDK as the cause: removing it from the request path didn't change the outcome, so whatever's failing is happening somewhere both the normal client and the synthetic test share, meaning the IdP itself or the network path to it. Comparing THOSE bypass-test failure rates by region next shows they're concentrated specifically in regions whose traffic to the IdP crosses a specific network peering link that was recently reconfigured, rather than spread roughly evenly across every region the way a genuine IdP-side problem would be. That converges the investigation on the network path for that specific link, not the IdP (which would show up everywhere, not just in these regions) or the SDK (already ruled out by the bypass test still failing), and the next step is working with network or infrastructure teams to examine that peering link's health and recent changes specifically, armed with concrete regional correlation data rather than a vague 'auth is flaky sometimes' report.
Trade-offs and pitfalls. The key discipline here is running experiments that isolate ONE variable at a time (bypass the SDK to test IdP+network without the SDK; compare across regions to test network specifically); a hypothesis based only on correlation without an isolating experiment is much weaker evidence, since multiple candidate causes can correlate with the same rough time window without actually being the cause. It's also worth checking whether the SAME regions affected here have had OTHER, unrelated network issues recently, since infrastructure problems often cluster on the same underlying shared link or path.
You have an intermittent race condition in production producing duplicate orders, and staging cannot reproduce it at any realistic scale. Design a safe reproduction approach using traffic mirroring, controlled chaos, synthetic requests, and feature flags. Explain how you'd collect deterministic traces of the bug, how you'd disable write-through side effects while testing, and how you'd protect user privacy when mirroring production traffic.
Sample Answer
Direct answer. Reproducing a rare race condition safely in production traffic (since staging can't trigger it at scale) means observing real traffic patterns without letting your reproduction attempt cause the very duplicate-order side effect you're investigating, which is the central design tension of this whole approach.
Structured elaboration.
- Traffic mirroring, done safely. Mirror a copy of real production traffic to an isolated environment where you can instrument heavily, but the mirrored copy's WRITES must not actually reach production systems (the real order-processing backend, payment systems, inventory), since the goal is deterministic observation, not adding more real, uncontrolled write traffic to the very system you're debugging.
- Controlled chaos to increase the odds of triggering it. Since the bug requires a specific timing collision to manifest, deliberately introducing controlled variability (slight, bounded delays or reordering in a test harness) into the mirrored environment can increase how OFTEN the race condition's triggering conditions occur, without touching real production behavior at all, making the rare bug reproducible on a much shorter timescale than waiting for it to happen naturally.
- Synthetic requests as a complementary technique. Once you have a hypothesis about the specific timing window involved, purpose-built synthetic requests that deliberately try to land within that window (sent to the same isolated, non-production-writing environment) can confirm the hypothesis far more directly than waiting for mirrored real traffic to happen to collide the right way.
- Feature flags as the control and safety layer. Feature flags are what let you turn the other three techniques on and off without a deploy: gate the heavier instrumentation and controlled-chaos injection so they only apply to mirrored or synthetic traffic, never to real production requests, and give yourself an instant kill switch that can disable the whole reproduction harness in seconds if anything about it starts behaving unexpectedly. A flag is also a second, independent layer on top of the write-stubbing itself: structure it so a request can only reach the write-stubbed path if it's carrying a flag that marks it as part of this investigation, so a bug in the stubbing logic alone isn't the only thing standing between the reproduction attempt and a real write.
- Deterministic trace collection. Ensure the isolated environment captures full, high-fidelity traces (not sampled) for every request during the investigation, since you specifically need to see the exact interleaving of events that led to a duplicate, and a sampled trace might simply miss the one request pair that mattered.
- Disabling write-through effects during testing. This is the mechanism that makes the whole approach safe: the mirrored/synthetic environment needs its outbound calls to real downstream systems (anything that would actually create an order, charge a card, or update inventory) intercepted and stubbed, so the investigation can observe the RACE CONDITION's logic playing out without any of its side effects actually happening.
- Privacy when mirroring production traffic. Real production traffic contains real customer data; mirroring it for debugging needs the same data-handling discipline as production itself (access controls, retention limits, ideally scrubbing or tokenizing sensitive fields that aren't needed for this specific investigation), not a looser standard just because it's 'for debugging'.
Worked example. Suppose the hypothesis is that the race occurs when two requests for the same order ID arrive within a roughly 5 to 10 millisecond window (perhaps from a client that mistakenly double-submits, or a retry that fires just as the original request is completing). A synthetic test harness that intentionally sends two identical order-creation requests with a controlled, sweeping delay between them (testing 1ms, 5ms, 10ms, 20ms gaps against the isolated, write-stubbed environment) can map out the exact window where the duplicate actually occurs, turning a rare, unpredictable production event into a reliably reproducible one within the test harness, letting you confirm both the root cause and, later, that a fix actually closes the window across the whole range you tested.
Trade-offs and pitfalls. The single most important discipline in this whole approach is making absolutely certain the mirrored or synthetic environment's write-through paths are genuinely stubbed, not just believed to be; a mistake here would mean 'safe reproduction testing' actually creates real duplicate orders in production, which is the exact harm you're trying to investigate, now caused by the investigation itself. It's also worth budgeting real time for the privacy work (scrubbing or tokenizing mirrored customer data) rather than treating it as an afterthought, since skipping it to move faster creates a real compliance and trust risk for the sake of debugging convenience.
A cache node fails (or a large eviction occurs), and a flood of simultaneous cache misses overloads the origin database, causing cascading failures across services (a thundering herd). Explain the immediate mitigations (rate-limiting, request coalescing) and the long-term architectural fixes (singleflight-style coalescing, cache warming, bulkheads, staggered TTLs). Provide a detection and prevention plan so this doesn't recur.
Sample Answer
Direct answer. The moment the cache node fails, every client that would have gotten a cache hit instead gets a miss at roughly the same time, and if nothing throttles that, the database receives a spike close to the FULL read traffic the cache was absorbing, all at once, which is usually far more than the database is provisioned to handle directly.
Structured elaboration.
- Immediate mitigation: stop the flood, not the symptom. Rate-limit or shed load at the edge closest to the database (an API gateway, a proxy, or the database's own connection limiter) so the database doesn't get overwhelmed while you work the real fix. Request coalescing (also called singleflight) is the more targeted version of this: if 500 clients all miss on the same key at once, coalescing ensures only ONE of those 500 actually queries the database, and the other 499 wait for and reuse that single result.
- Restore cache capacity. Bring the failed node back or fail over to a healthy replica; if the cache cluster uses consistent hashing, losing one node ideally only invalidates the keys that node owned, not the whole cache, so confirm that's actually how your cache is configured (a poorly configured cache can lose everything on one node failure instead of a slice).
- Long-term: prevent the all-at-once-miss pattern itself. Singleflight/coalescing as a standing pattern (not just an incident response) caps how much duplicate load a single hot key's cache miss can generate. Staggered TTLs (adding jitter to expiration times) prevent a large batch of keys from expiring at exactly the same moment, which is the same failure pattern even without a literal node failure. Cache warming (pre-populating a new or recovering node before it takes traffic) avoids the cold-cache-meets-full-traffic combination entirely. Bulkheads between the cache-miss path and other database traffic keep a cache-related spike from starving unrelated queries.
- Detection and prevention plan. Alert specifically on cache hit-rate dropping and on database connection/CPU saturation together, since that combination is the signature of this failure mode; a hit-rate alert alone might not fire fast enough, and a database-load alert alone doesn't tell you WHY.
Worked example. Say the cache was serving 50,000 reads per second at a 98% hit rate, meaning only about 1,000 reads per second normally reach the database. The cache node fails, hit rate drops toward 0% for the affected keys, and now roughly 49,000 additional reads per second hit the database at once, a roughly 50x jump from its normal 1,000 rps baseline; a database provisioned for 1,000 to maybe 5,000 rps of direct traffic is overwhelmed almost instantly. With request coalescing in place, if those 49,000 requests are actually requests for a much smaller number of distinct hot keys (say 200 distinct keys being requested repeatedly), coalescing would collapse that down to roughly 200 concurrent database queries instead of 49,000, a reduction of about 245x, which the database can plausibly absorb while the cache recovers.
Trade-offs and pitfalls. Rate-limiting at the database protects the database but means some user requests get degraded or fail during the recovery window; that's usually the right trade because an unprotected database going down would make EVERYTHING fail, not just the cache-miss path. Staggered TTLs and singleflight need to be built in before the incident, not during it, which is why 'detection and prevention' matters as much as the immediate response: a system with no coalescing and no jitter will hit this exact failure mode again the next time a cache node fails or a batch of keys happens to expire together.
Walk through a technical incident from a system you were responsible for: the detection, the triage, the root-cause analysis, the mitigations you executed, and the long-term fixes you proposed.
Sample Answer
Direct answer. The strongest incident walkthroughs make the reasoning at each stage explicit, not just the sequence of actions, since an interviewer is evaluating how you think under pressure as much as what you eventually found.
Structured elaboration.
- Detection. Be specific about how you actually learned something was wrong: an alert firing on a specific SLO burn rate, a customer report, a dashboard you happened to be watching. Vague detection ('I noticed something was off') is a weaker answer than a concrete trigger, because the concrete version shows what signal you trust and why.
- Triage. Describe how you scoped the problem in the first few minutes: what told you this was serious enough to treat as an incident, what the blast radius looked like, and what your very first action was (which, for a real senior answer, is often 'confirm scope' or 'check for an obvious recent change' rather than jumping straight to a fix).
- Root-cause analysis. Walk through the actual investigative path, including a wrong turn if you took one; a candidate who describes only the path that led straight to the answer, with no dead ends, often reads as rehearsed rather than real. Be concrete about what data you looked at and what it told you at each step, the same way you would answer a given-a-trace question, but built from your own memory of a real incident.
- Mitigations executed. State what you actually did, in what order, and why that order (stop the bleeding first, understand later, versus understand first if the mitigation itself was risky).
- Long-term fixes proposed. Distinguish what you fixed immediately from what became a longer-term project; a strong answer explains why some fixes had to wait (dependency on another team, needed more design work, lower urgency once the immediate risk was contained) rather than implying everything got fixed instantly.
Worked example. A concrete shape this can take: detection was a burn-rate alert on a checkout-service SLO (service-level objective, a target reliability commitment like 99.9% of requests succeeding), not a raw error-rate alert; a burn-rate alert fires based on how fast the allowed error budget is being consumed relative to the time window, not just the raw error count, which mattered because it correctly flagged the problem as serious (fast SLO consumption) rather than a low-priority blip. Triage in the first five minutes found the errors concentrated on one payment provider integration, not checkout broadly, narrowing scope substantially. Root-cause analysis involved an early wrong turn (suspecting a recent deploy, which turned out to be unrelated once the timing didn't line up) before tracing to the payment provider's own degraded API. Mitigation was failing over to a secondary payment provider for a subset of traffic, restoring the SLO within about 20 minutes. The long-term fix, automatic provider failover based on the provider's own health signal, was scoped as a follow-up project rather than shipped same-day, because it needed design review with the payments team.
Trade-offs and pitfalls. A common weakness in this kind of answer is describing only successes: every real incident has some ambiguity, a wrong hypothesis considered and discarded, or a decision made with incomplete information. Naming that honestly, and explaining how you recognized the wrong turn and course-corrected, is usually a stronger signal of seniority than a suspiciously clean, straight-line narrative.
Your telemetry shows a sharp increase in intermittent 429 rate-limit responses right after a partner integration launched. As the engineer owning the API, describe how you'd diagnose the problem, including how you'd coordinate with the partner to isolate whether the cause is on your side or theirs, and the short-term mitigations you'd apply while a fix is worked out.
Sample Answer
Direct answer. A rate-limit spike right after a partner integration launch is a strong, specific correlation, but confirming it (rather than just assuming it) and figuring out which side needs to change is the actual diagnostic work, since 'their new integration' could mean several different things technically.
Structured elaboration.
- Confirm the correlation precisely. Check whether the 429 spike is genuinely concentrated on requests from the partner's integration specifically (by API key, client ID, or whatever identifies their traffic) versus a broader, coincidental increase across all callers; this rules out a red herring where the timing matches but the actual traffic source doesn't.
- Rule out a cause on your own side, not just theirs. Before treating the partner's traffic as the mechanism, check whether anything changed on YOUR side around the same time: a recent deploy that altered a rate limiter's default thresholds or a shared config value, a pooled or shared quota bucket that unrelated traffic is also drawing from (so the partner's launch is coincidental timing, not the actual cause), or a bug in how the rate limiter attributes or counts requests that's inflating the count for otherwise-normal traffic. This is what the coordination step below is actually for: if the partner's measured rate turns out to be well within your own documented limits once you look closely, that combination, correlated timing but no real limit violation, is itself the strongest signal the cause is on your side, not theirs.
- Understand the partner's actual request pattern. Is their traffic volume simply higher than expected (a legitimate but larger-than-anticipated load), or is their pattern inefficient in a specific way (polling far more frequently than necessary, not respecting a documented rate limit, retrying aggressively on their own 429 responses in a way that compounds the problem, or making redundant calls that could be batched or cached on their end)? Reviewing their actual call patterns (timing, frequency, whether calls are cacheable but aren't being cached) answers this.
- Coordinate with the partner using specific evidence. Share concrete data: their actual request rate against your documented limits, the specific pattern (if any) that's inefficient, and what a compliant integration would look like; specific, evidence-backed feedback is far more actionable for them than a general 'you're causing errors' report.
- Short-term mitigations while a proper fix is worked out. If their volume is legitimate but exceeds current limits, a temporary limit increase (if your infrastructure can absorb it safely) avoids blocking their real business need while a more durable fix is designed. If their pattern is inefficient, helping them add basic client-side caching or reduce polling frequency, even as a stopgap before a deeper fix, reduces load quickly without your side needing to change anything.
Worked example. Suppose reviewing the partner's call pattern shows they're polling a specific endpoint every 2 seconds per user session to check for status updates, when the underlying data they're polling for typically only changes every few minutes; that's a classic inefficient-polling pattern, not a legitimate high-volume need. Recommending they either reduce polling frequency to something more proportional to how often the data actually changes, or better yet, move to a webhook or push-notification mechanism if your API offers one, would cut their request volume dramatically (potentially by 90% or more, if polling every 2 seconds versus needing an update roughly every few minutes) without requiring any change to your own rate limits or infrastructure at all.
Trade-offs and pitfalls. Simply raising rate limits for a partner without first understanding WHY they're hitting them treats the symptom, not the cause, and can mean you're now absorbing genuinely wasteful traffic indefinitely, which costs you infrastructure capacity for no real business benefit on either side. It's also worth building this kind of check (comparing new-integration traffic patterns against expected, efficient usage) into your partner-onboarding process going forward, so an inefficient pattern like aggressive polling is caught and corrected before launch rather than discovered from a live 429 spike after the fact.
Unlock Full Question Bank
Get access to all Production Incident Diagnosis and Distributed Systems Troubleshooting interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.