Jump to a problem, path or page
Jump to a problem, path or page
01 · Frame the problem
Design a multi-tenant metrics service. Producers send batches, clocks may be skewed and a single label can create millions of series. Queries need recent aggregates and explicit retention.
Throughput is constrained by bytes, series cardinality and indexing work, not only samples per second. Define durable acceptance, duplicate sample semantics and how far query visibility may lag ingestion.
02 · Find the design pressure
Begin with validated tenant batches appended to durable storage. Synchronous indexing couples acceptance to query-engine health. A durable log separates those stages, while cardinality quotas prevent small requests from creating unbounded series metadata.
03 · Define success
Workload: 5,000 reads/s, 50,000 writes/s, 100 B records, 300 ms read p99 target. These are exercise assumptions; the Solution includes capacity formulas.
04 · Identify the correctness boundary
Canonical label ordering defines stable series identity. Limit both request volume and active-series cardinality: a tenant can exhaust memory with many distinct label combinations even at a moderate sample rate. Acknowledge durable log acceptance separately from asynchronous query visibility.
05 · Make it concrete
Two batches contain the same tenant, series and timestamp. Apply the documented duplicate/conflicting-value policy consistently during replay. A batch introducing millions of unique user-ID labels is rejected or quota-limited before unbounded index allocation, while other tenants retain their ingestion budget.