Interview conceptSoftware Engineering Fundamentals

Debugging, Observability, And Root Cause Analysis

Asked of: Software Engineer

Last updated

What's being tested

These questions test root-cause analysis: turning an ambiguous symptom into falsifiable hypotheses, collecting evidence, isolating the smallest faulty component, and proving the fix. They also probe observability—whether you can explain why metrics, logs, and traces did or did not reveal the problem—and whether you distinguish correlation from causation. Amazon cares because Software Engineers own reliable services under partial failure, where a green dashboard does not guarantee a correct customer experience.

Core knowledge

  • Observability means inferring internal system state from metrics, logs, and distributed traces. Metrics reveal aggregate health, logs preserve detailed events, and traces connect one request across services; no single signal is sufficient for intermittent failures.

  • Use the RED method for request-driven services: rate, errors, and duration. Pair it with USE—resource utilization, saturation, and errors—for infrastructure dependencies; always inspect `p50`, `p95`, and `p99`, because averages hide tail failures.

  • A healthy aggregate error rate can conceal a cohort-specific defect. Break down metrics by endpoint, region, availability zone, tenant, client version, deployment version, status code, dependency, and request size; preserve enough cardinality to isolate the failing population without exploding storage cost.

  • Distributed tracing propagates a correlation or trace ID across service boundaries. Examine the critical path, retries, queue waits, and child-span errors; a successful outer request may mask a timeout that was caught and replaced with stale or degraded data.

  • Debugging should follow the scientific method: state a hypothesis, predict an observable consequence, run the cheapest discriminating query or experiment, then update confidence. Avoid changing multiple variables simultaneously, or you lose attribution.

  • Sampling is a tradeoff: head-based sampling is cheap but may discard rare failures; tail-based sampling can retain slow or erroneous traces after observing them. For intermittent incidents, prioritize errors, high latency, unusual status codes, and representative successful controls.

  • Intermittent failures commonly arise from race conditions, connection-pool exhaustion, lock contention, cache stampedes, clock skew, retry storms, stale configuration, and dependency brownouts. Reproduce with controlled concurrency, fault injection, deterministic seeds, or targeted load—not only by rerunning a happy-path unit test.

  • Retries can improve availability while worsening overload. Use bounded exponential backoff with jitter, per-operation deadlines, and retry budgets; distinguish transient failures from non-idempotent operations, and propagate the original error rather than repeatedly wrapping it.

  • Establish a timeline using deployment events, configuration changes, traffic shifts, dependency incidents, and logs synchronized by timestamp. A change-point comparison—before versus after a release or flag change—helps narrow causality, but rollback or a controlled canary is stronger evidence.

  • Binary search over changes—for example, `git bisect`, feature-flag rollback, or disabling one dependency path—reduces investigation time from testing every possibility to roughly O(log⁡N)O(\log N) candidate changes. Keep rollback safe, reversible, and observable.

  • An SLO defines an acceptable reliability target, such as successful requests divided by eligible requests. The error budget is 1−SLO1-\mathrm{SLO}; use it to prioritize customer-impacting defects over noisy low-value alerts, while still investigating hidden correctness failures.

  • Validate the fix with a regression test, a targeted dashboard or alert, and a controlled rollout. Include edge cases such as timeouts, partial responses, duplicate requests, malformed data, retries, and one unavailable dependency; otherwise the “fix” may merely move the failure.

Worked example

For “Finding the Root Cause of an Intermittent Failure When the Obvious Metrics Look Healthy,” I would first clarify the customer-visible symptom, failure frequency, affected request types, time window, recent changes, and what “healthy” means for the existing dashboards. I would state that I will separate detection from diagnosis and compare failing requests with successful requests from the same period. My answer would have four pillars: establish a timeline, segment the population, follow representative requests through logs and traces, and test competing hypotheses with reversible experiments. I would inspect `p99` latency, timeout counts, retry counts, queue depth, dependency spans, connection-pool usage, and error-handling paths rather than relying only on aggregate HTTP 5xx rates. If the outer service returns 200 with a fallback response, I would treat correctness degradation as an error even when availability metrics remain green. A key tradeoff is trace sampling: retaining every trace may be too expensive, so I would use tail-based sampling or elevated sampling for suspicious cohorts during the incident. I would confirm causality by reproducing the condition or disabling the suspected path in a canary, then add a regression test and a dashboard dimension that would have exposed it earlier. If I had more time, I would review alert coverage and run a post-incident analysis focused on why the original instrumentation made the failure invisible.

A second angle

For “Diagnose Return Eligibility Scoring Bugs,” the same discipline applies, but the primary failure may be incorrect business logic rather than a timeout or crash. I would trace one incorrect decision from request validation through feature retrieval, rule evaluation, score calculation, persistence, and response serialization, comparing it with a known-good case. I would check versioned rules, null/default handling, boundary conditions, stale cached features, and whether retries or duplicate writes changed state. The strongest evidence would be a minimal failing input plus a deterministic replay that reproduces the wrong score.

Common pitfalls

Pitfall: Treating a green success-rate dashboard as proof that the system is healthy. A tempting answer says “there were no 5xx errors,” but a stronger answer checks fallback responses, silent data corruption, partial results, latency tails, and cohort-specific correctness.

Pitfall: Listing every possible cause without explaining how to discriminate among them. Saying “it could be the database, network, cache, or race condition” is weak; name the next query, trace field, experiment, or rollback that would eliminate each hypothesis.

Pitfall: Describing only the technical fix and omitting ownership, communication, and time-to-resolution. Explain how you kept stakeholders informed, documented evidence, reduced customer impact, and prevented recurrence with tests, instrumentation, or safer rollout controls.

Connections

An interviewer may pivot to incident response, SLOs and error budgets, distributed tracing, concurrency, idempotency, or canary deployments. They may also ask how you design alerts that balance detection speed against false positives and alert fatigue.

Further reading

Practice questions

Related concepts