Articles

What Is Apache Kafka? Event Streaming, Explained

Apache Kafka is a distributed event-streaming platform built on a durable, append-only log. How topics, partitions, and consumers power real-time pipelines.

The Lycoris Team The Lycoris Team · · 4 min read
Stacked database cylinders

Apache Kafka is a distributed event-streaming platform designed to move large volumes of data between systems reliably and in real time. Originally built at LinkedIn and open-sourced in 2011, it has become the de facto backbone for event-driven architectures, real-time analytics pipelines, and log aggregation at scale. The key insight behind Kafka is treating every event — a user action, a sensor reading, a database change — as a record in a durable, replayable log.

Core concepts

Understanding Kafka requires a handful of terms that fit together cleanly.

Events and topics. An event is an immutable record of something that happened, typically a key-value pair with a timestamp. Events are organized into topics — named, ordered streams. A topic named order-placed might receive an event every time a customer completes a checkout.

Partitions. Each topic is split into one or more partitions, which are the unit of parallelism. Kafka writes events to partitions in an append-only fashion; within a partition the order is guaranteed. More partitions allow more producers and consumers to work in parallel.

Offsets. Every event within a partition gets a sequential integer called an offset. Consumers track their position by offset, which means they can re-read old events or start from any point in the log — a capability traditional message queues don’t provide.

Brokers. Kafka runs as a cluster of brokers (servers). Partitions are distributed across brokers, and each partition is replicated to multiple brokers for fault tolerance. If one broker fails, another that holds a replica takes over.

Consumer groups. A consumer group is a set of consumers that cooperate to process a topic. Kafka assigns each partition to exactly one consumer in the group, so the group processes the topic in parallel. Crucially, multiple independent consumer groups can all read the same topic simultaneously — each at its own pace with its own offset — without interfering with each other.

Retention. Unlike a traditional queue that deletes a message once it’s consumed, Kafka retains events for a configurable period (days, weeks, or indefinitely). This enables replay: a new consumer can join and process all historical events from the start.

How a message flows through Kafka

  1. A producer publishes an event to a topic. Kafka appends it to the appropriate partition.
  2. The broker replicates the event across the configured replica set and acknowledges the write.
  3. One or more consumer groups each read the event at their own pace, tracking progress by offset.
  4. The event remains on disk until the retention window expires.

This decoupled design means producers and consumers never need to know about each other. A payment service can publish payment-processed events without caring whether the inventory system, the analytics pipeline, or the fraud detector are running or how fast they consume.

Kafka vs. a traditional message queue

A traditional message queue like RabbitMQ is designed around the concept of task delivery: a message is dispatched to one consumer and deleted on acknowledgment. That model is excellent for distributing work but has limitations for event-driven architectures.

Traditional queueKafka
Message retentionDeleted after consumptionConfigurable retention window
Multiple consumersCompeting (one gets the message)Independent groups, all receive
ReplayNot supportedReplay from any offset
OrderingPer-queue, limited guaranteesPer-partition, strict order
ThroughputModerateVery high (millions/sec)

For use cases like distributing background jobs to workers, a traditional queue often suffices. For use cases where multiple downstream systems need the same events, or where replay and auditability matter, Kafka’s log-based model is a better fit.

What Kafka is used for

  • Real-time pipelines. Stream clickstream data from a web app into a data warehouse as it happens, rather than in nightly batch jobs.
  • Event-driven microservices. Services communicate by publishing and subscribing to events rather than calling each other directly. This reduces coupling — see microservices vs. monolith.
  • Change data capture (CDC). Database changes are streamed as events, keeping downstream systems in sync. This pattern complements tools like Redis used as a cache layer.
  • Log aggregation. Application logs from many servers are centralized into Kafka topics for analysis.
  • Webhooks fan-out. When a single inbound webhook event needs to trigger many downstream services, a Kafka topic acts as a reliable buffer and fan-out mechanism.

Kafka also fits naturally alongside columnar and time-series data stores. For edge and distributed storage patterns, see the rise of edge databases and SQL vs. NoSQL.

Operational considerations

Kafka’s power comes with operational weight. Running a Kafka cluster historically required managing ZooKeeper (its metadata coordination layer), though newer versions use KRaft mode to eliminate that dependency. Managed offerings from Confluent, AWS MSK, and others reduce the operational burden significantly.

For workloads that don’t need Kafka’s full feature set — high fan-out, long retention, very high throughput — a simpler queue or pub/sub service may be more appropriate.

The takeaway

Apache Kafka is a distributed, durable event-streaming platform built around an append-only log. Its combination of high throughput, configurable retention, offset-based replay, and independent consumer groups makes it the right tool for real-time data pipelines and event-driven architectures where multiple systems need to consume the same stream of events reliably and at scale.

Chisato Chisato · · 3 min read

What Is a Runbook? Incident Response Playbooks

A runbook is a step-by-step document for handling a specific operational task or incident, turning tribal knowledge into a repeatable procedure.

#DevOps #Cloud #Observability
Chisato Chisato · · 4 min read

What Is a NAT Gateway?

A NAT gateway lets private-subnet resources reach the internet outbound while staying unreachable from it, translating private IPs to a public one.

#Cloud #Networking #DevOps