Worked design answers

One file per design, each a full transcript rather than a diagram: clarify, capacity math, API contract, data model and partition key, architecture, the deep dive on the hardest component, failure modes and degradation, then tradeoffs and what changes at ten times the scale.

The two designs already fully worked in the source document (the distributed rate limiter and RAG with document-level access control) are the length and depth target for every other design here. If a design in this chapter is shorter than those, it is not finished.

What this chapter covers

  • [todo] Distributed rate limiter: algorithms, Redis Lua, two-tier leases
  • [todo] RAG with document-level access control: filtered-ANN recall, two-layer authz
  • [todo] LLM gateway: routing, escalation, two-tier caching, failover, chargeback
  • [todo] Multilingual semantic search at 10k QPS
  • [todo] Agent platform with sandboxed tools and full replay
  • [todo] Evaluation pipeline that gates CI
  • [todo] Cost attribution for LLM spend across 40 teams
  • [done] Design a news feed
  • [todo] Notification and fan-out system
  • [todo] Distributed job scheduler with exactly-once semantics
  • [todo] Metrics and observability pipeline
  • [todo] Ad click aggregation with dedupe and late events
  • [done] Design a payments ledger
  • [todo] Ride-hailing dispatch and geo-indexing
  • [todo] Object storage and file sync
  • [todo] Ticketing under contention
  • [todo] Multi-region active-active key-value store
  • [todo] Personalised recommendation serving on a 50 ms budget
  • [todo] Inference batching for one GPU under a latency SLA

Source: §43, §44, §45.