Skip to content
SD-11 · System design

Design a Distributed Event Log

Asked at Staff level45 minutes
Our answers stay hidden until you reveal them.

Design a distributed event log that many services write events to and many others read from, such as Kafka. Producers append events, like clicks, orders or log lines, to named topics. Consumers read a topic in order, at their own pace, and can rewind to read it again. Events are kept for a set time whether anyone has read them or not.

The cluster takes 1 million events a second on average and 3 million at peak, about 3 GB/s, and keeps 7 days of them. The hard parts: a write that was acknowledged must survive a broker or a whole zone dying; events with the same key must stay in order; hundreds of consumers must share the work without reading an event twice by accident; and a week of data must fit on disk without costing a fortune.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1How big is an event?
  2. 2How much traffic?
  3. 3What order is promised?
  4. 4What delivery guarantee?
  5. 5How long are events kept?
  6. 6How many readers?
  7. 7Can a write be lost?
  8. 8One region or many?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough