Explain the key components of Apache Kafka.

Instruction: Provide a brief description of each key component within the Apache Kafka ecosystem.

Context: This question is designed to assess the candidate's foundational knowledge of Apache Kafka and their ability to articulate the roles and functions of its core components. Understanding these elements is crucial for effectively designing, implementing, and managing Kafka-based applications.

Updated

Official answer

The core components are:

  • Topics and partitions: a topic is a named stream divided into ordered partition logs. Each record has an offset within its partition; there is no single offset or total order for the whole topic.
  • Brokers: servers that store partition replicas and serve client data requests. A partition has a leader and configured replicas; replication and acknowledgement settings determine failure behavior.
  • KRaft controllers: a metadata quorum manages cluster metadata, broker registrations and partition leadership. Kafka 4.x uses KRaft; ZooKeeper is not a required component of a current 4.x deployment.
  • Producers: clients that serialize records and send them to selected topic partitions. Keys, explicit partition choices and partitioning policy affect routing.
  • Consumers and consumer groups: clients read retained records and track progress through offsets. A standard subscribing consumer group divides partition ownership among its members; separate groups can independently process the same data.

Kafka Connect is an integration framework for source and sink connectors. Kafka Streams is an application library for stream processing, including stateful operations. Neither is required merely to produce and consume records. A schema registry is an additional ecosystem component; Apache Kafka does not include one as a built-in broker service.

For example, an order producer writes keyed events to an orders topic. A billing group and an analytics group consume independently. Brokers retain and replicate the logs; the controller quorum manages metadata, while each application remains responsible for its business processing and offset/side-effect contract.

Introduction, KRaft roles, schema registry boundary

Related Questions