Firmino Changani

Kafka - Unkeyed records, where do they go?

Records published on Kafka can be keyed or unkeyed and such a property defined at the producing stage, determines where Kafka stores the record.

Ordering guarantees

By default, keyed records are guaranteed to be ordered within a single partition due to Kafka’s default partitioner strategy that consistently places records in a specific partition for a given a key and a partition count. The formula used to compute the partition number is as follows: partitionNumber = MurmurHash(key) % partitionCount.

/images/posts/kafka-unkeyed-records-where-do-they-go-img-1.png

Where do unkeyed records go?

Whenever ordering is not important, then there is no need to produce records with a key, and when that is the case Kafka’s default partitioner will distribute the records evenly across all partitions, and it does so in batches.

/images/posts/kafka-unkeyed-records-where-do-they-go-img-2.png

#kafka

Reply to this post by email ↪