Skip to content
Kafka Is FunProgress

AdvancedPerformance

How would you diagnose and fix high producer latency (P99 > 500ms)?

Reference answer

Diagnosis: 1) Check producer-metrics:record-queue-time-avg (time in RecordAccumulator — high = linger.ms too high or partition pressure). 2) Check request-latency-avg (network + broker time). 3) Check kafka.network:RequestHandlerAvgIdlePercent (broker CPU). 4) Check if acks=all with large ISR — replica lag causing purgatory timeout. 5) Check for GC spikes on producer JVM. Fixes: Reduce linger.ms, increase partition count (spread load), reduce batch.size, investigate broker hardware bottlenecks, tune GC, check network latency between producer and broker, verify replica.lag.time.max.ms isn't too tight.

Expected key concepts: record-queue-time-avg, request-latency-avg, RequestHandlerAvgIdlePercent, ISR, purgatory, GC spikes, linger.ms, partition count, network latency, replica.lag.time.max.ms