Skip to main content
InterviewHubPRO
Section Overview
Q39

Question 39 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

78%
Apache Kafka Streaming (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Producer Partitioning Strategies: DefaultPartitioner (Murmur2 hash), RoundRobin, sticky partitioning, and custom key partitioners.

senior LevelSystem Design

In Simple Words: How Kafka determines which partition an event lands in:

  1. Explicit Partition Specified: Message is routed directly to that partition index.
  2. Key Provided (Default): Kafka calculates murmur2(key) % total_partitions. Guarantees all events with the same key (e.g. order_12345) land in the exact same partition in strict sequential order.
  3. No Key Provided (Sticky Partitioning in modern Kafka): Batches messages to a single partition until batch.size or linger.ms is reached, then rotates to the next partition. Dramatically reduces request count and improves batch compression.