High-Traffic API
A read-heavy public API built for predictable behaviour under load: caching layers, backpressure, and the failure modes that only appear when the traffic is real.
Reviewed 2026-09-21 · next review 2027-03-21
ARCHITECTURE
A CDN or edge cache in front of a horizontally scaled stateless application tier, with a read-replica database topology behind it and a cache layer for the expensive reads. Requests are admitted through a rate limiter before they reach application logic, so overload is rejected cheaply rather than expensively.
The defining design choice is where you shed load. Every tier needs an answer to "what do I do when the tier below me is slow", and the honest answers are: time out fast, use a cached value, or return a degraded response. A tier with no answer queues, and a queue that grows without bound is how a slowdown becomes an outage.
ASSUMPTIONS
Read-dominated traffic with cacheable responses, tolerance for brief staleness on some endpoints, and clients you can influence — or at least measure. It assumes you know your traffic shape: a blueprint tuned for steady high volume behaves badly under spiky bursts, and vice versa.
If writes dominate or every response must be strictly fresh, most of the leverage here disappears and the design should centre on the write path instead.
SECURITY
Authentication at the edge where possible, so unauthenticated load never reaches the origin. Per-client rate limits distinct from global ones — a global limit alone lets one client consume everyone's headroom. Input validation at the boundary, and response filtering so an authorization bug cannot leak a field. Treat the cache as a disclosure surface: caching a response that varies by identity without varying the key is a cross-user data leak, and it is a common one.
OBSERVABILITY
Percentile latency, not averages: an average hides exactly the tail that makes an API feel broken. Measure at the edge and at the origin so you can tell whose latency it is. Track cache hit ratio, rejected-by-rate-limit counts, and saturation signals (queue depth, connection pool usage) — saturation is the leading indicator that precedes the latency the user notices.
Instrument per-client, or a single misbehaving integration is invisible in aggregate.
AVAILABILITY
Multiple instances across zones behind health checks that fail fast. Circuit breakers on downstream calls with a defined fallback. Explicit timeouts everywhere — a default of "none" is the most common cause of cascading failure. Connection pools sized so the database cannot be overwhelmed by the application tier scaling up, which is a self-inflicted outage that scaling makes worse rather than better.
COST CONSIDERATIONS
Cache hit ratio is the cost lever: each percentage point of hit rate removes origin compute and database load. Egress is usually the second largest line. Measure cost per thousand requests and watch it per endpoint — one expensive uncached endpoint commonly dominates the bill (see /finops).
IAC GUIDANCE
Autoscaling policies, cache behaviours and rate-limit rules all belong in code. Edge configuration is the one teams most often leave manual, and it is the one whose drift is hardest to see. Keep the timeout and retry budget in configuration rather than scattered in code, so it can be reviewed as a whole.
PRODUCTION READINESS
Before launch: load tested to the shape you actually expect, every downstream call has a timeout and a fallback, rate limits set per client, cache keys reviewed for identity leakage, saturation alerting in place, and a rehearsed answer for the database being slow. See /checklists for the deployment gate and /resilience-engineering for the failure-absorption practice.