MiniKafka Tutorial
This ten-chapter course treats MiniKafka as an executable teaching kernel for Kafka's distinctive data-plane mechanisms. Read it in order: storage establishes the offset model, producers and replication build on that model, and consumer groups and transactions add coordination and visibility boundaries.
Every chapter includes source-grounded explanations, an explicit comparison with Apache Kafka, measured experiments, and exercises with acceptance criteria. MiniKafka is not Kafka wire-protocol compatible; use the reference material to keep modeled semantics and production parity separate.
Chapters
- Meet MiniKafka — teaching-kernel scope, environment, and the first direct-API produce→fetch.
- The Log: Foundation of Everything — segment rolling, sparse offset indexes, CRC frames, and active-tail recovery.
- Retention and Compaction — prefix retention, keyed compaction, tombstones, and directory replacement.
- The Producer — keyed/sticky partitioning, batching, linger, and PID/epoch/sequence idempotence.
- Replication I: Followers and Watermarks — follower pulls, LEO, HW, visibility, and acknowledgement modes.
- Replication II: ISR and Fencing — ISR shrink and recovery, minimum ISR, leader epochs, and promotion.
- Consumer Groups — generation fencing, heartbeats, assignment, offset commits, and rebalance boundaries.
- Transactions — journal recovery, markers, LSO,
read_committed, and atomic offset publication. - Delivery Semantics Lab — acknowledged-write loss, idempotent retry, and the ingredients of exactly-once processing.
- Protocol and Beyond — the thin TCP adapter, wire-protocol differences, and a path into real Kafka.
Reference material
- Quick start and project overview
- Architecture
- MiniKafka → Kafka mapping
- Hands-on labs
- Behavior matrix and executable evidence
For the complete Chinese edition, see the 中文教程目录.