Day 3 of 14 30 minKeysPartitioningOrdering
Learn how a producer decides which partition each record goes to, why keys keep related events in order, how uneven keys create hot partitions, why changing the partition count moves keys, and the producer settings that matter.
By the end of today you can
- Explain how the default partitioner uses the key's hash
- Use keys to keep related events in order
- Recognise hot partitions caused by uneven keys
- Explain why adding partitions changes where keys go
- Write a real producer with keys, a delivery callback and flush()
What's inside
- 6 sections
- 3 diagrams and mind maps
- 5 code examples you can run
- 5-question quiz
- 1How the partition is chosen
- 2Keys keep related events in order
- 3Pitfall 1: hot partitions
- 4Pitfall 2: changing the number of partitions
- 5Producer settings that matter
- 6Real Kafka: a producer with keys
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free