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 25 min to read

Play it as a journeyTutor comes with a plan

Kafka 03: Segments and the Offset Index

Segments and Offset Index
Segments and Offset Index · Open board

It draws the log as a shelf of bound volumes instead of one endless scroll, and that picture is this whole lesson. The project this stage belongs to is Build Your Own Kafka, From Scratch. It follows Kafka 02: The Log and hands off to Kafka 04: Partitions.

Before you start. This series builds a small copy of Kafka, the program big companies use to pass events (every click, every order) from the programs that make them to the programs that need them. Other programs send it a stream of records and read them back later, in order. The last stage turned that stream into one file that only grows, where a record’s distance from the start of the file, its offset, doubles as its address.

Lesson 26 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

  • 1991: a filesystem that could not stop growing
  • Kafka hits the same wall
  • The fix: bound volumes, not one endless scroll
  • Naming the volume by its first page
  • A map that leaves out most of the room
  • Reading one record: three narrowing steps
  • Why Kafka’s map can afford to be sloppy
  • What this stage still leaves behind

Terms it explains: segment, base offset, binary search, index, sparse, keeping, The name survives everything, or, not.

Related paper

Review From Scratch