Keys are hashed using which algorithm by default?

Study for the CCDAK Apache Kafka Test. Dive into comprehensive flashcards and multiple choice questions with detailed hints and explanations. Ensure your readiness for the exam with our targeted practice efforts!

Multiple Choice

Keys are hashed using which algorithm by default?

Explanation:
Hashing the key for partition selection uses a fast, non-cryptographic hash function, specifically Murmur2. This choice is driven by the need for speed and good distribution rather than security. When a key is present, Kafka hashes the key’s bytes with Murmur2 and then maps that hash value to a partition, typically by taking the modulo with the number of partitions, so identical keys consistently land in the same partition and different keys spread out across partitions. Cryptographic hashes like sha256 or md5 would slow things down without providing additional benefit for partitioning, and crc32, while fast, tends to have a less uniform distribution, which can lead to uneven partition usage.

Hashing the key for partition selection uses a fast, non-cryptographic hash function, specifically Murmur2. This choice is driven by the need for speed and good distribution rather than security. When a key is present, Kafka hashes the key’s bytes with Murmur2 and then maps that hash value to a partition, typically by taking the modulo with the number of partitions, so identical keys consistently land in the same partition and different keys spread out across partitions. Cryptographic hashes like sha256 or md5 would slow things down without providing additional benefit for partitioning, and crc32, while fast, tends to have a less uniform distribution, which can lead to uneven partition usage.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy