Topic Sharding · Parallel Consumption · Rebalancing
By adding partitions to a topic, Kafka enables parallel processing. Multiple consumers in the same Consumer Group will automatically shard the load.
Create a topic with 2 partitions and start 2 consumers in the same group. Watch how Kafka balances the load, sending half the messages to Consumer A and half to Consumer B.
To scale processing, Kafka splits topics into Partitions. When multiple consumers join the same Consumer Group, Kafka automatically assigns each partition to exactly one consumer, distributing the workload evenly.
kafka-topics.bat --create --topic fsd-topic --partitions 2 --bootstrap-server 192.168.1.10:9092
Make sure the broker is running first (click Auto-Boot in Terminal 1).
kafka-console-consumer.bat --topic fsd-topic --group app-group --bootstrap-server 192.168.1.10:9092
kafka-console-consumer.bat --topic fsd-topic --group app-group --bootstrap-server 192.168.1.10:9092
kafka-console-producer.bat --topic fsd-topic --bootstrap-server 192.168.1.10:9092
Type 4 different messages. Watch how they are distributed!
Messages typed in Terminal 2 will appear instantly in Terminal 3 once the consumer is running!