Kafka Broker Latency Configuration
Review request queues and replication behavior against measured latency tails.
broker
| Config / reference | Default → proposal | Rationale and conditions |
|---|---|---|
| Replication | ||
| replica.socket.receive.buffer.bytes Broker 4.4 Evaluate | 64 KiB → 4 MiB | Requests the receive socket buffer for follower replication traffic. Tradeoff: More buffer space can increase kernel memory and may not help if the OS/network is not limiting replication. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Changing it without observing replication network throughput and socket limits. Measure: follower lag, replication bytes and socket memory Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| replica.lag.time.max.ms Broker 4.4 Keep | 30 s (unchanged) | Sets the lag interval used when considering removal of an out-of-date follower from ISR. Tradeoff: A shorter interval can shrink ISR during pauses and reduce write availability with acks=all. It does not necessarily trigger a leader election. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: Lowering it to improve latency without observing follower lag and pause behavior. Measure: ISR shrink/expand rate, UnderMinIsrPartitionCount and follower lag An aggressive lag timeout can shrink ISR during pauses and block writes below minimum ISR. ISR removal is not itself always a leader election. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| num.replica.fetchers Broker 4.4 Evaluate | 1 → 4 | Sets follower replication fetcher concurrency for each source broker. Tradeoff: More fetchers can increase CPU, connections and disk activity without increasing storage capacity. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: Replication limited by disk or network capacity rather than fetcher concurrency. Measure: follower lag, UnderReplicatedPartitions, disk and network throughput Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Other controls | ||
| leader.imbalance.check.interval.seconds Broker 4.4 Evaluate | 300 s → 60 s | Sets how often automatic preferred-leader balancing checks run when enabled. Tradeoff: A shorter interval adds checks and may cause more leadership movement; it is not a direct latency tuning control. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: A cluster where automatic leader rebalancing is disabled or leadership movement is undesirable. Measure: leader distribution, leader movement and request latency Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Threading and queues | ||
| num.network.threads Broker 4.4 Evaluate | 3 → 8 | Sets the broker network processing thread count per relevant listener. Increase only when network processing is a measured bottleneck. Tradeoff: More threads consume resources and may add contention. Controller listeners have distinct handling. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: CPU saturation or no evidence of network thread pressure. Measure: NetworkProcessorAvgIdlePercent, request queue time and broker CPU Queue and thread changes need measured bottlenecks. There is no general queue-size formula based only on connection count, or generic QUEUE_FULL Kafka protocol error. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| num.io.threads Broker 4.4 Evaluate | 8 → 16 | Sets broker request-processing concurrency. Match it to CPU, disks and request mix. Tradeoff: More concurrency can increase disk and CPU contention on both HDDs and SSDs. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: A saturated storage device or CPU without a throughput gain from added concurrency. Measure: RequestHandlerAvgIdlePercent, disk latency, request queue time and CPU Queue and thread changes need measured bottlenecks. There is no general queue-size formula based only on connection count, or generic QUEUE_FULL Kafka protocol error. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| queued.max.requests Broker 4.4 Evaluate | 500 → 200 | Bounds queued requests before network processing stops reading more requests. Tradeoff: Larger queues can absorb bursts but add memory and queueing latency. Smaller queues apply backpressure sooner; there is no generic QUEUE_FULL protocol error. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: Choosing the limit from connection count alone. Measure: RequestQueueSize, RequestQueueTimeMs and memory Queue and thread changes need measured bottlenecks. There is no general queue-size formula based only on connection count, or generic QUEUE_FULL Kafka protocol error. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Network and buffers | ||
| socket.send.buffer.bytes Broker 4.4 Keep | 100 KiB (unchanged) | Requests the broker TCP send buffer size. The operating system controls the effective buffer. Tradeoff: Socket memory and OS limits matter across active connections. The configured value is not necessarily preallocated in full per connection. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: A change without a measured network bottleneck and socket-memory budget. Measure: effective socket buffers, kernel memory, throughput and RTT Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| socket.receive.buffer.bytes Broker 4.4 Keep | 100 KiB (unchanged) | Requests the broker TCP receive buffer size. Tradeoff: Larger buffers can consume more kernel memory; smaller buffers can constrain throughput depending on the network path. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: Treating a smaller buffer as a guaranteed latency improvement. Measure: effective socket buffers, receive throughput and request latency Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Segments, compaction and flush | ||
| log.flush.interval.messages Broker 4.4 Keep | no practical count trigger (9223372036854775807) (unchanged) | Controls count-triggered flushing of log data. Keep the default unless an explicit storage durability policy requires more frequent flushes. Tradeoff: Per-record flushing can severely increase I/O. Replication and minimum ISR remain necessary; fsync is not an end-to-end loss guarantee. Workload, validation and sourcesWorkload: A self-managed broker whose request queueing and replication behavior have been measured. Avoid when: Using per-record fsync as a blanket durability profile. Measure: flush time/rate, disk latency, throughput and replication health Frequent fsync is an explicit storage-policy tradeoff, not a blanket durability improvement. Replication and ISR requirements remain necessary. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |