3.15 Self-test
Self-test26 questions
Name the three mandatory producer properties. Why is
key.serializerrequired even when you never set a key?Walk the record through the producer: what happens on the app thread vs the sender thread, and in what order?
send()is described as "always asynchronous." What then is a "synchronous send," and what does it cost?Fire-and-forget still throws some exceptions. Which ones, and what do they have in common?
Give two retriable errors and one non-retriable one. What determines the category?
Why does
acks=allcost nothing in end-to-end latency? What does it cost?Draw the delivery-time timeline and place
max.block.ms,linger.ms,request.timeout.ms,delivery.timeout.ms.Why does the book tell you to stop tuning
retriesand tunedelivery.timeout.msinstead? Give the mental script.Exactly how do
retries > 0andmax.in.flight > 1reorder your data? What's the correct fix, and why isn'tmax.in.flight=1?A broker wrote and replicated your record, then crashed before acking. What happens next, and why can't retry logic ever solve this on its own?
What's the difference between
batch.sizeandlinger.ms? Which one makes the producer wait?Why does raising
linger.msimprove compression ratio specifically?Why is
buffer.memoryexhaustion thrown bysend()rather than theFuture, and why does that matter for your error handling?Callbacks run on the producer's main thread. Name the guarantee that buys you and the failure mode it creates.
Keyed records hash over all partitions, not just available ones. Why, and what does that cost you?
What changed about null-key partitioning in Kafka 2.4, and what three benefits does it produce?
When would you deliberately use
UniformStickyPartitioneron records that have keys?You need to add partitions to a keyed topic. What breaks? What's the book's advice?
List four reasons the hand-written
CustomerSerializeris a liability.In the Avro fax→email example, what happens when a new app reads an old record? An old app reads a new record?
Why can't you just embed the Avro schema in each Kafka record like you would in an Avro file?
What are the two Avro caveats the book insists on?
What can
onSend()do thatonAcknowledgement()cannot?Name a use case where headers are strictly better than putting the metadata in the value.
Describe both mechanisms a broker uses to throttle a client over quota. Why are there two?
Trace the full buffer-exhaustion cascade from "sending too fast" to "TimeoutException," naming every config involved.
Previous: Chapter 2 — Installing Kafka Next: Chapter 4 — Kafka Consumers