Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Distributed Commit Log

Design a Kafka-like service that durably orders records within partitions, supports retrying producers and replayable consumer groups, and recovers from broker failures.

Problem statement

For this exercise, assume producers append keyed records to named topics through a retrying client SDK, and consumer groups read each partition in order from durable offsets. Ordering is required within a partition, not across a topic.

Delivery is at least once: retries can repeat an accepted append or a consumed record, so the design must expose practical idempotency boundaries. Each partition has three replicas across failure domains; an append is acknowledged after the leader and one follower persist it.

The service should survive one broker or one availability-zone failure without losing acknowledged records. Include topic creation, partition reassignment, broker replacement, replay, and lag observability.

Schema registries, arbitrary stream processing, multi-topic transactions, and cross-region active-active replication are outside scope.

What to build

  1. Producers can append keyed records to a topic, receive a durable partition and offset, and safely retry uncertain outcomes without creating unbounded duplicates.
  2. Consumer groups can fetch records in partition order, commit offsets, recover assignments, and replay from an earlier retained offset.
  3. The service replicates each partition, elects and fences leaders, and reassigns replicas or replaces brokers without losing acknowledged records.
  4. Operators can create topics, choose partition and retention settings, inspect broker health and consumer lag, and control overload or unhealthy partitions.

At scale

  • Assume 200,000 records per second at peak across all topics, with payloads up to 1 MiB.
  • Target 100 ms p95 for an acknowledged append and 500 ms p95 for a normal consumer fetch.
  • Keep 24 hours of records on hot broker storage and seven days on durable retained storage.
  • Use three replicas per partition across failure domains and continue after one broker or one availability-zone failure.