Design a Distributed Message Queue System

Last updated: March 3, 2025

Quick Overview

Design a Kafka-like message queue with partitioning, replication, consumer group coordination, and exactly-once delivery semantics.

ByteDance
System Design
Software Engineer
ByteDance
March 3, 2025
Software Engineer
System Design Round
System Design
Hard

10

6

3,080 solved


Design a Kafka-like message queue with partitioning, replication, consumer group coordination, and exactly-once delivery semantics.

ByteDance's infrastructure relies heavily on message queues for event streaming. Tests deep distributed systems knowledge.

What the Interviewer Expects
  • Design topic partitioning for parallel consumption
  • Implement replication with leader election
  • Build consumer group coordination with offset management
  • Address exactly-once versus at-least-once delivery trade-offs
  • Design backpressure handling
Key Topics to Cover
Message queuing
Partitioning
Replication
Consumer groups
Delivery guarantees
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you handle consumer lag?
  • What is your compaction strategy for changelog topics?
  • How do you handle partition rebalancing during scaling?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional Requirements:

  1. Message Queueing: The system must allow producers to publish messages and consumers to subscribe and consume these messages.
  2. Partitioning: Messages should be...
Capacity Estimation

To estimate capacity, let's assume ByteDance needs to handle:

  • Daily Messages: 1 billion messages/day
  • Average Message Size: 1 KB

Back-of-Envelope Calculations:

  1. Total Daily Data:...

Submit Your Answer
Markdown supported

Related Questions