Design canvas — pick the knobs

Designing a Kafka pipeline is choosing within a triangle of trade-offs (throughput, durability, simplicity); each knob — partition count, RF, MIR, acks, group strategy, EOS — tilts the triangle and forces a deliberate choice rather than a default.

Previously

You've seen every knob — log shape, partitions, replication, durability, compaction, leader epoch, rebalance, exactly-once. Time to assemble them for a real workload, and tilt the throughput / durability / simplicity triangle deliberately rather than by default.

Scene 09

Design canvas — pick the knobs

  1. Watch
  2. Try it
  3. Predict
  4. Capture
Click-stream pipeline · 100k events/secTwo consumers: a real-time dashboard (latency-sensitive) and a daily warehouse loader (throughput-sensitive). Lost events lose revenue; downtime is unacceptable. Pick the knobs.CLUSTERRF=2 · partitions=3B11Pp0B21Pp1B31Pp2SINGLE GROUP (DASHBOARD + WAREHOUSE TOGETHER) · 3 consumersc1owns p0c2owns p1c3owns p2EOS LAYEROFFPIDproducer idEpochtxn epochGroup-Genrebalance genTRADE-OFFSThroughput1/5Durability1/5Complexity1/5WARNINGSacks=1: leader-only ack. A leader crash before fetch loses thewrite. Scene 4.100k/sec across 3 partitions ≈ 33k/sec each — single-broker hotspot.
What to watch for

This is the architecture-interview question. The defaults — P=3, RF=2, MIR=1, acks=1, single group, EOS=off — are wrong on purpose. Read the warnings, watch the trade-off bars, and feel where the design is exposed before you start tuning.

Continue unlocks when the animation finishes.
Implementation

Highlighted lines are the ones running in the diagram right now.

producer.properties
producer-side dials — durability contract & retry shape
bootstrap.servers=broker-1:9092,broker-2:9092
acks=0 # 0 fire-and-forget
acks=1 # 1 leader-only ack
acks=all # all in-ISR replicas
enable.idempotence=true # PID + seq# dedupe retries
transactional.id=clickstream-tx-1
# cross-session epoch fencing
compression.type=lz4 # batch-level; cheap throughput
linger.ms=20 # fill batches before sending
max.in.flight.requests.per.connection=5
server.properties (broker)
broker-side dials — replica policy & election safety
broker.id=1
log.dirs=/var/lib/kafka/data
default.replication.factor=<RF>
min.insync.replicas=<MIR> # floor on the ISR
# rule of thumb: MIR = RF - 1
unclean.leader.election.enable=false
# silent loss > unavailability
replica.lag.time.max.ms=30000
# ISR eviction threshold
log.retention.ms=604800000 # 7d default; per-topic overrides
log.cleanup.policy=delete # not compact: events expire
kafka-topics --alter (per-topic)
per-topic overrides — what the brief actually demands
kafka-topics.sh --bootstrap-server broker-1:9092 \
--create --topic clickstream \
--partitions <P> --replication-factor <RF> \
--config min.insync.replicas=<MIR> \
--config cleanup.policy=delete \
--config retention.ms=604800000 \
--config compression.type=producer \
--config segment.ms=3600000
# downstream consumer (warehouse / dashboard):
isolation.level=read_committed
# skip aborted txn markers

Where this sits in Build Kafka

Scene 09 of 13, in the Guarantees act — Three monotonic counters; one design canvas.. Capstone: apply scenes 2-8 to a fresh problem and articulate the trade-off you took.

All 13 scenes in Build Kafka · Every curriculum

Built with Arqly
Every scene in Build Kafka builds on the one before it.All 13 Build Kafka scenes