LLM Rate Limiting & Traffic Management Service  ·  View 02 of 24  ·  Context and scope

High-Level Architecture

The path one request takes, and which parts of it are on the latency budget.

Editable source SVG draw.io All views
Client edge
Client edge
Application / SDK
Go · Python · TS
Application / SDK...
Envoy Gateway
ext_authz filter
Envoy Gateway...
Decision
Decision
limiterd
Go · gRPC · stateless
limiterd...
Local Lease Buckets
in-process · 0.3 ms
Local Lease Buckets...
Coordination
Coordination
Valkey Cluster
16 shards · Lua
Valkey Cluster...
Reservation Ledger
TTL 120 s
Reservation Ledger...
Egress
Egress
LLM Gateway
provider adapters
LLM Gateway...
Circuit Breakers
per provider + model
Circuit Breakers...
Providers
Providers
Azure OpenAI
Azure OpenAI
Claude · Gemini
Claude · Gemini
Mixtral on vLLM
Mixtral on vLLM
Accounting
Accounting
Kafka usage.v1
24 partitions
Kafka usage.v1...
Flink Aggregator
exactly-once
Flink Aggregator...
ClickHouse Ledger
usage + cost
ClickHouse Ledger...
commit actuals
commit actuals
budget refresh
budget refresh
High-Level Architecture — the path of one request
High-Level Architecture — the path of one request
External / third party
External / third party
Interface / broker
Interface / broker
Application we own
Application we own
Data store
Data store
Queue / topic
Queue / topic
event / async
event / async
The hot path is edge → limiterd → local lease. Valkey is touched only when a lease is exhausted; PostgreSQL and ClickHouse are never on it.
The hot path is edge → limiterd → local lease. Valkey is touched only when a lease is exhausted; PostgreSQL and ClickHouse are never on it.
v 1.0 · owner Data & AI Global Practice
v 1.0 · owner Data & AI Global Practice
Text is not SVG - cannot display

The latency argument

  • Target is p99 under 10 ms for the decision alone. Measured budget: 0.3 ms when the pod-local lease has capacity, 6 ms when it must refill from Valkey.
  • Roughly 92% of decisions are served entirely from process memory. That hit rate is the single number the whole design is built around — view 24 shows how routing affinity protects it.
  • PostgreSQL and ClickHouse are structurally off the hot path. A decision that needed either would be two orders of magnitude over budget.

Why these components

  • Envoy rather than a custom edge: its ext_authz filter is a stable gRPC contract, so the default integration mode needs no application code.
  • Go for limiterd and llm-gateway: predictable garbage collection matters more than raw throughput when the SLO is a p99.
  • Valkey (Redis protocol) for coordination because server-side Lua gives multi-key atomicity in one round trip. That property is what view 12 depends on.

Deliberate omissions

  • The control plane is not drawn here — view 18 carries it end to end.
  • Failure and fallback paths are omitted so the happy path stays readable; view 23 draws them.
  • Only two non-chain edges are shown: the commit of actuals, and the budget refresh. Everything else follows the spine.