Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · From Scratch · Kafka · with code: Go · about 23 min to read

Play it as a journeyTutor comes with a plan

Kafka 02: The Log

The Log
The Log · Open board

The board for this stage of the from-scratch Kafka build, Build Your Own Kafka, From Scratch. Follows Kafka 01: The Naive Queue, where the mailbox queue broke three separate ways, and hands off to Kafka 03: Segments and the Offset Index.

Before you start. This series builds a small copy of Kafka, a program that keeps a stream of events and lets many other programs read that stream at their own pace, the way LinkedIn built the real Kafka to move data between its own services. The last stage built a mailbox queue where the first program to read a message deleted it for everyone else, and that one habit broke it three ways: a second reader found the box empty, a crash lost everything still sitting in it, and a slow reader forced you to either drop messages or make the sender wait.

Lesson 25 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • December 2013: a name for a fix that already existed
  • The rule: stop treating a read as a write
  • A number instead of a name: the offset
  • Two readers, two bookmarks, one log
  • Why nothing gets deleted, and what it costs instead
  • An offset is a position, not an id
  • The consumer owns the cursor
  • Why append-only is fast
  • Durability, and what Kafka actually does
  • Retention: age and size, never acknowledgement
  • Build it
  • Where one file and one machine stop

Terms it explains: log, offset, lag, schedule, retention, id, "Everything after X", partition, N independent readers, TLS defeats it, not, replication across brokers, policy about the file, compaction, loses data, last, Partitions, progress is subtraction, Sequential writes, loses data permanently.

Related papers

Review From Scratch