conduktor.io ↗

batch.size — Kafka Producer Configuration

The producer will attempt to batch records together into fewer requests whenever multiple records are being sent to the same partition. This helps performance on both the client and the server

Description

The producer will attempt to batch records together into fewer requests whenever multiple records are being sent to the same partition. This helps performance on both the client and the server. This configuration controls the default batch size in bytes.No attempt will be made to batch records larger than this size.Requests sent to brokers will contain multiple batches, one for each partition with data available to be sent.A small batch size will make batching less common and may reduce throughput (a batch size of zero will disable batching entirely). A very large batch size may use memory a bit more wastefully as we will always allocate a buffer of the specified batch size in anticipation of additional records.Note: This setting gives the upper bound of the batch size to be sent. If we have fewer than this many bytes accumulated for this partition, we will 'linger' for the linger.ms time waiting for more records to show up. This linger.ms setting defaults to 5, which means the producer will wait for 5ms or until the record batch is of batch.size (whichever happens first) before sending the record batch. Note that broker backpressure can result in a higher effective linger time than this setting. 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.Type:intDefault:16384Valid Values:[0,...]Importance:medium

Default Values by Kafka Version

ComponentKafka version lineDocumented default
Producer0.7200
Producer0.8.116384
Producer0.8.216384
Producer0.9.016384
Producer0.10.016384
Producer0.10.116384
Producer0.10.216384
Producer0.11.016384
Producer1.016384
Producer1.116384
Producer2.016384
Producer2.116384
Producer2.216384
Producer2.316384
Producer2.416384
Producer2.516384
Producer2.616384
Producer2.716384
Producer2.816384
Producer3.016384
Producer3.116384
Producer3.216384
Producer3.316384
Producer3.416384
Producer3.516384
Producer3.616384
Producer3.716384
Producer3.816384
Producer3.916384
Producer4.016384
Producer4.116384
Producer4.216384
Producer4.316384
Producer4.416384

Tuning Recommendation

Workload-dependent proposals, not benchmarked defaults. Review the versioned Config Advisor before applying.

ProfileProposalRationale and tradeoff
producer / throughput131072Sets the allocation target for a batch for one partition; fuller batches can amortize request overhead.

Tradeoff: Larger batches can consume more buffer memory without filling at low traffic.

Reference · 2026-10-27
producer / latency16384Sets the allocation target for a batch for one partition; fuller batches can amortize request overhead.

Tradeoff: Larger batches can consume more buffer memory without filling at low traffic.

Reference · 2026-10-27

Related Configs

linger.ms · buffer.memory · max.request.size · compression.type · send.buffer.bytes · max.block.ms

Manage Kafka configs across all your clusters with Conduktor Console — view, compare, and update configurations in one place.