EVOPEDIA

← all systems · see it in The System

Event streaming: the distributed log

boundaryInside: the topics and their partitioned logs (segment files, offsets, indexes), the brokers that keep and replicate them, the controller and group and transaction coordinators, and the client libraries producers and consumers link in (src:kreps-2011; src:kafka-docs-design). Outside: the applications that produce and consume, the databases and indexes fed from the log, the stream processors that run on it, the coordination service it used (ZooKeeper), and the machines, operating systems and networks it runs on. The broker does not know what a payload means: 'A message is defined to contain just a payload of bytes' (src:kreps-2011).
nested levelBuilt from brokers, partitions, segment files, offsets, replicas and coordinators; carried by computers, operating systems (page cache, sendfile) and networks; embedded in organizations' data infrastructure, where it sits between the systems that make data and those that use it ('a central log for real-time subscription', src:kreps-2013-log). Stream processing (Kafka Streams, Samza, Storm, Flink, the Dataflow model) runs on it.
scaletechnological

From the walk

The New York Times keeps all the text it has published since the paper's founding in 1851 in a single, ordered Kafka log, and its search index, cached pages and reader notifications are all fed by reading that one log (src:kleppmann-2019).

Definition. Producers append records to a durable, ordered, partitioned log kept by a cluster of brokers, and many readers each read it at their own position (offset); in Kreps's words a log is 'an append-only, totally-ordered sequence of records ordered by time', and Kafka, its reference system, is 'a distributed event store and stream-processing platform'. Definition drawn from the encyclopedia entries listed under Sources (Wikipedia, CC BY-SA).

On this page: Properties 2 · Measures 35 · Open contentions 4 · Cross-scale patterns 25 · Valence partners 16 · Partners and parts 70 · Notes 4 · Layers 83 · Sources 26

Properties published scienceour proposal

Sourced fields, and our own readings.

born at2010 (implemented at LinkedIn); open-sourced January 2011; Apache top-level project October 2012
born precisionyear

Measures (35) published science

characteristic clock: end-to-end pipeline latency (LinkedIn 2011)about 10 s
characteristic clock: wait for a committed writeon the order of 10 ms
characteristic clock: retention period (typical, 2011)7 days
characteristic clock: Kafka Streams commit interval (benchmark setting)100 ms
characteristic clock: KafkaSpout offset checkpoint to ZooKeeper (Twitter default)2 s per partition per topology
segment file size (example)about 1 GB
producer throughput, batch 1 (one broker, 2011)50000 messages/s
producer throughput, batch 50 (one broker, 2011)400000 messages/s
consumer throughput (one consumer, 2011)22000 messages/s
storage overhead per message9 (Kafka) against 144 (ActiveMQ) bytes
data copies per message sent to a consumer4 copies and 2 system calls; sendfile avoids 2 copies and 1 call
messages per day (LinkedIn 2011)close to a billion messages/day
storage per production Kafka server (LinkedIn 2013)up to 5 TB
linear against random disk writesabout 600 MB/s against about 100 kB/s (over 6000x) bytes/s
cost of fsync on every writetwo to three orders of magnitude slower ratio
throughput gain from batching, broker stage51.7x (producer 3.2x, consumer 20.1x) ratio
consumer latency when reading from cache, at least once with replication1 ms median, 30 ms 99.9th percentile
consumer latency when reading from diskaround 100 ms
throughput cost of exactly-once against at-least-once (Kafka Streams test)about 10 to 20 percent
exactly-once overhead at Bloomberg6 to 10 percent
Bloomberg MxFlow scale160 cores, 2 TB RAM, more than one billion market records a day
Jepsen 2013: acknowledged writes lost under a partition520 of 987 acknowledged (1000 attempted) writes
share of ZooKeeper writes made by KafkaSpout (Twitter)67 percent
network-partition failures studied136 failures in 25 systems; 88% triggered by isolating one node; 21% leave lasting damage
ZooKeeper capacity (target workloads)tens to hundreds of thousands transactions/s
sustainable throughput, Flink windowed aggregation1.2 million events/s (2, 4 and 8 nodes)
replicas needed to tolerate F failuresF+1 (primary-backup, Kafka's ISR) against 2F+1 (majority quorum) replicas
default min.insync.replicas1 replicas
default producer acksall
default log.flush.interval.messages9223372036854775807 (the largest long: no count-based forced flush) messages
default auto-commit interval5000 ms
characteristic clock: broker heartbeat interval (KRaft default)2000 ms
KRaft controller metadata provisioning (typical cluster)5 GB memory and 5 GB disk
controllers needed to tolerate f failures (KRaft)3 tolerate 1; 5 tolerate 2 controllers
quota measurement windows (example)30 windows of 1 second each

Open contentions (4) open contention

Where sources or readings disagree. Both stay on the map.

Cross-scale patterns seen here (25) our proposal

Shapes that recur when the same kind of problem is solved at different scales, and how each shows in Event streaming: the distributed log. Each links to every other system that shows it.

Valence: what it trades, and with whom (16) published science

Each exchange with a neighbour, read from both sides: who gains, who pays, and what carries it.

Partners and parts published science

Built from / builds (10)

Sits inside / holds (3)

expressed by (26)

floor filled by (20)

Kinds (11)

Notes published science

Layers

The ways it takes in its world, where they meet, and how it acts back, each from L1 (where it meets the world) up.

the boardroom (shared floors)

  1. L4: The partitioned log: topics, partitions, segment files, offsets, retention and compaction; reads and writes are sequential
  2. L5: Replication and coordination: leader and followers per partition, the ISR, commit when all ISR members have a record, the controller and leader election (ZooKeeper, later a built-in controller)
  3. L6: The consumption contract: groups, assignment, rebalancing, committed offsets, delivery promises, transactions and isolation levels, order per partition
  4. L7: The log in use: an organization's central pipeline and source of truth, stream processing on top, replicas and views derived from it, the people who run it

the event stream as distributed-systems engineers describe it: things happening in the world written down as records, up to the organizations and programs that run on the log (reader's view)

  1. L1: The world the records come from: user activity (logins, page views, clicks, likes, searches), operational metrics, database changes, market data, sensor readings; each a thing that happened, at an event time
  2. L2: The clients: producers serialize records (Avro with a schema id), batch them into message sets and choose the partition (at random or by hashing a key); consumers iterate over message streams
  3. L3: The wire and the broker's front door: a binary TCP protocol of produce and fetch requests sent straight to the partition leader; one binary format shared by producer, broker and consumer; sendfile from page cache to socket
  4. L4: The partitioned log: topics split into partitions, each an append-only ordered log of segment files; records addressed by offset; an in-memory offset index; retention by time or size, key-based compaction
  5. L5: Replication and coordination: each partition has a leader and followers; the in-sync replica set (ISR); a write is committed when all ISR members have it; a controller elects leaders from the ISR. In ZooKeeper mode the controller was a broker (the 'broker controller') with metadata in ZooKeeper; in KRaft mode a quorum of controllers keeps the metadata as a Raft-replicated log, a majority of them alive for availability
  6. L6: The consumption contract: consumer groups and the assignment of partitions to members, rebalancing, the committed offset each group keeps, delivery promises (at most once, at least once, exactly once with idempotent and transactional appends), order within a partition only
  7. L7: What the log is for: the organization's data integration hub and source of truth ('a central log for real-time subscription'), stream processing on top (Kafka Streams, Samza, Storm, Flink, the Dataflow model), event-driven applications, database and index replicas, warehouse loads, and the people who build and run them

the replicated partition on the brokers: disks and page cache up to the controller that elects leaders

  1. L1: Disks and the operating system's page cache on each broker: data written to the page cache and flushed later; no fsync per write; with tiered storage (off by default) completed segments move to a remote tier such as HDFS or S3, while tail reads stay in the page cache
  2. L2: Segment files and the per-message CRC; recovery removes messages with inconsistent CRCs after an I/O error
  3. L3: The leader's log and the followers that fetch from it like consumers, batching what they apply
  4. L4: The ISR and the commit point: followers that fall behind more than replica.lag.time.max.ms are dropped; min.insync.replicas sets a floor
  5. L5: The controller: broker registration and liveness, leader election from the ISR, batched leadership changes; unclean leader election off by default since 0.11; from 4.0, Eligible Leader Replicas let some non-ISR replicas be elected safely (default on for new clusters from 4.1)

way in: Brokers' sessions and heartbeats (liveness)

  1. L1: broker processes that may crash or be cut off
  2. L2: periodic heartbeats to the controller (KRaft); earlier, ephemeral ZooKeeper nodes removed when a session ends
  3. L3: a missed heartbeat within broker.session.timeout.ms marks the node offline
  4. L4: the broker registry: which brokers hold which partitions

way in: Consumers joining, leaving and heartbeating in their groups

  1. L1: consumer processes started, stopped, crashed, redeployed
  2. L2: a consumer registry (2011: ZooKeeper; later: the group coordinator in the broker); from 4.0 (opt-in on the client) the broker also computes the assignment
  3. L3: a watcher or coordinator notices the change
  4. L4: membership known: who subscribes to which topics
  5. L5: group state stored and replicated like other internal topics

way in: Database change feeds (change data capture)

  1. L1: a write commits in a data store (Espresso, MySQL, an OLTP database)
  2. L2: an embedded producer publishes the store's change log, one topic per table partitioned by shard
  3. L3: sent to the local Kafka cluster

way in: Faults arriving from outside: crashes, process pauses, clock skew, network partitions

  1. L1: network partitions, as often as weekly in production networks; pauses and crashes
  2. L2: a partition looks like a crash: unreachability is read as failure
  3. L3: writes to a cut-off follower time out; the leader drops it from the ISR
  4. L4: the ISR shrinks, possibly to the leader alone

way in: Fetch requests from consumers, each carrying the offset to read from

  1. L1: a consumer application wants the records after its position
  2. L2: a pull request naming the offset and an acceptable number of bytes; long poll when no data
  3. L3: the broker finds the segment through its in-memory sorted list of offsets

way in: Follower replicas fetching from the leader

  1. L1: brokers hosting follower replicas of a partition
  2. L2: followers send fetch requests like ordinary consumers
  3. L3: batches copied over the network into the follower's log
  4. L4: the leader tracks how far each follower has caught up

way in: Offset commits: each group's record of how far it has read

  1. L1: a consumer has processed records up to some offset
  2. L2: a commit request (or automatic commit) for the group's position
  3. L3: 2011: written to a persistent ZooKeeper path; later sent to the broker
  4. L4: appended to an internal Kafka topic
  5. L5: replicated like any partition

way in: Operators' and developers' settings (acks, min.insync.replicas, unclean leader election, retention, isolation level)

  1. L1: people weighing durability against availability and latency
  2. L2: per-topic and per-client configuration properties
  3. L3: dynamic settings stored in the metadata log and taken up by brokers without restart (since 1.1); read-only settings need a restart
  4. L4: retention set per topic: by time or size, or by compaction

way in: Records from producers (activity events, metrics, application events)

  1. L1: something happens: a page view, a click, a call's latency, a market tick
  2. L2: the producer client serializes, batches up to a size or latency bound and picks the partition
  3. L3: a produce request over TCP to the leader; the message set kept in one shared binary format

way in: The disks' and page cache's own state (I/O errors, corrupt messages, cache hits and misses)

  1. L1: disks and page cache; disks fail and 'often do not leave data intact'
  2. L2: per-message CRC checked; an I/O error starts a recovery that drops messages with bad CRCs
  3. L3: reads served from page cache when consumers are caught up, from disk when they lag

way in: Time: record timestamps, retention clocks, session and lag timeouts

  1. L1: event time (when it happened) and processing time (when it is seen); clocks are not assumed synchronized
  2. L2: each record carries a timestamp producers may set to event time
  3. L3: time-based retention (typically 7 days) and timeouts on sessions and replica lag

way in: Transactional producers' control requests (register id, add partitions, commit or abort)

  1. L1: a read-process-write cycle that must take effect once
  2. L2: the producer registers its transactional id; the coordinator bumps the epoch
  3. L3: AddPartitionsToTxn and EndTxn requests travel separately from data and may be reordered
  4. L4: the coordinator writes transaction state to the transaction log topic
  5. L5: the transaction log is replicated; a new leader rebuilds coordinator state by replay

way out: Acknowledge producers (acks 0, 1 or all)

  1. L2: the producer frees the batch, or retries on error (idempotently since 0.11)
  2. L3: the produce response returns the offset
  3. L5: commit when all ISR members have the write (acks=all), or ack at once (0) or after the leader (1)

way out: Assign partitions to the members of a group (rebalance)

  1. L2: each consumer starts a thread pulling its partitions from the stored offset
  2. L6: partitions divided among the group's consumers; on a clash a consumer releases all and retries (2011 ZooKeeper protocol; since 4.0 an incremental protocol with server-side assignors, opt-in)

way out: Copy the leader's log to followers

  1. L1: into the followers' page cache and disks
  2. L4: followers append the same records at the same offsets
  3. L5: the leader serves followers' fetches

way out: Deliver records to consumers (fetch responses)

  1. L1: the application acts: updates an index, a cache, a recommendation, a dashboard
  2. L2: the consumer's iterator hands records to the application, blocking when none are left
  3. L3: sendfile sends it to the socket without the two extra copies
  4. L4: the broker reads the chunk from page cache or disk
  5. L6: only committed messages are given out; read_committed consumers also skip aborted transactions

way out: Derived streams, views and replicas written back into the world

  1. L1: a search index, a database, a cache, a warehouse, a push notification, a price
  2. L2: an embedded producer appends results, changelogs and repartitioned streams
  3. L6: read-process-write cycles, committed together with their input offsets
  4. L7: stream processors and subscribers turn the log into derived feeds and materialized views

way out: Fence zombies: reject writes from an older epoch

  1. L2: writes from producers with the older epoch are rejected
  2. L6: the coordinator bumps the epoch for a transactional id

way out: Retire old data: delete expired segments, compact keyed logs

  1. L1: disk space freed
  2. L4: segments past the retention time or size deleted; compaction keeps the last value per key and swaps cleaned segments in

Sources (26) published science

Kreps 2013, The Log: What every software engineer should know about real-time data's unifying abstraction (LinkedIn Engineering; sections: the English passages reprinted in a 2013 reading note, Parts One to Four; the original page now answers 404)
Kreps, Narkhede & Rao 2011, Kafka: a Distributed Messaging System for Log Processing, NetDB'11 (read in full from an open copy of the PDF) (behind its links)
Apache Kafka documentation 4.4, Design (sections: motivation, persistence, efficiency, producer, consumer, consumer position, message delivery semantics, transactions, share consumer, replication, unclean leader election, log compaction, quotas) (behind its links)
Wang D.S., Neuman T., Yelin S.F. 2021, Cavity-modified unimolecular dissociation reactions via intramolecular vibrational energy redistribution (arXiv:2109.06631, preprint) (behind its links)
Wang, Koshy, Subramanian et al. 2015, Building a Replicated Logging System with Apache Kafka, PVLDB 8(12):1654-1655, doi:10.14778/2824032.2824063 (two-page paper read in full from VLDB's open PDF) (behind its links)
Apache Kafka (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01) (behind its links)
Toshniwal, Taneja, Shukla et al. 2014, Storm@twitter, SIGMOD 2014, doi:10.1145/2588555.2595641 (sections: 3 processing semantics, 5 operational experience, from an open course copy of the PDF) (behind its links)
Alquraan, Takruri, Alfatafta & Al-Kiswany 2018, An Analysis of Network-Partitioning Failures in Cloud Systems, OSDI 2018 (sections: abstract, 1 introduction, 2 methodology and Table 1, 4.1-4.2 impact and vulnerable mechanisms) (behind its links)
Kingsbury 2013, Jepsen: Kafka (fault-injection analysis of the proposed 0.8 replication, 2013-09-24; read in full incl. results) (behind its links)
Apache Kafka documentation 4.4, KRaft operations (sections: controller quorum, formatting and the metadata log, provisioning, migration) (behind its links)
Balakrishnan, Malkhi, Wobber et al. 2013, Tango: Distributed Data Structures over a Shared Log, SOSP 2013, doi:10.1145/2517349.2522732 (sections: introduction, 2 the CORFU shared log) (behind its links)
Dobbelaere P, Sheykh Esmaili K. Kafka versus RabbitMQ: a comparative study of two industry reference publish/subscribe implementations. DEBS 2017 (arXiv:1709.00333); read: sections 2-5 and 8 (behind its links)
Hunt, Konar, Junqueira & Reed 2010, ZooKeeper: Wait-free coordination for Internet-scale systems, USENIX ATC 2010 (sections: introduction, 2.1 znodes and watches, 3 examples incl. Yahoo! Message Broker) (behind its links)
Karimov, Rabl, Katsifodimos, Samarev, Heiskanen & Markl 2018, Benchmarking Distributed Stream Data Processing Systems, ICDE 2018, doi:10.1109/icde.2018.00169 (sections: II design decisions, III metrics, Table I) (behind its links)
Apache Kafka documentation 4.4, Broker Configs (sections: min.insync.replicas, unclean.leader.election.enable, log.flush.interval.messages, broker heartbeat and session settings, Updating Broker Configs) (behind its links)
Apache Kafka documentation 4.4, Producer Configs (sections: acks, enable.idempotence) (behind its links)
Apache Kafka documentation 4.4, Consumer Configs (sections: isolation.level, enable.auto.commit, auto.commit.interval.ms, group.protocol, max.poll.interval.ms) (behind its links)
Ganesan, Alagappan, Arpaci-Dusseau & Arpaci-Dusseau 2017, Redundancy Does Not Imply Fault Tolerance: Analysis of Distributed Storage Reactions to File-System Faults, ACM Transactions on Storage, doi:10.1145/3125497 (sections: 1 introduction, methodology and systems studied, the Kafka behaviour analysis, findings on crash/corruption entanglement and unsafe local-global interaction, developer responses) (behind its links)
Kingsbury 2024, Jepsen: Bufstream 0.1.0 (sections: summary, updates, 2 background and transactions, 3 test design, 5 Kafka results, 6 discussion) (behind its links)
Kleppmann, Beresford & Svingen 2019, Online Event Processing, ACM Queue 17(1), doi:10.1145/3317287.3321612 (behind its links)
Carbone, Katsifodimos, Ewen, Markl, Haridi & Tzoumas 2015, Apache Flink: Stream and Batch Processing in a Single Engine, IEEE Data Engineering Bulletin 38(4) (sections: introduction, 3.3 fault tolerance, 4.1 time) (behind its links)
Overeem M, Spoor M, Jansen S, Brinkkemper S (2021) An empirical characterization of event sourced systems and their schema evolution: lessons from industry. J. Systems and Software; arXiv:2104.01146 (sections read: abstract, 1 introduction, 2 method, 3 background and related areas, the challenges on projections and privacy) (behind its links)
Akidau, Bradshaw, Chambers et al. 2015, The Dataflow Model, PVLDB 8(12):1792-1803, doi:10.14778/2824032.2824076 (sections: abstract, 1.2-1.3 windowing and time domains, 2.3 triggers, from VLDB's open PDF; the portal gave the abstract only) (behind its links)
Kingsbury K. Jepsen: NATS 2.12.1, 2025-12-08: fault-injection analysis of NATS JetStream (jepsen.io); read: summary, background, sections 3.2 and 3.4, discussion (behind its links)
Apache Kafka Improvement Proposal KIP-932: Queues for Kafka (Apache wiki, read 2026-12-05; status Accepted; read: motivation, share groups, delivery count, ordering) (behind its links)
Kingsbury 2022, Jepsen: Redpanda 21.10.1 (sections: summary, 1 background, 1.x Kafka transaction semantics, 3.8 write cycles) (behind its links)