Build Kafka (13 scenes)
Scene 09 · Design canvas — pick the knobs
Capstone: apply scenes 2-8 to a fresh problem and articulate the trade-off you took.
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
Diagram
A budget canvas: pick partition count, replication factor, min.insync.replicas, acks policy, group strategy, and EOS on/off from the controls on the left. The center renders the resulting cluster topology — brokers, replicas, consumer assignments. The right side lights up warning chips when your choices conflict (e.g. acks=all + min.insync.replicas=1 + unclean=true is a silent loss path).
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.
Implementation
producer.properties
producer-side dials — durability contract & retry shape
1bootstrap.servers=broker-1:9092,broker-2:90922acks=0 # 0 fire-and-forget3acks=1 # 1 leader-only ack4acks=all # all in-ISR replicas56enable.idempotence=true # PID + seq# dedupe retries7transactional.id=clickstream-tx-18 # cross-session epoch fencing910compression.type=lz4 # batch-level; cheap throughput11linger.ms=20 # fill batches before sending12max.in.flight.requests.per.connection=5
server.properties (broker)
broker-side dials — replica policy & election safety
1broker.id=12log.dirs=/var/lib/kafka/data34default.replication.factor=<RF>5min.insync.replicas=<MIR> # floor on the ISR6 # rule of thumb: MIR = RF - 17unclean.leader.election.enable=false8 # silent loss > unavailability910replica.lag.time.max.ms=3000011 # ISR eviction threshold12log.retention.ms=604800000 # 7d default; per-topic overrides13log.cleanup.policy=delete # not compact: events expire
kafka-topics --alter (per-topic)
per-topic overrides — what the brief actually demands
1kafka-topics.sh --bootstrap-server broker-1:9092 \2 --create --topic clickstream \3 --partitions <P> --replication-factor <RF> \4 --config min.insync.replicas=<MIR> \5 --config cleanup.policy=delete \6 --config retention.ms=604800000 \7 --config compression.type=producer \8 --config segment.ms=3600000910# downstream consumer (warehouse / dashboard):11isolation.level=read_committed12 # skip aborted txn markers