murmur2
A fast, non-cryptographic hash function that Kafka clients use to turn a record key into a partition number.
In more detail
Because every client uses the same algorithm, a Java producer and a Python producer send the same key to the same partition. It is designed for speed and even spread, not security.
Example
murmur2(key_bytes) % num_partitionsRelated terms
- partitioner — The producer component that chooses which partition each record is sent to.
- hash — A short fixed-length fingerprint calculated from data, which changes completely if even one byte of the data changes.
- modulo — The operation that gives the remainder after division, written % in many programming languages, so 17 % 5 is 2.
Taught in
- The Queue That Forgot — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Where A Record Lands — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Keys And Ordering Per Partition — Apache Kafka & Event Streaming