Apache Kafka
medium 34 minApache Kafka is a distributed log for events.
Chapter mnemonic
Six Kafka terms
Two Pirates Order Burgers, Produce Cookies.
What gives a record its position on a single rail?
Its offset within that partition.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
Tracks, wagons, flags: partitions, records, positions.
A wall of model railway tracks. Wagons join the end and stay for a week; each visitor's flag shows where they are; a team gives each track to one person.
Cheat sheet
- Safe writes
- RF 3, minimum 2, acks=all
- Order
- inside one partition
- Group ceiling
- partition count
- Retention
- 7 days by default
- Segment
- 1 GiB by default
- Batch and linger
- 16 KiB, 5 ms
- Out of the ISR
- 30 s behind
- Session, poll limit
- 45 s, 5 min
- Record batch limit
- about 1 MB
- Share group lock
- 30 s, 5 attempts
Spot it when you see
- Many readers for one event.
- Replay after a bug.
- A stream of changes from a database.
Tricks that stick
- Key gives place, place gives order.
- All means all in sync, so set the minimum.
- Work, then commit.
- Reading deletes nothing.
Do not forget
- Minimum left at 1.
- Exactly once claimed for e-mails.
- Adding partitions to a keyed topic.
- Aborting without a rewind.
- Large files as records.