4.15 Self-test
Self-test33 questions
Why does adding a 5th consumer to a 4-partition topic do nothing? What's the general rule?
When do you create a new consumer group vs add a consumer to an existing one?
List the three events that trigger a rebalance.
Contrast eager and cooperative rebalance phase-by-phase. Which partitions keep flowing in each?
There are two independent mechanisms for detecting a dead consumer. Name both, and explain the specific failure each one catches that the other cannot.
Why does a clean
close()reduce downtime compared to a crash?Who computes partition assignments — a broker or a client? What does each consumer get to see?
What does
group.instance.idchange, and what new risk does it introduce?Why is tuning
session.timeout.msharder under static membership?Why is the
poll()line called "the most important line in the chapter"?Name three things
poll()does besides fetching records. Why does that make it the source of most consumer exceptions?Producers are thread-safe; consumers are not. What are the two supported concurrency patterns?
What changed between
poll(long)andpoll(Duration), and what's the standard replacement for thepoll(0)hack?Explain
fetch.min.bytes+fetch.max.wait.msas a pair. What does each protect?Why does the book prefer
fetch.max.bytesovermax.partition.fetch.bytes?What's the relationship between
max.poll.recordsandmax.poll.interval.ms?Why is lowering
request.timeout.mscounterproductive during an incident?Give the three
auto.offset.resetvalues and the specific risk of each.Draw the two offset failure modes (committed < processed, committed > processed) and name the consequence of each.
Precisely which offset gets committed by default, and what's the manual-commit rule?
Autocommit + an exception mid-batch +
continue= what bug? Trace it.Why does
commitAsync()deliberately not retry? Give the 2000/3000 trace.Describe the sequence-number pattern for safe async commit retries.
Why is
commitAsync()in the loop pluscommitSync()on shutdown the standard shape?You need to commit mid-batch. Why can't you just call
commitSync()?Which rebalance-listener method commits offsets, and why must it be sync?
What's the ordering guarantee across
onPartitionsRevoked()andonPartitionsAssigned(), and why does it matter?When is
onPartitionsLost()called, what's the hazard, and what happens if you don't implement it?What's the only consumer method safe to call from another thread? What exception does it produce, and where?
Two ways regex subscription can bite you on a large cluster.
offsets.retention.minutesis a broker config. Describe the consumer-visible failure it causes.subscribe()vsassign(): list what you gain and what you give up. What silently stops working withassign()?Your output database was wiped. How do you rebuild it from Kafka, and what bounds whether you can?
Previous: Chapter 3 — Kafka Producers Next: Chapter 5 — Managing Kafka Programmatically