linger.ms — Kafka Producer Configuration
The producer groups together any records that arrive in between request transmissions into a single batched request. Normally this occurs only under load when records arrive faster than they can be sent out
Description
The producer groups together any records that arrive in between request transmissions into a single batched request. Normally this occurs only under load when records arrive faster than they can be sent out. However in some circumstances the client may want to reduce the number of requests even under moderate load. This setting accomplishes this by adding a small amount of artificial delay—that is, rather than immediately sending out a record, the producer will wait for up to the given delay to allow other records to be sent so that the sends can be batched together. This can be thought of as analogous to Nagle's algorithm in TCP. This setting gives the upper bound on the delay for batching: once we get batch.size worth of records for a partition it will be sent immediately regardless of this setting, however if we have fewer than this many bytes accumulated for this partition we will 'linger' for the specified time waiting for more records to show up. This setting defaults to 5 (i.e. 5ms delay). Increasing linger.ms=50, for example, would have the effect of reducing the number of requests sent but would add up to 50ms of latency to records sent in the absence of load.The default changed from 0 to 5 in Apache Kafka 4.0 as the efficiency gains from larger batches typically result in similar or lower producer latency despite the increased linger.
Default Values by Kafka Version
| Component | Kafka version line | Documented default |
|---|---|---|
| Producer | 0.8.1 | 0 |
| Producer | 0.8.2 | 0 |
| Producer | 0.9.0 | 0 |
| Producer | 0.10.0 | 0 |
| Producer | 0.10.1 | 0 |
| Producer | 0.10.2 | 0 |
| Producer | 0.11.0 | 0 |
| Producer | 1.0 | 0 |
| Producer | 1.1 | 0 |
| Producer | 2.0 | 0 |
| Producer | 2.1 | 0 |
| Producer | 2.2 | 0 |
| Producer | 2.3 | 0 |
| Producer | 2.4 | 0 |
| Producer | 2.5 | 0 |
| Producer | 2.6 | 0 |
| Producer | 2.7 | 0 |
| Producer | 2.8 | 0 |
| Producer | 3.0 | 0 |
| Producer | 3.1 | 0 |
| Producer | 3.2 | 0 |
| Producer | 3.3 | 0 |
| Producer | 3.4 | 0 |
| Producer | 3.5 | 0 |
| Producer | 3.6 | 0 |
| Producer | 3.7 | 0 |
| Producer | 3.8 | 0 |
| Producer | 3.9 | 0 |
| Producer | 4.0 | 5 |
| Producer | 4.1 | 5 |
| Producer | 4.2 | 5 |
| Producer | 4.3 | 5 |
| Producer | 4.4 | 5 |
Tuning Recommendation
Workload-dependent proposals, not benchmarked defaults. Review the versioned Config Advisor before applying.
| Profile | Proposal | Rationale and tradeoff |
|---|---|---|
| producer / throughput | 20 | Sets the intentional batching wait. Full batches can be sent earlier; zero removes this wait but does not prevent batching. Tradeoff: A larger value can delay partially filled batches. Queueing and broker backpressure can add other delays. Reference · 2026-10-27 |
| producer / latency | 0 | Sets the intentional batching wait. Full batches can be sent earlier; zero removes this wait but does not prevent batching. Tradeoff: A larger value can delay partially filled batches. Queueing and broker backpressure can add other delays. Reference · 2026-10-27 |
Related Configs
batch.size · buffer.memory · request.timeout.ms · delivery.timeout.ms · compression.type