Measure all four knobs
The throughput / latency / durability triangle
Throughput in Kafka is governed by:
linger.ms— wait this long to fill a batch (latency cost, throughput win).batch.size— bigger batches → bigger savings per fsync.compression.type—zstd≈ best ratio,lz4≈ best speed,snappy≈ default sweet spot.acks—allhalves throughput vs1(typically).
Production benchmarking belongs in a real cluster with kafka-producer-perf-test.sh and the in-app code below — both. Don't tune blind.