Bird
0
0

You have a topic with 6 partitions and want to ensure messages with the same key always go to the same partition. What partition count strategy supports this?

hard📝 Application Q9 of 15
Kafka - Performance Tuning
You have a topic with 6 partitions and want to ensure messages with the same key always go to the same partition. What partition count strategy supports this?
ASet partition count to 1 to guarantee ordering
BIncrease partitions dynamically to spread keys evenly
CUse a fixed partition count and a key-based hash partitioner
DUse random partition assignment for load balancing
Step-by-Step Solution
Solution:
  1. Step 1: Understand key-based partitioning

    Using a hash of the key ensures messages with same key go to same partition.
  2. Step 2: Keep partition count fixed

    Changing partition count breaks key-to-partition mapping consistency.
  3. Final Answer:

    Use a fixed partition count and a key-based hash partitioner -> Option C
  4. Quick Check:

    Fixed partitions + key hash = consistent routing [OK]
Quick Trick: Fixed partitions + key hash = same partition for keys [OK]
Common Mistakes:
MISTAKES
  • Increasing partitions breaks key consistency
  • Using single partition limits scalability
  • Random assignment loses key ordering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes