Kafka--kafka's basic concept-topic and partition

1. The basic concept of kafka-topic and partition

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-bVkKLZJH-1692450929823) (004-kafka basic concept.assets/image-20210807224211926.png)]

1. topic (theme)

topic is a logical concept

  • The Topic mechanism is used to classify messages, and messages of the same type belong to the same Topic. You can regard each topic as a message queue.

  • The producer (producer) sends the message to the corresponding Topic, and the consumer (consumer) consumes by pulling the message from the Topic

  • Kafka requires consumers to actively pull messages for consumption, it does not actively push messages

2, partition (partition)

Each topic can have multiple partitions, which is a mechanism designed by Kafka to improve concurrency:

Multiple partitions under a topic can receive messages concurrently, and consumers can also pull messages concurrently, that is, partitions do not interfere with each other. In this way, as many partitions as there are can have as much concurrency.

So, if you want to compare it more accurately, 一个分区就是一个消息队列, but these message queues belong to the same message classification

Partitions are ordered, topics are not

The purpose of the partition is to disperse the IO of the disk

Partitions can be added

Guess you like

Origin blog.csdn.net/weixin_39213232/article/details/132384373