Kafka: Tune fetch.min.bytes to trade latency for efficiency

The broker waits until it has this much data, or until fetch.max.wait.ms elapses.

Code
props.put(ConsumerConfig.FETCH_MIN_BYTES_CONFIG, 64 * 1024);
props.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG, 500);
Output
fetch.min.bytes=1     : a fetch per record, chatty on a quiet topic
fetch.min.bytes=65536 : far fewer round trips, up to 500ms extra latency
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-11