Kafka Topic and its parameters
Kafka Topic and its parameters
A Kafka topic is a category or feed name to which records (messages) are sent by
producers and from which records are retrieved by consumers in Apache Kafka. It serves
as the primary mechanism for organizing data in Kafka. Each topic acts as a log, storing
data in an ordered, append-only fashion across multiple partitions.
Partitions: Topics are divided into partitions for scalability and fault tolerance.
Replication: Each partition can be replicated across multiple brokers to ensure
reliability.
Retention: Messages in a topic are stored for a configurable duration, regardless
of whether they are consumed.
1. Partitions:
o Determines how the topic is split across brokers.
o Partitions are used to distribute messages for scalability.
o Each partition is an ordered log of messages.
2. Replication Factor:
o Specifies the compression algorithm for messages (e.g., gzip, snappy, lz4, or
zstd).
9. Message Size:
o Defines the maximum size of a single message (max.message.bytes).
10. Replication Acknowledgment:
By adjusting these parameters, Kafka topics can be fine-tuned for specific requirements
like throughput, fault tolerance, and message durability.