Recall & Review
beginner
What is the role of a partitioner in Kafka?
A partitioner decides which partition a message will be sent to within a Kafka topic. It helps distribute data evenly and ensures messages with the same key go to the same partition.
Click to reveal answer
beginner
How does Kafka's default partitioner decide the partition for a message with a key?
Kafka's default partitioner uses the hash of the message key to pick a partition. This ensures all messages with the same key go to the same partition, preserving order for that key.
Click to reveal answer
beginner
What happens if a Kafka message has no key when using the default partitioner?
If a message has no key, the default partitioner assigns it to partitions in a round-robin way. This spreads messages evenly across partitions but does not guarantee order.
Click to reveal answer
intermediate
Can you customize partitioner behavior in Kafka? How?
Yes, you can write a custom partitioner by implementing Kafka's Partitioner interface. This lets you control how messages are assigned to partitions based on your own logic.
Click to reveal answer
beginner
Why is consistent partitioning important in Kafka?
Consistent partitioning ensures messages with the same key always go to the same partition. This keeps message order for that key and helps consumers process data correctly.
Click to reveal answer
What does Kafka's default partitioner use to assign a partition when a key is present?
✗ Incorrect
Kafka's default partitioner uses the hash of the message key to assign partitions.
If a Kafka message has no key, how does the default partitioner assign partitions?
✗ Incorrect
Without a key, the default partitioner distributes messages evenly using round-robin.
Why might you create a custom partitioner in Kafka?
✗ Incorrect
Custom partitioners let you define your own logic for assigning messages to partitions.
What is a key benefit of sending all messages with the same key to the same partition?
✗ Incorrect
Sending messages with the same key to the same partition keeps their order intact.
Which interface must you implement to create a custom partitioner in Kafka?
✗ Incorrect
The Partitioner interface is used to create custom partitioning logic.
Explain how Kafka's default partitioner assigns messages to partitions when keys are present and when keys are absent.
Think about how keys affect partition choice and what happens without keys.
You got /4 concepts.
Describe why consistent partitioning is important in Kafka and how it affects message processing.
Consider what happens if messages with the same key go to different partitions.
You got /4 concepts.