Senior
What is the relationship between topic and partition in Kafka?
sobes.tech AI
Answer from AI
In Apache Kafka, a topic is a logical category or channel to which messages are published. A partition is a physical subdivision of a topic, representing an ordered, immutable log of messages.
The relationship between them is as follows:
- A topic consists of one or more partitions.
- Each partition stores a part of the topic's data and provides parallelism and scalability.
- Messages within a partition are ordered and have a unique offset index.
- Partitions allow load distribution among brokers and consumers.
Thus, partitions are a way to split a topic into several parts to improve performance and fault tolerance.