Overview
send() is asynchronous. Once metadata is available and the record has been serialized and assigned a partition, the record is added to a buffer of pending sends, organised per partition, and send() returns; a background I/O thread turns buffered records into requests. send() can block for up to max.block.ms while it waits for metadata or for buffer space. linger.ms is an upper bound on how long to wait for more records: once batch.size worth of records for a partition is ready, it is sent immediately. Together the two settings let you trade a little latency for better batching.
Key configuration
linger.ms=5 — the default since Kafka 4.0 (it was 0 before)
linger.ms=0 — send as soon as possible
batch.size=16384 — default, per partition
buffer.memory=33554432 — default, 32 MiB of memory for buffering records waiting to be sentProduction tip
Check yourself
What happens to a record when you call producer.send()?
Sources
- Producer configs (4.2 documentation) (opens in a new tab)
- KafkaProducer Javadoc (4.2) (opens in a new tab)
- Design (4.2 documentation) (opens in a new tab)
Checked against Kafka 4.2 documentation on Oct 2026. Draft: not yet reviewed by a Kafka specialist. Releases move on, so confirm against the current documentation before you act on a number.