**Section 1 — The Context (The 'Why')** Kafka must handle millions of events per second while guaranteeing durability, ordering within partitions, and consumer group coordination. Failures include broker loss, consumer rebalance storms, and retention vs. storage cost...
**Pro-Move**: 'We set min.insync.replicas=2 so one broker can fail without blocking producers.' **Red Flag**: Ignoring replication factor or consumer lag monitoring.
This hard-level System Design/Architecture question appears frequently in data engineering interviews at companies like Delivery Hero, Grover. While less common, it tests deeper understanding that distinguishes strong candidates. Mastering the underlying concepts (join, optimization, partition) will help you answer variations of this question confidently.
This is a senior-level question that tests architectural thinking. Lead with the high-level design, then drill into specifics. Discuss trade-offs explicitly - there is rarely one correct answer. Show awareness of scale, fault tolerance, and operational complexity. The expert answer includes a code example that demonstrates the implementation pattern.
Section 1 — The Context (The 'Why')
Kafka must handle millions of events per second while guaranteeing durability, ordering within partitions, and consumer group coordination. Failures include broker loss, consumer rebalance storms, and retention vs. storage cost trade-offs. A naive single-broker design loses data and cannot scale reads.
Section 2 — The Diagram
[Producers] --> [Brokers]
|
v
[Topics / Partitions]
|
v
[Consumer Groups]
Offset | Rebalance
Section 3 — Component Logic
Producers push to brokers with acks=all for durability. Brokers store partitions; ISR (In-Sync Replicas) ensures exactly-once semantics at the producer level when combined with idempotent producer. Partitioning strategies determine key grouping; partition by user_id for ordering, or random for load balance. Consumer groups enable fan-out patterns—each group consumes independently. Backpressure handling is implicit: slow consumers lag; producers can block or drop. TTL policies (retention.ms) control storage cost vs. replay window. Data skew mitigation: avoid hot keys (e.g., null) in partition key.
Section 4 — The Trade-offs (The 'Senior' part)
This answer is partially locked
Unlock the full expert answer with code examples and trade-offs
Practice real interviews with AI feedback, track progress, and get interview-ready faster.
Pro starts at $19/mo - cancel anytime
Trusted by 10,000+ aspiring data engineers
According to DataEngPrep.tech, this is one of the most frequently asked System Design/Architecture interview questions, reported at 2 companies. DataEngPrep.tech maintains a curated database of 1,863+ real data engineering interview questions across 7 categories, verified by industry professionals.