Bird
0
0

A Kafka producer has batch.size=32768 and compression.type=snappy, but messages are still sent uncompressed. What is a likely cause?

medium📝 Debug Q7 of 15
Kafka - Performance Tuning
A Kafka producer has batch.size=32768 and compression.type=snappy, but messages are still sent uncompressed. What is a likely cause?
AThe producer is sending single messages larger than batch.size, so compression is skipped
BThe <code>compression.type</code> value 'snappy' is misspelled and ignored
CThe broker does not support snappy compression, so producer disables it
DThe <code>batch.size</code> is too large to enable compression
Step-by-Step Solution
Solution:
  1. Step 1: Understand compression behavior

    Kafka compresses batches, but if a single message exceeds batch.size, it is sent immediately without compression.
  2. Step 2: Check message size vs batch.size

    If messages are larger than 32 KB, compression won't be applied.
  3. Final Answer:

    The producer is sending single messages larger than batch.size, so compression is skipped -> Option A
  4. Quick Check:

    Large single messages bypass batch compression [OK]
Quick Trick: Single large messages skip compression [OK]
Common Mistakes:
  • Assuming broker disables compression
  • Believing misspelled compression.type is accepted
  • Thinking batch.size too large disables compression

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes