00:00

Kafka Broker

A Kafka broker is a server that runs Apache Kafka and is responsible for receiving, storing, and sending data (messages). In simple words, a Kafka broker acts like a middleman between applications that send data (producers) and applications that read data (consumers).

When an application sends a message to Kafka, the broker stores it safely. When another application wants that message, the broker delivers it. A Kafka system usually has multiple brokers working together to handle large amounts of data efficiently.

Simple Example

Imagine Kafka as a post office:

  • Producers are people who send letters
  • Consumers are people who receive letters
  • The Kafka broker is the post office that stores and delivers the letters

If one post office is too busy, multiple post offices (brokers) work together to handle the load.

Key Features of a Kafka Broker

1. Message Storage

A Kafka broker stores messages on disk. This means data is not lost even if applications stop or restart. Messages remain available until their configured retention time expires.

2. High Performance

Kafka brokers are designed to handle millions of messages per second. They use efficient disk and network operations, making them very fast and reliable for real-time data processing.

3. Scalability

Kafka brokers can be easily scaled. You can add more brokers to the cluster when data volume grows. Kafka automatically distributes data across brokers.

4. Fault Tolerance

Kafka brokers replicate data across multiple brokers. If one broker fails, another broker already has a copy of the data, so the system continues to work without data loss.

5. Load Balancing

Kafka brokers share the load of incoming and outgoing messages. This prevents any single broker from becoming overloaded and ensures smooth performance.

6. Support for Multiple Consumers

Multiple consumers can read the same data from a Kafka broker independently. This makes Kafka ideal for systems where the same data is used by different applications.

7. Data Retention Control

Kafka brokers allow you to control how long messages are stored. Data can be retained for hours, days, or even indefinitely, depending on business needs.

Kafka Broker vs Kafka Cluster

A Kafka broker is a single server, while a Kafka cluster is a group of brokers working together. Most production systems use clusters to achieve better reliability and performance.

Summary

A Kafka broker is the core building block of Apache Kafka. It stores messages, delivers them to consumers, and ensures data is fast, safe, and scalable. With features like high performance, fault tolerance, and easy scalability, Kafka brokers are widely used in modern microservices and event-driven systems.

In short, without Kafka brokers, Kafka would not be able to manage and move data efficiently between applications.