Distributed Systems Reference/Messaging & Log-Based Systems

Commit Logs, Partitions & Consumer Groups

Log as replicated ordered structure, partition parallelism, consumer group rebalancing, and offset management — the Kafka mental model.

3/5Overview: 25m

The log abstraction

A commit log is an append-only, ordered sequence of records. Kafka's core insight (Jay Kreps): the log is a distributed system primitive — source of truth, replay buffer, and integration backbone.

Replication roadmap (Topic 3) + consensus (Topic 6) underpin how Kafka replicas stay consistent.

Kafka building blocks

ConceptRole
TopicNamed log category
PartitionOrdered sub-log; unit of parallelism
OffsetPosition in partition
Consumer groupCooperating consumers; each partition → one consumer in group
BrokerServer storing partitions
ControllerCluster metadata, leader election

Ordering guarantee

Total order within one partition only. Cross-partition order is undefined. Partition key choice (user_id, order_id) colocates related events.

Consumer groups

N consumers in group, P partitions:

  • If N ≤ P — each consumer gets ≥1 partition
  • If N > P — some consumers idle
  • Rebalance on join/leave — brief pause; know it causes duplicate processing window

Replication in Kafka

Each partition has leader broker and followers. Producers ack when leader (and optionally min ISR followers) persist. Connects directly to leader-follower and ISR concepts from Topic 3.

Not a Kafka admin course

Skip broker tuning, ZooKeeper vs KRaft migration details unless asked. Focus on log + partition + group semantics for interviews.

Further Reading

Hands-On Tasks (Optional)

Low-setup exercises — browser visualizers, paper drills, or optional Docker. No autograding; the goal is interview fluency.

  • Optional: single-broker Kafka with Docker

    If Docker is available: `docker run -d --name kafka -p 9092:9092 apache/kafka:latest` (or Confluent single-image). Produce one message, consume with console consumer, note partition and offset in output. Skip if no Docker — the reading is sufficient.

    20m