Kafka Broker Throughput Configuration
Tune only measured network, CPU, disk or replication bottlenecks on self-managed brokers.
broker
| Config / reference | Default → proposal | Rationale and conditions |
|---|---|---|
| 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 with an identified CPU, network, replication or disk bottleneck. 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 with an identified CPU, network, replication or disk bottleneck. 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 → 1000 | 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 with an identified CPU, network, replication or disk bottleneck. 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 |
| background.threads Broker 4.4 Evaluate | 10 → 20 | Sizes broker background task concurrency. Tradeoff: Additional threads use CPU and memory and may contend for storage; they do not solve every maintenance bottleneck. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Increasing a pool without identifying the task that is queued. Measure: background task completion, CPU and disk activity Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| num.recovery.threads.per.data.dir Broker 4.4 Evaluate | 2 → 4 | Sizes per-directory log recovery and shutdown-flush concurrency. Tradeoff: More recovery threads can increase storage contention. Normal steady-state request processing uses other pools. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Expecting this to improve normal produce throughput without a recovery bottleneck. Measure: startup/recovery duration, shutdown duration and disk saturation Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Network and buffers | ||
| socket.send.buffer.bytes Broker 4.4 Evaluate | 100 KiB → 1 MiB | 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 with an identified CPU, network, replication or disk bottleneck. 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 Evaluate | 100 KiB → 1 MiB | 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 with an identified CPU, network, replication or disk bottleneck. 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 |
| message.max.bytes Broker 4.4 Evaluate | 1048588 B → 5 MiB | Sets the broker default maximum accepted record-batch size after compression; a topic can override max.message.bytes. Tradeoff: It is not the whole ProduceRequest limit. Large batches also affect replica/consumer fetch behavior and memory. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Changing the limit without reviewing topic overrides and client record sizes. Measure: rejected batches, batch sizes and consumer/follower memory The Java request limit and uncompressed batch limit differ from the broker/topic compressed record-batch limit. Also check the broker whole-request limit socket.request.max.bytes. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Replication | ||
| 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 with an identified CPU, network, replication or disk bottleneck. 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 |
| replica.fetch.max.bytes Broker 4.4 Evaluate | 1 MiB → 10 MiB | Sets a follower per-partition fetch target; the first oversized batch can exceed it so replication can progress. Tradeoff: Larger targets can increase memory and burst size. A smaller target does not necessarily stall replication forever. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Treating the target as an absolute maximum accepted record-batch size. Measure: follower lag, fetch sizes and broker memory Fetch byte settings are not absolute caps: an oversized first record batch can be returned to ensure progress. Review aggregate memory across partitions and brokers. 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 with an identified CPU, network, replication or disk bottleneck. 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 |
| 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 |
| 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 with an identified CPU, network, replication or disk bottleneck. 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 |
| log.segment.bytes Broker 4.4 Evaluate | 1 GiB → 512 MiB | Sets the segment roll size. Smaller segments can make more segments eligible for retention or compaction sooner. Tradeoff: More segments increase file, index and housekeeping overhead. Active segments and other conditions still affect cleanup. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Many small partitions or file-handle pressure without a cleanup benefit. Measure: segment count, retention delay, cleaner load and file descriptors Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Batching and compression | ||
| compression.type Broker 4.4 Keep | producer (unchanged) | Selects the batch compression codec. Evaluate the candidate with the actual payload and record rate. Tradeoff: Compression trades CPU for network and storage bytes. No codec or compression ratio is best for every workload. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Already-compressed payloads or a CPU-bound producer without a measured benefit. Measure: compression-rate-avg, CPU, bytes sent and p95/p99 latency A codec-specific compression level only applies to the selected codec. Benchmark CPU, bytes and latency; no fixed gain is implied. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Other controls | ||
| num.partitions Broker 4.4 Evaluate | 1 → 12 | Sets the default partition count for automatic topic creation where applicable. Existing topics are not repartitioned by this setting. Tradeoff: More partitions add broker metadata, replication and consumer overhead. The right count depends on workload and ordering requirements. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: Using a cluster-wide default to resize existing topics or optimize every workload. Measure: per-partition load, consumer parallelism and controller/broker resource use Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| 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 |
| Fetching and processing | ||
| max.incremental.fetch.session.cache.slots Broker 4.4 Evaluate | 1000 → 2000 | Sizes the incremental fetch session cache used to retain fetch context. Tradeoff: More slots require memory. Extra capacity is useful only if session churn or eviction is a problem. Workload, validation and sourcesWorkload: A self-managed broker with an identified CPU, network, replication or disk bottleneck. Avoid when: No evidence of fetch-session cache pressure. Measure: fetch session cache size, eviction rate and full fetch request overhead Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |