Performance & Edge

Timeout Budget

Direct Definition

A timeout budget is the total time an API endpoint is allowed to spend producing a response, divided among the upstream calls it depends on. Each step receives a maximum duration, and calls exceeding it are aborted so the endpoint can return partial data or a fallback.

Technical Architecture & Deep-Dive

Without explicit timeouts, a single hanging upstream API can hold a request open for 30 seconds or more, frustrating users and consuming resources. A budget makes latency predictable: for example, a 1,500 millisecond endpoint might give its primary call 1,000 milliseconds and optional enrichments 400 milliseconds each in parallel.

Edge pipelines enforce per-step timeouts with AbortController and decide whether a failed step should fail the response or be omitted gracefully.

Key Architectural Benefits

Keeps worst-case response times bounded and predictable.
Prevents slow dependencies from exhausting resources.
Enables graceful partial responses when optional data is late.

Per-Step Upstream Timeout

typescript
const res = await fetch(upstreamUrl, {
  signal: AbortSignal.timeout(1000),
}).catch(() => null);

const enrichment = res?.ok ? await res.json() : null;
REALCOMPOSER EDGE WORKSPACE

Implement Timeout Budget at the Edge

Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.

START BUILDING FREE

Frequently Asked Questions

Q:How long should an upstream timeout be?

Base it on the upstream p99 latency plus a margin, and keep the total under what users tolerate, typically one to three seconds for interactive screens.