What is the proper config in the latest Kafka for what `queue.buffering.max.ms` originally provided?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Apache Kafka, a highly-effective distributed streaming platform, has continually evolved to better meet the needs of its users. Configuration properties play a crucial role in fine-tuning Kafka's performance according to specific requirements. In earlier versions of Kafka, queue.buffering.max.ms was a key property utilized within producer configurations to manage message buffering time. However, with updates and enhancements in Kafka, this configuration has been deprecated and replaced to further improve efficiency and producer behavior.
Understanding queue.buffering.max.ms
Previously, queue.buffering.max.ms was used to specify the maximum time the Kafka producer would wait before sending messages to the broker, regardless of whether batch.size was reached. This setting offered a way to manage throughput and latency when sending messages:
- Low values of
queue.buffering.max.msreduced latency as messages were sent more frequently. - High values increased throughput as more messages were batched together before sending.
The objective was to balance batching enough records to maximize throughput while not delaying the sending of messages longer than necessary, thereby preventing undesired latency.
Current Equivalent Configuration: linger.ms
In more recent versions of Kafka, queue.buffering.max.ms has been deprecated and replaced by linger.ms. The linger.ms property provides similar functionality but with clearer naming and better defaults that align with modern use cases and performance understandings.
The linger.ms configuration controls the amount of time, in milliseconds, the producer waits before sending a batch of messages, even if the batch size hasn't been reached yet. Here is how it functions:
- Batch Not Full: If the batch isn’t full,
linger.msdefines how long the messages are held back before they are sent to the brokers. - Batch Full: If the batch size criteria (
batch.size) are met before the time specified inlinger.msexpires, the messages are sent immediately.
By fine-tuning linger.ms, producers can effectively manage the trade-off between latency and throughput.
Example Configuration Usage
Here's how to set linger.ms in a Kafka producer configuration:
In this configuration, setting linger.ms to 5 ms instructs the producer to wait for up to 5 milliseconds to send messages in the hope of sending larger batches, potentially increasing throughput.
Key Differences and Comparative Summary
| Aspect | queue.buffering.max.ms | linger.ms |
| Purpose | Buffering time management | Controls delay before batch send |
| Configuration Objective | Balance throughput & latency | Similarly balances throughput & latency, but with clearer definition |
| Default Value | Not specified (varied) | 0 milliseconds (send immediately when batch is full) |
| Impact on Throughput | Increase with higher values | Same, controlled by batch.size |
| Impact on Latency | Lower with smaller values | Direct control with precise timing |
Final Thoughts
Understanding the shift from queue.buffering.max.ms to linger.ms is crucial for developers and administrators working with Kafka to ensure efficient message handling and optimal configuration of Kafka producers. The change reflects Kafka's ongoing improvements and the project's commitment to clarity and performance.
For detailed guidance and the latest updates, refer to the official Apache Kafka documentation. It is always essential to keep track of Kafka version upgrades and respective changes in configuration properties. Additional performance tuning parameters may also be considered in conjunction with linger.ms to achieve desired operational outcomes.

