Explaining Kafka Load Balancing and usage of key based hashing in a Pictorial way
Hi, Lets try to find out how messages generated from a Producer is distributed across the partitions of a particular Topic inside a Kafka Cluster.
We shall also see how the message can be controlled and streamlined to a specific Partition with the help of a ‘Key’.
A Topic is configured with several Partitions, generally the number of nodes in the Kafka cluster decides the number of Partitions in a Topic.
The purpose of having different Partitions is to share the load and improve the performance of the Kafka cluster.
Let’s now go through the images below and understand how messages are handled and shared across the Partitions.
Now comes the Consumers. Lets see how consumer/group(s) consume the messages from the kafka message bus.
Well, this is how a message is sent across partitions of a Topic and a Consumer from a Consumer-Group consumes the messages.
Thank you for the read. If you like it, then please click the Clap button :)