Kafka easy
When a Producer sends a message with a specific 'Key', how does Kafka interpret this for shard distribution?
- A The key is used to encrypt the message body using AES-256.
- B Affinity: Kafka hashes the key to ensure that all messages with that same key are consistently routed to the same partition, guaranteeing their sequence order.
- C The key is discarded immediately after the message is received to save disk space.
- D The key forces the message to be duplicated across every single partition in the topic.
Answer: B. Affinity: Kafka hashes the key to ensure that all messages with that same key are consistently routed to the same partition, guaranteeing their sequence order.
This is vital for stateful processing. For example, if you are processing a bank account's transactions, you want all transactions for 'Account 123' to be in the same partition so one consumer can process them in the exact order they occurred.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When implementing 'Exactly-Once Semantics' (EOS) in a Kafka stream, what is the role of the `isolation.level=read_committed` setting on the Consumer?
- Historically, which external service was required by Kafka to manage cluster hierarchy, metadata, and leader election status?
- Once a message is successfully appended to a Kafka partition log, what is its mutability status?
- In a Kafka cluster, what is the role of a 'Broker'?
- What is the primary indicator of a bottleneck in a Kafka consumer's processing logic?
- What is the primary architectural role of Apache Kafka in a distributed system?