.NET Architecture & System Design Interview Question #130

What is the Timeout pattern?

Resilience, Rate Limiting, Health Checks & Observability Senior Advanced

Quick Interview Answer

The Timeout pattern limits how long an operation is allowed to wait. Distributed calls should not wait indefinitely because a slow dependency can consume threads, connections, memory, and the caller's latency budget.

Detailed Explanation

The Timeout pattern limits how long an operation is allowed to wait. Distributed calls should not wait indefinitely because a slow dependency can consume threads, connections, memory, and the caller's latency budget.

Timeout values should be based on service objectives and observed behavior rather than arbitrary large numbers. Cancellation should be propagated when supported.

Code Example

Request budget: 2 seconds

API
 -> Dependency A: max 500 ms
 -> Dependency B: max 800 ms
 -> remaining time for processing