Bird
0
0

You need to design a Kafka-based system that processes user events in order but also scales horizontally. Which approach best balances ordering and scalability?

hard📝 Application Q8 of 15
Kafka - Topics and Partitions
You need to design a Kafka-based system that processes user events in order but also scales horizontally. Which approach best balances ordering and scalability?
APartition events by user ID key to maintain order per user, allowing parallel processing across users.
BSend all events to a single partition to guarantee global order.
CAssign events randomly to partitions to maximize throughput, ignoring order.
DUse multiple topics for each user to isolate ordering.
Step-by-Step Solution
Solution:
  1. Step 1: Understand ordering vs scalability tradeoff

    Ordering requires same partition; scalability requires multiple partitions.
  2. Step 2: Partition by user ID key

    Partitioning by user ID keeps order per user and allows parallel processing across users.
  3. Final Answer:

    Partition events by user ID key to maintain order per user, allowing parallel processing across users. -> Option A
  4. Quick Check:

    Partition by key for order and scale = B [OK]
Quick Trick: Use keys to partition for order and parallelism [OK]
Common Mistakes:
  • Using single partition limits scalability
  • Random partitioning loses order
  • Creating many topics adds complexity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes