Sobes.tech
Junior — Middle

Where and how is the topic stored inside Kafka?

sobes.tech AI

Answer from AI

In Apache Kafka, a topic is a logically organized sequence of messages that is physically stored on broker disks as partitions.

Each topic is divided into one or more partitions, and each partition is an ordered, immutable log of messages stored as files on a specific broker's disk.

Physically, partition data is stored in directories on the broker's disk, usually in a folder specified in the log.dirs configuration. Each partition is a set of segment files containing messages and index files for quick access.

Thus, a topic is an abstraction, and data is stored as partition files on broker disks. When reading and writing, Kafka accesses the corresponding partitions and segments on the disk.