High Kafka Broker Latency
Separate client-observed latency from broker queueing, local processing, replication wait, throttling, and response delivery.
Establish Scope
Section titled “Establish Scope”Identify the request types, percentiles, brokers, listeners, client IDs, topics, partitions, and start time. Compare affected and healthy brokers under similar traffic.
Check Request Phases
Section titled “Check Request Phases”Use Kafka request metrics and, for a bounded window, request logging:
| Phase | Likely pressure |
|---|---|
| Request queue | Network processors or request handlers saturated |
| Local time | CPU, disk, locks, serialization, metadata work |
| Remote time | Replica acknowledgement or delayed-operation wait |
| Throttle time | User/client/IP/request quota |
| Response queue/send | Network processors, bandwidth, slow client |
Correlate Resources
Section titled “Correlate Resources”vmstat 1 10iostat -xz 1 10ss -sjcmd <pid> GC.heap_infojcmd <pid> Thread.print -l > kafka-thread-dump.txtCheck request-handler and network-thread idle ratios, disk await, page-cache pressure, CPU steal/throttling, GC pauses, direct memory, retransmits, connection churn, replica lag, and controller event-queue latency.
Diagnose Common Patterns
Section titled “Diagnose Common Patterns”- Produce latency plus under-replication: followers or disks cannot acknowledge promptly.
- Fetch latency on a few partitions: hot leaders, remote tier fetches, or slow disks.
- All requests slow on one broker: host, JVM, disk, or network saturation.
- Administrative requests slow: controller/quorum or metadata pressure.
- Latency equals quota delay: expected enforcement, not raw broker processing.
Recover
Section titled “Recover”Remove the proven bottleneck: restore a failed disk/network path, rebalance hot leaders, correct quotas, reduce abusive clients, pause competing maintenance, or add capacity. Change thread counts and JVM settings only from measured saturation evidence.
Warning
Raising client timeouts hides symptoms and increases queued work. Do not run performance-test tools against a degraded production cluster without an approved load plan.
Verify
Section titled “Verify”Confirm end-to-end client latency and broker phase metrics return to baseline at normal traffic, queues drain, ISR remains healthy, and the improvement persists after the temporary containment is removed.