Skip to content
Kafka Is FunProgress

IntermediatePerformance

How would you tune a Kafka producer for maximum throughput?

Reference answer

Key tuning knobs: 1) linger.ms=20-100 (wait to fill batches). 2) batch.size=1048576 (1MB batches). 3) compression.type=lz4 or zstd (reduce payload size). 4) acks=1 if you can accept leader-only durability. 5) buffer.memory=134217728 (128MB buffer). 6) max.in.flight.requests.per.connection=5. 7) Increase partitions so multiple brokers handle writes in parallel. 8) Use multiple producer instances for very high throughput. 9) Reduce retries overhead with well-tuned retry.backoff.ms. For durability-sensitive throughput: use acks=all + enable.idempotence=true and compensate with more partitions.

Expected key concepts: linger.ms, batch.size, compression.type, lz4, acks=1, buffer.memory, max.in.flight.requests, partitions, enable.idempotence