Kafka Fundamentals
This chapter establishes the partitioned-log mental model and derives producer durability, ordering, group parallelism, rebalances, retention, compaction, replication, and lag from it.
- Explain Core concepts by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Producers by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Consumers & consumer groups by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Event model & compression by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
How to use this chapter
For Kafka Fundamentals, read the explanations first and predict every example before running it. Keep a learning repository containing code, tests, command output, and the short written submission. The roadmap checklist at the end audits coverage; the chapter itself follows the distributed learning arc appropriate to this subject.
The problem this chapter solves
This chapter establishes the partitioned-log mental model and derives producer durability, ordering, group parallelism, rebalances, retention, compaction, replication, and lag from it.
It decouples services in time, supports high-throughput event streams, and lets multiple independent consumer groups derive different views from the same facts.
Learning outcomes
- Explain Core concepts by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Producers by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Consumers & consumer groups by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Event model & compression by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
Chapter progression
The order below is intentional: later sections depend on guarantees established earlier.
Runtime or system overview
A record key is mapped to a partition, sent to that partition's leader, appended to the log, and replicated to followers. A consumer group assigns each partition to at most one active member. Offsets are application progress, not record identities. Durability depends on acknowledgments, replication, ISR, and broker settings working together. In Kafka Fundamentals, use that execution model to decide where the chapter's validation, state ownership, cleanup, and evidence belong.
Execution trace
- The producer validates and serializes a versioned record, hashes its key to a partition, batches it, and sends it to that partition's leader under the configured acknowledgment policy.
- The broker appends the record at the next partition offset and replicates it; durability depends on acknowledgments, in-sync replicas, and minimum-ISR settings together.
- A group member polls assigned partitions, deserializes the record, checks event identity, and performs its bounded idempotent side effect.
- Recoverable progress advances only after the corresponding effect is durable, or a Kafka transaction atomically publishes output and offsets for Kafka-to-Kafka work.
- Tests inject duplicate delivery, rebalance, poison data, broker interruption, and lag while asserting ordering only within the declared key scope.
Memory and performance lens
Producers batch records in client buffers; consumers fetch batches into memory. Oversized messages, unlimited in-flight requests, slow processing, and large poll batches cause pressure. Broker page cache is central to throughput; Kafka is designed around sequential disk I/O and zero-copy transfer where possible. For Kafka Fundamentals, connect those costs to the concrete operations in the topic sections rather than assuming the friendly surface syntax is cheap.
When tuning Kafka Fundamentals, measure publish-to-complete latency, retries, duplicate effects, oldest work age, queue depth or partition lag, throughput, and recovery time rather than optimizing from source-code appearance.
1. Core concepts
The Core concepts unit begins with topics/partitions/offsets architecture: A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. Choose keys for ordering and partitions for required parallelism and future load. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Core concepts
| Concept | Meaning | Engineering decision |
|---|---|---|
| topics/partitions/offsets architecture | A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. | Choose keys for ordering and partitions for required parallelism and future load. |
| retention (time-based vs size-based) | A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. | Choose keys for ordering and partitions for required parallelism and future load. |
| log compaction | A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. | Choose keys for ordering and partitions for required parallelism and future load. |
| replication: leader/followers/ISR | A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. | Choose keys for ordering and partitions for required parallelism and future load. |
| KRaft mode (no ZooKeeper, Kafka 3.3+) | A Kafka topic is split into ordered partitions whose records have monotonically increasing offsets. Retention removes old segments; compaction retains the latest value per key. | Choose keys for ordering and partitions for required parallelism and future load. |
Message and failure lifecycle: Core concepts
topics/partitions/offsets architecture. Each partition has a leader and replicas. The in-sync replica set tracks followers sufficiently caught up; KRaft stores cluster metadata in a Raft quorum.
retention (time-based vs size-based). Each partition has a leader and replicas. The in-sync replica set tracks followers sufficiently caught up; KRaft stores cluster metadata in a Raft quorum.
log compaction. Each partition has a leader and replicas. The in-sync replica set tracks followers sufficiently caught up; KRaft stores cluster metadata in a Raft quorum.
replication: leader/followers/ISR. Each partition has a leader and replicas. The in-sync replica set tracks followers sufficiently caught up; KRaft stores cluster metadata in a Raft quorum.
KRaft mode (no ZooKeeper, Kafka 3.3+). Each partition has a leader and replicas. The in-sync replica set tracks followers sufficiently caught up; KRaft stores cluster metadata in a Raft quorum.
Read these as one system: topics/partitions/offsets architecture establishes the starting contract, retention (time-based vs size-based) changes how that contract is executed or represented, and KRaft mode (no ZooKeeper, Kafka 3.3+) exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Core concepts
1event = {"event_id": event_id, "type": "topics_partitions_offsets_architecture.v1", "payload": payload}2producer.produce(topic, key=entity_id, value=encode(event), on_delivery=delivered)3producer.poll(0)This Core concepts slice makes topics/partitions/offsets architecture observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward KRaft mode (no ZooKeeper, Kafka 3.3+), predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Core concepts
| Risk | Why it matters |
|---|---|
| topics/partitions/offsets architecture | Offsets are only unique within a partition; compaction does not preserve every intermediate event. |
| retention (time-based vs size-based) | Offsets are only unique within a partition; compaction does not preserve every intermediate event. |
| log compaction | Offsets are only unique within a partition; compaction does not preserve every intermediate event. |
| replication: leader/followers/ISR | Offsets are only unique within a partition; compaction does not preserve every intermediate event. |
| KRaft mode (no ZooKeeper, Kafka 3.3+) | Offsets are only unique within a partition; compaction does not preserve every intermediate event. |
Failure-recovery drill: Core concepts
- Foundation: implement or demonstrate topics/partitions/offsets architecture with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine topics/partitions/offsets architecture with retention (time-based vs size-based). Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for KRaft mode (no ZooKeeper, Kafka 3.3+). State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
2. Producers
The Producers unit begins with acks=0/1/all acknowledgments: Producer settings balance latency, throughput, ordering, and durability. Enable idempotence, use stable keys, and handle delivery callbacks. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Producers
| Concept | Meaning | Engineering decision |
|---|---|---|
| acks=0/1/all acknowledgments | Producer settings balance latency, throughput, ordering, and durability. | Enable idempotence, use stable keys, and handle delivery callbacks. |
| batching: batch.size + linger.ms | Producer settings balance latency, throughput, ordering, and durability. | Enable idempotence, use stable keys, and handle delivery callbacks. |
| idempotent producer | Producer settings balance latency, throughput, ordering, and durability. | Enable idempotence, use stable keys, and handle delivery callbacks. |
| partitioner strategies | Producer settings balance latency, throughput, ordering, and durability. | Enable idempotence, use stable keys, and handle delivery callbacks. |
Message and failure lifecycle: Producers
acks=0/1/all acknowledgments. Records accumulate per partition, are compressed and sent in batches. acks=all waits for the configured replica condition; idempotence uses producer IDs and sequence numbers to suppress retry duplicates within Kafka.
batching: batch.size + linger.ms. Records accumulate per partition, are compressed and sent in batches. acks=all waits for the configured replica condition; idempotence uses producer IDs and sequence numbers to suppress retry duplicates within Kafka.
idempotent producer. Records accumulate per partition, are compressed and sent in batches. acks=all waits for the configured replica condition; idempotence uses producer IDs and sequence numbers to suppress retry duplicates within Kafka.
partitioner strategies. Records accumulate per partition, are compressed and sent in batches. acks=all waits for the configured replica condition; idempotence uses producer IDs and sequence numbers to suppress retry duplicates within Kafka.
Read these as one system: acks=0/1/all acknowledgments establishes the starting contract, batching: batch.size + linger.ms changes how that contract is executed or represented, and partitioner strategies exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Producers
1producer.produce("events", key=entity_id, value=payload, on_delivery=delivered)This Producers slice makes acks=0/1/all acknowledgments observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward partitioner strategies, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Producers
| Risk | Why it matters |
|---|---|
| acks=0/1/all acknowledgments | acks=all is not sufficient if replication or minimum ISR is misconfigured. |
| batching: batch.size + linger.ms | acks=all is not sufficient if replication or minimum ISR is misconfigured. |
| idempotent producer | acks=all is not sufficient if replication or minimum ISR is misconfigured. |
| partitioner strategies | acks=all is not sufficient if replication or minimum ISR is misconfigured. |
Failure-recovery drill: Producers
- Foundation: implement or demonstrate acks=0/1/all acknowledgments with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine acks=0/1/all acknowledgments with batching: batch.size + linger.ms. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for partitioner strategies. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
3. Consumers & consumer groups
The Consumers & consumer groups unit begins with poll loop + offset commit strategies: A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. Commit only after the corresponding side effects are durable and make the handler idempotent. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Consumers & consumer groups
| Concept | Meaning | Engineering decision |
|---|---|---|
| poll loop + offset commit strategies | A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
| consumer group partition assignment | A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
| #consumers ≤ #partitions rule | A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
| rebalancing: eager vs cooperative-sticky | A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
| consumer lag monitoring | A consumer group divides partitions so one member owns a partition at a time; committed offsets represent recoverable progress. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
Message and failure lifecycle: Consumers & consumer groups
poll loop + offset commit strategies. Polling drives heartbeats and fetches. Rebalances revoke and reassign ownership. Commit-before-processing risks loss; commit-after-processing permits duplicates.
consumer group partition assignment. Polling drives heartbeats and fetches. Rebalances revoke and reassign ownership. Commit-before-processing risks loss; commit-after-processing permits duplicates.
#consumers ≤ #partitions rule. Polling drives heartbeats and fetches. Rebalances revoke and reassign ownership. Commit-before-processing risks loss; commit-after-processing permits duplicates.
rebalancing: eager vs cooperative-sticky. Polling drives heartbeats and fetches. Rebalances revoke and reassign ownership. Commit-before-processing risks loss; commit-after-processing permits duplicates.
consumer lag monitoring. Polling drives heartbeats and fetches. Rebalances revoke and reassign ownership. Commit-before-processing risks loss; commit-after-processing permits duplicates.
Read these as one system: poll loop + offset commit strategies establishes the starting contract, consumer group partition assignment changes how that contract is executed or represented, and consumer lag monitoring exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Consumers & consumer groups
1message = consumer.poll(1.0); handle(message); consumer.commit(message=message, asynchronous=False)This Consumers & consumer groups slice makes poll loop + offset commit strategies observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward consumer lag monitoring, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Consumers & consumer groups
| Risk | Why it matters |
|---|---|
| poll loop + offset commit strategies | Slow processing beyond poll limits causes rebalances and duplicate work. |
| consumer group partition assignment | Slow processing beyond poll limits causes rebalances and duplicate work. |
| #consumers ≤ #partitions rule | Slow processing beyond poll limits causes rebalances and duplicate work. |
| rebalancing: eager vs cooperative-sticky | Slow processing beyond poll limits causes rebalances and duplicate work. |
| consumer lag monitoring | Slow processing beyond poll limits causes rebalances and duplicate work. |
Failure-recovery drill: Consumers & consumer groups
- Foundation: implement or demonstrate poll loop + offset commit strategies with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine poll loop + offset commit strategies with consumer group partition assignment. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for consumer lag monitoring. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
4. Event model & compression
The Event model & compression unit begins with event fact vs command/message intent: Kafka records carry key, value, timestamp, headers, and metadata; events state facts while commands express requested intent. Batch compression trades CPU for network, broker storage, and page-cache efficiency. Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Event model & compression
| Concept | Meaning | Engineering decision |
|---|---|---|
| event fact vs command/message intent | Kafka records carry key, value, timestamp, headers, and metadata; events state facts while commands express requested intent. Batch compression trades CPU for network, broker storage, and page-cache efficiency. | Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. |
| key/value/header/timestamp record anatomy | Kafka records carry key, value, timestamp, headers, and metadata; events state facts while commands express requested intent. Batch compression trades CPU for network, broker storage, and page-cache efficiency. | Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. |
| gzip/snappy/lz4/zstd compression trade-offs | Kafka records carry key, value, timestamp, headers, and metadata; events state facts while commands express requested intent. Batch compression trades CPU for network, broker storage, and page-cache efficiency. | Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. |
| ordering scope and hot partition diagnosis | Kafka records carry key, value, timestamp, headers, and metadata; events state facts while commands express requested intent. Batch compression trades CPU for network, broker storage, and page-cache efficiency. | Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. |
Message and failure lifecycle: Event model & compression
event fact vs command/message intent. Compression is applied to producer batches: better batching improves ratio. Keys choose partitions, so skewed business identities create hot leaders regardless of total partition count.
key/value/header/timestamp record anatomy. Compression is applied to producer batches: better batching improves ratio. Keys choose partitions, so skewed business identities create hot leaders regardless of total partition count.
gzip/snappy/lz4/zstd compression trade-offs. Compression is applied to producer batches: better batching improves ratio. Keys choose partitions, so skewed business identities create hot leaders regardless of total partition count.
ordering scope and hot partition diagnosis. Compression is applied to producer batches: better batching improves ratio. Keys choose partitions, so skewed business identities create hot leaders regardless of total partition count.
Read these as one system: event fact vs command/message intent establishes the starting contract, key/value/header/timestamp record anatomy changes how that contract is executed or represented, and ordering scope and hot partition diagnosis exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Event model & compression
1event = {"event_id": event_id, "type": "event_fact_vs_command_message_intent.v1", "payload": payload}2producer.produce(topic, key=entity_id, value=encode(event), on_delivery=delivered)3producer.poll(0)This Event model & compression slice makes event fact vs command/message intent observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward ordering scope and hot partition diagnosis, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Event model & compression
| Risk | Why it matters |
|---|---|
| event fact vs command/message intent | Random keys remove ordering; one celebrity/tenant key can cap throughput at one partition. |
| key/value/header/timestamp record anatomy | Random keys remove ordering; one celebrity/tenant key can cap throughput at one partition. |
| gzip/snappy/lz4/zstd compression trade-offs | Random keys remove ordering; one celebrity/tenant key can cap throughput at one partition. |
| ordering scope and hot partition diagnosis | Random keys remove ordering; one celebrity/tenant key can cap throughput at one partition. |
Failure-recovery drill: Event model & compression
- Foundation: implement or demonstrate event fact vs command/message intent with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine event fact vs command/message intent with key/value/header/timestamp record anatomy. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for ordering scope and hot partition diagnosis. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
Complete worked example
This example integrates the chapter rather than demonstrating an isolated method.
1from confluent_kafka import Producer2import json3
4producer = Producer({5 "bootstrap.servers": "kafka:9092",6 "acks": "all",7 "enable.idempotence": True,8 "compression.type": "zstd",9 "linger.ms": 10,10})11
12def publish_order(order_id: str, payload: dict) -> None:13 producer.produce(14 "orders.v1",15 key=order_id.encode(),16 value=json.dumps(payload).encode(),17 on_delivery=lambda error, message: record_delivery(order_id, error, message),18 )19 producer.poll(0)Expected result
1Records for one order_id map consistently to a partition; callbacks report final delivery outcomes.Line-by-line reading
| Line | Code | Explanation |
|---|---|---|
| 1 | from confluent_kafka import Producer | Imports the named dependency; import executes the module once per interpreter cache and binds selected names here. |
| 2 | import json | Imports the named dependency; import executes the module once per interpreter cache and binds selected names here. |
| 4 | producer = Producer({ | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 5 | "bootstrap.servers": "kafka:9092", | Implements the next python statement in the example's data flow. |
| 6 | "acks": "all", | Implements the next python statement in the example's data flow. |
| 7 | "enable.idempotence": True, | Implements the next python statement in the example's data flow. |
| 8 | "compression.type": "zstd", | Implements the next python statement in the example's data flow. |
| 9 | "linger.ms": 10, | Implements the next python statement in the example's data flow. |
| 10 | }) | Implements the next python statement in the example's data flow. |
| 12 | def publish_order(order_id: str, payload: dict) -> None: | Defines a function; its parameters form the explicit input boundary. |
| 13 | producer.produce( | Implements the next python statement in the example's data flow. |
| 14 | "orders.v1", | Implements the next python statement in the example's data flow. |
| 15 | key=order_id.encode(), | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 16 | value=json.dumps(payload).encode(), | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 17 | on_delivery=lambda error, message: record_delivery(order_id, error, message), | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 18 | ) | Implements the next python statement in the example's data flow. |
| 19 | producer.poll(0) | Implements the next python statement in the example's data flow. |
Step-by-step execution
- The producer validates and serializes a versioned record, hashes its key to a partition, batches it, and sends it to that partition's leader under the configured acknowledgment policy.
- The broker appends the record at the next partition offset and replicates it; durability depends on acknowledgments, in-sync replicas, and minimum-ISR settings together.
- A group member polls assigned partitions, deserializes the record, checks event identity, and performs its bounded idempotent side effect.
- Recoverable progress advances only after the corresponding effect is durable, or a Kafka transaction atomically publishes output and offsets for Kafka-to-Kafka work.
- Tests inject duplicate delivery, rebalance, poison data, broker interruption, and lag while asserting ordering only within the declared key scope.
Common mistakes and professional corrections
| Area | Common failure | Better engineering choice |
|---|---|---|
| Core concepts | Offsets are only unique within a partition; compaction does not preserve every intermediate event. | Choose keys for ordering and partitions for required parallelism and future load. |
| Producers | acks=all is not sufficient if replication or minimum ISR is misconfigured. | Enable idempotence, use stable keys, and handle delivery callbacks. |
| Consumers & consumer groups | Slow processing beyond poll limits causes rebalances and duplicate work. | Commit only after the corresponding side effects are durable and make the handler idempotent. |
| Event model & compression | Random keys remove ordering; one celebrity/tenant key can cap throughput at one partition. | Prefer zstd or lz4 after measurement, keep commands and facts semantically distinct, and monitor bytes/records/lag per partition. |
Interview and review notes
- Define the central abstraction without naming a library function.
- Trace one request, call, query, message, render, or state transition from input to observable result.
- Compare two alternatives from this chapter by guarantee, cost, and failure behavior.
- Explain the most likely production bug and the test or metric that reveals it.
- State what remains authoritative after process loss, retry, reconnect, or deployment.
Practice set
Easy
- Define every bold term in the concept tables in one precise sentence.
- Reproduce the focused examples and annotate the value or state after each important line.
- Explain the chapter progression diagram aloud in two minutes.
Medium
- Replace one convenient default with an explicit policy for validation, timeout, ordering, pagination, cleanup, or error handling.
- Write a negative test for each topic group.
- Compare the measured behavior before and after one justified change.
Hard
- Combine all topic groups into one thin vertical slice.
- Inject a realistic failure at the most important external boundary and prove recovery.
- Write a one-page design note covering ownership, trade-offs, security, observability, and rollback.
Chapter submission
Submit:
- source code or reproducible commands;
- automated tests plus one deliberately failing-before-fix test;
- captured output, query plan, trace, screenshot, or metric;
- a 300–500 word explanation of the execution flow and one rejected alternative;
- a short README with setup, versions, limitations, and cleanup steps.
- Continue with the Order Processing System project workshop.
Self-review rubric
| Dimension | Beginning | Competent | Professional |
|---|---|---|---|
| Explanation | Names APIs | Explains behavior | Connects guarantees, internals, and trade-offs |
| Implementation | Happy path only | Validated and tested | Clear ownership, failure recovery, and cleanup |
| Evidence | Manual claim | Repeatable output | Tests plus meaningful measurement or inspection |
| Communication | Steps missing | Reproducible README | Decisions, limits, and alternatives are explicit |
Roadmap coverage checklist
- To do: Core concepts: topics/partitions/offsets architecture
- To do: Core concepts: retention (time-based vs size-based)
- To do: Core concepts: log compaction
- To do: Core concepts: replication: leader/followers/ISR
- To do: Core concepts: KRaft mode (no ZooKeeper, Kafka 3.3+)
- To do: Producers: acks=0/1/all acknowledgments
- To do: Producers: batching: batch.size + linger.ms
- To do: Producers: idempotent producer
- To do: Producers: partitioner strategies
- To do: Consumers & consumer groups: poll loop + offset commit strategies
- To do: Consumers & consumer groups: consumer group partition assignment
- To do: Consumers & consumer groups: #consumers ≤ #partitions rule
- To do: Consumers & consumer groups: rebalancing: eager vs cooperative-sticky
- To do: Consumers & consumer groups: consumer lag monitoring
- To do: Event model & compression: event fact vs command/message intent
- To do: Event model & compression: key/value/header/timestamp record anatomy
- To do: Event model & compression: gzip/snappy/lz4/zstd compression trade-offs
- To do: Event model & compression: ordering scope and hot partition diagnosis
Quick revision
- Core concepts: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Producers: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Consumers & consumer groups: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Event model & compression: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Re-read the worked-example execution trace instead of memorizing isolated syntax.
- If you cannot name the owner of state and cleanup, the design is not yet complete.
Mastery check
How well can you recall this?
Finished this lesson?