Mahir Shahriar Tamim

AI Researcher · Explainable & Responsible AI · Vision, Language & Agentic Systems

← All posts

A series · started November 2026

Learning Kafka

Start with Part 1: Why my service shouldn’t wait for anyone →
app P0 0 1 2 3 4 5 P1 0 1 2 3 P2 0 1 2 3 4 offsets a log, not a queue

TL;DR

  • Kafka is a log split up and copied across machines. Producers add to the end, consumers read at their own pace, and reading deletes nothing.
  • The key picks the partition, and order only holds inside one. With acks=all an acknowledged write survives a dead broker.
  • Make consumers safe to repeat. The speed comes from appends, the page cache, zero-copy and batching.

I’ve been building a notification service. When money moves, someone logs in or a campaign goes out, the user gets a push, an SMS, sometimes an email, and an in-app inbox row. Kafka sits in the middle.

I treated Kafka as a pipe until I hit questions I couldn’t answer. Why does one partition have all the lag while the others sit idle? How does the same SMS go out twice? What happens to an OTP stuck behind a 300,000-message campaign?

So I learned it from the log up. These are my notes. In one sentence:

Kafka is a log. Producers append facts to the end of it, consumers read it at their own pace, and nothing gets deleted just because someone read it.

Split that log across machines, keep a few copies of every piece, and that’s Kafka. Each module uses the notification service as the example, has demos you can break, and ends with a quick check and a short Q&A.

payment service auth service topic: payments P0 0 1 2 3 4 5 6 P1 0 1 2 3 4 5 6 P2 0 1 2 3 4 5 6 append SMS group at offset 3 email group at offset 5 analytics at offset 1 reading never deletes: each group keeps its own bookmark
The whole series in one picture: producers append, partitions split the log, and every consumer group reads at its own pace.

Roadmap

  1. 1Published · Nov 2026 · 4 min read

    Why my service shouldn’t wait for anyone

    Why a payment should not block on five notification channels, seven ways to do it later, and why a log beats a queue.

  2. 2Published · Nov 2026 · 5 min read

    Topics, partitions and keys

    The topic is a name, the partition is the real thing: how keys pick a partition, how many partitions to use, and what an offset really is.

  3. 3Published · Nov 2026 · 6 min read

    Consumers: groups, lag and delivery guarantees

    Consumer groups, why more instances do not always cut lag, committing offsets, and what “exactly once” really covers.

  4. 4Published · Nov 2026 · 5 min read

    Replication: surviving a dead broker

    Leaders, followers and the ISR, who decides who leads, and the full write path of one message.

  5. 5Published · Nov 2026 · 7 min read

    Why Kafka is fast

    Sequential disk writes, the page cache and zero-copy: where the speed actually comes from.