Learn Labs
3. Kafka Producers: Writing Messages to Kafka

3.15 Self-test

Self-test26 questions

—/26
  1. Name the three mandatory producer properties. Why is key.serializer required even when you never set a key?

  2. Walk the record through the producer: what happens on the app thread vs the sender thread, and in what order?

  3. send() is described as "always asynchronous." What then is a "synchronous send," and what does it cost?

  4. Fire-and-forget still throws some exceptions. Which ones, and what do they have in common?

  5. Give two retriable errors and one non-retriable one. What determines the category?

  6. Why does acks=all cost nothing in end-to-end latency? What does it cost?

  7. Draw the delivery-time timeline and place max.block.ms, linger.ms, request.timeout.ms, delivery.timeout.ms.

  8. Why does the book tell you to stop tuning retries and tune delivery.timeout.ms instead? Give the mental script.

  9. Exactly how do retries > 0 and max.in.flight > 1 reorder your data? What's the correct fix, and why isn't max.in.flight=1?

  10. 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?

  11. What's the difference between batch.size and linger.ms? Which one makes the producer wait?

  12. Why does raising linger.ms improve compression ratio specifically?

  13. Why is buffer.memory exhaustion thrown by send() rather than the Future, and why does that matter for your error handling?

  14. Callbacks run on the producer's main thread. Name the guarantee that buys you and the failure mode it creates.

  15. Keyed records hash over all partitions, not just available ones. Why, and what does that cost you?

  16. What changed about null-key partitioning in Kafka 2.4, and what three benefits does it produce?

  17. When would you deliberately use UniformStickyPartitioner on records that have keys?

  18. You need to add partitions to a keyed topic. What breaks? What's the book's advice?

  19. List four reasons the hand-written CustomerSerializer is a liability.

  20. In the Avro fax→email example, what happens when a new app reads an old record? An old app reads a new record?

  21. Why can't you just embed the Avro schema in each Kafka record like you would in an Avro file?

  22. What are the two Avro caveats the book insists on?

  23. What can onSend() do that onAcknowledgement() cannot?

  24. Name a use case where headers are strictly better than putting the metadata in the value.

  25. Describe both mechanisms a broker uses to throttle a client over quota. Why are there two?

  26. 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