Kafka · Core Concepts

Producer, Broker, Consumer, Topic, Partition

Easyproducerbrokerconsumertopicpartitionbasics

Interview question

Explain Producer, Broker, Consumer, Topic, and Partition in Kafka.

How to answer

The short answer

These five terms are the vocabulary every Kafka interview starts with.

Producer

An app that writes events into Kafka. Think orders service, clickstream collector, connector.

Broker

One Kafka server process. It stores logs on disk and serves produce/fetch requests. A cluster is multiple brokers working together.

Consumer

An app that reads events from Kafka. Think fraud detector, warehouse loader, search indexer.

Topic

A named stream of related events, like orders or page_views. Producers write to topics; consumers subscribe to topics.

Partition

A topic is split into partitions. Each partition is an append-only, ordered log. That split is how Kafka scales and parallelizes.

How they fit together

  1. 1Producer sends a record to a topic.
  2. 2Kafka places it in a partition (by key or round-robin).
  3. 3The record is stored on a broker (and usually replicated).
  4. 4A consumer reads from that partition using an offset.

Interview tip: "Topic = category of events; partition = ordered shard; broker = server; producer writes; consumer reads."