Bird
0
0

What will happen if you set batch.size to a very large value but keep linger.ms at 0 in Kafka producer?

medium📝 Predict Output Q5 of 15
Kafka - Performance Tuning
What will happen if you set batch.size to a very large value but keep linger.ms at 0 in Kafka producer?
AProducer waits indefinitely to fill the batch
BProducer sends batches immediately, possibly smaller than batch.size
CProducer throws an error due to invalid configuration
DProducer compresses batches more aggressively
Step-by-Step Solution
Solution:
  1. Step 1: Understand linger.ms = 0 effect

    With linger.ms set to 0, the producer sends batches immediately without waiting to fill them.
  2. Step 2: Effect of large batch.size with zero linger

    Even if batch.size is large, batches may be smaller because producer does not wait to accumulate more messages.
  3. Final Answer:

    Producer sends batches immediately, possibly smaller than batch.size -> Option B
  4. Quick Check:

    linger.ms=0 means no wait, immediate send [OK]
Quick Trick: linger.ms=0 sends batches immediately [OK]
Common Mistakes:
MISTAKES
  • Thinking producer waits to fill batch with linger.ms=0
  • Assuming error occurs with large batch.size
  • Confusing batch size with compression

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes