Interview Prep/SRE & Reliability/Releases & Reliability Patterns

How do you design timeouts across a 3-tier call chain (gateway, API, DB)?

AdvancedScenarioReleases & Reliability Patterns
Answer

Situation read → Timeouts must nest: each caller's timeout greater than the callee's timeout plus retries.

What I'd do →

  1. Start from the user-facing budget: gateway timeout 10s.
  2. API timeout to DB: query timeout 2s, with at most 1 retry, so worst case about 4s plus backoff.
  3. API request timeout: 8s, less than gateway's 10s.
  4. Propagate deadlines so downstream services stop work when the caller has given up.
  5. Measure p99.9 latency of each hop to make sure timeouts are realistic.

Why → Mis-nested timeouts cause wasted work and retries after the user has gone.

Interview tip → Draw the nested budget out loud.

All SRE & Reliability questions

More on Releases & Reliability Patterns