01 / 05

What is Apache Kafka and what problem does it solve?

Difficulty: 2/10
Core concepts

Kafka is a distributed, durable commit log used as an event-streaming platform

Kafka is a distributed event-streaming platform built around a partitioned, replicated, append-only log. Producers append events to topics, brokers persist them to disk and replicate them across machines, and consumers read at their own pace by tracking an offset. The problem it solves is moving large volumes of events between systems reliably, in near real time, without every producer and consumer being wired to each other point to point. Before Kafka, teams ended up with N x M integrations, nightly batch ETL, or fragile queues that dropped data when a consumer was slow.

The key distinction from a simple message queue is that Kafka treats messages as a retained log, not a transient buffer. A classic queue deletes a message once it is acknowledged. Kafka keeps records for a configured retention period (or forever with compaction or infinite retention) regardless of whether anyone has read them. That means multiple independent consumer groups can read the same data, a new service can be added later and replay history, and a consumer bug can be fixed and reprocessed. Throughput comes from sequential disk I/O, batching, compression, zero-copy transfer and partitioning, which spreads load across brokers and consumers.

javascript
  1. 1

    Trade-off: Kafka gives you throughput, durability and replay, but you pay with operational complexity, eventual consistency and no per-message routing or priority. If you only need simple task distribution, a plain queue is cheaper to run.

  2. 2

    Common mistake: calling Kafka a message queue and expecting per-message acknowledgement, per-message TTL or global ordering. Ordering is guaranteed only within a partition.

  3. 3

    Common mistake: assuming data disappears after consumption. Retention is time or size based and independent of consumers.

  4. 4

    Version note: ZooKeeper was removed in Kafka 4.0, which runs only in KRaft mode. Older clusters and many tutorials still describe ZooKeeper-based setups, so state which version you are talking about.

  5. 5

    Version note: Kafka is also gaining queue-like semantics through share groups (KIP-932). Check the maturity status in your release before relying on them.

Scenario Questions

Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.