5,000,000 Messages/sec Peak
Sustained peak request volume during high-traffic events.
Build a durable, append-only log message broker supporting high-throughput publish-subscribe and consumer group offsets.
Target production parameters expected in a senior or staff interview round.
Sustained peak request volume during high-traffic events.
Daily active users generating read and write operations.
Projected data ingestion and replication storage capacity.
Strict end-to-end percentile latency SLA constraint.
Establish clear problem boundaries before proposing architectural components.
Step-by-step arithmetic conversions for QPS, storage, and bandwidth.
| Dimension | Calculation Formula | Estimated Result |
|---|---|---|
| Peak Cluster Ingress Throughput | 5,000,000 msgs/sec * 1 KB average message size | 5.0 GB/second network & disk ingress |
| Replication Factor Overhead | 5.0 GB/s ingress * 3 replicas (1 leader + 2 followers) | 15.0 GB/second internal cluster bandwidth |
| 7-Day Storage Retention | 5 GB/s * 86,400s * 7 days * 3 replicas | 9.07 Petabytes total cluster raw storage |
How requests navigate ingress gateways, application logic, caching, and persistence.
Accept producer append requests, write sequentially to disk segments, and maintain in-sync replica (ISR) lists.
Replicate commit log segments from partition leader and advance the High Watermark commit boundary.
Assign topic partitions evenly to consumers in a group and track acknowledged commit offsets.
Manage topic schemas, partition reassignments, broker heartbeats, and leader failover elections.
Entity models, indexing, and primary key partitioning.
Appended sequentially to 1GB segment files on disk; binary sparse index maps offsets to physical file byte positions.
Stored in internal compacted Kafka topic __consumer_offsets cached in broker memory.
How to defend engineering compromises when challenged by interviewers.
Rationale: Deleting individual messages causes heavy random disk I/O and index thrashing. An append-only log uses sequential I/O and allows multiple independent consumer groups to read the same data at their own pace.
Rationale: Zero-copy eliminates 2 memory context switches and 2 CPU data copies per packet, allowing Kafka to saturate 10Gbps network cards with minimal CPU usage.
Key interview questions and conceptual defenses.
Kafka writes only sequentially to the end of segment files. Sequential disk access on modern NVMe drives (and even spinning HDDs) is nearly as fast as random memory access.
The KRaft controller selects a new leader from the In-Sync Replicas (ISR) list. Because all ISR followers have confirmed logs up to the High Watermark, zero messages are lost.