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.
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
- Watch
- Try it
- Predict
- Capture
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.
Highlighted lines are the ones running in the diagram right now.
bootstrap.servers=broker-1:9092,broker-2:9092acks=0 # 0 fire-and-forgetacks=1 # 1 leader-only ackacks=all # all in-ISR replicasenable.idempotence=true # PID + seq# dedupe retriestransactional.id=clickstream-tx-1# cross-session epoch fencingcompression.type=lz4 # batch-level; cheap throughputlinger.ms=20 # fill batches before sendingmax.in.flight.requests.per.connection=5
broker.id=1log.dirs=/var/lib/kafka/datadefault.replication.factor=<RF>min.insync.replicas=<MIR> # floor on the ISR# rule of thumb: MIR = RF - 1unclean.leader.election.enable=false# silent loss > unavailabilityreplica.lag.time.max.ms=30000# ISR eviction thresholdlog.retention.ms=604800000 # 7d default; per-topic overrideslog.cleanup.policy=delete # not compact: events expire
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.
Designs that use this
- Twitter / X TimelinePush or pull? Both. The canonical fanout problem.
- Uber / Lyft — Match Drivers and RidersMatch a rider to the closest acceptable driver in under 3 s. Geohash, S2, surge.
- Slack / DiscordChannels and history. Push or pull — and how a hot-channel fanout doesn't melt the gateway.
- WhatsApp / MessengerHundreds of millions of long-lived sockets, sub-second 1:1 + group delivery, E2E-encrypted, multi-device, multi-region active-active.