Kafka Consumer Latency Configuration
Evaluate fetch waits and processing budgets while keeping offset management explicit.
consumer
| Config / reference | Default → proposal | Rationale and conditions |
|---|---|---|
| Fetching and processing | ||
| fetch.min.bytes Java client 4.4 Keep | 1 B (unchanged) | Sets the desired minimum fetch response size; the broker can wait up to the fetch wait limit for enough data. Tradeoff: Larger thresholds can reduce request overhead but delay low-rate streams. Response size is workload-dependent. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Sparse traffic with a latency budget smaller than the fetch wait. Measure: fetch-size-avg, fetch-rate and end-to-end consumer latency Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| fetch.max.wait.ms Java client 4.4 Evaluate | 500 ms → 10 ms | Bounds how long the broker waits to satisfy the minimum data requirement for a consumer fetch. Tradeoff: Shorter waits can increase fetch traffic when little data is available. This is not a bound on processing or all consumer latency. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Reducing the wait without checking fetch.min.bytes and idle request traffic. Measure: fetch-rate, fetch-latency-avg and low-traffic delivery latency Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| max.poll.records Java client 4.4 Evaluate | 500 → 100 | Limits how many cached records a Java poll() returns. It does not change the underlying fetch size. Tradeoff: A larger poll batch can extend processing time. librdkafka has no direct configuration equivalent. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: A batch processing time that can exceed max.poll.interval.ms. Measure: poll batch size, processing p99, time between polls and rebalances Allow for processing tail latency, downstream I/O and pauses between polls. Static members can retain partitions until session timeout after a poll interval breach. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| max.poll.interval.ms Java client 4.4 Evaluate | 5 min → 30 s | Bounds the interval between consumer poll calls for group liveness. Size it for processing and downstream tail latency. Tradeoff: A longer interval delays detecting a stuck application. Static membership changes when partitions are reassigned after a poll timeout. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Choosing the interval from average processing time alone. Measure: time-between-poll-max, processing p99, rebalance frequency and lag Allow for processing tail latency, downstream I/O and pauses between polls. Static members can retain partitions until session timeout after a poll interval breach. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Consumer group and offsets | ||
| session.timeout.ms Java client 4.4 Evaluate | 45 s → 10 s | With the classic group protocol, controls failure detection when heartbeats stop; broker min/max bounds apply. Tradeoff: Shorter sessions can evict healthy members during pauses. With group.protocol=consumer, the broker controls the session timeout instead. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Applying this client setting to the consumer group protocol. Measure: heartbeat gaps, coordinator errors and rebalance frequency These client heartbeat, session and assignor settings describe the classic group protocol. With consumer protocol, broker-side settings and assignors apply. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| heartbeat.interval.ms Java client 4.4 Evaluate | 3 s → 2 s | With the classic protocol, schedules heartbeats and should be below session.timeout.ms; typically no more than one third of it. Tradeoff: More frequent heartbeats add traffic. With group.protocol=consumer, the broker controls heartbeat timing. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Applying this client setting to the consumer protocol or using a fixed missed-heartbeat count as a failure guarantee. Measure: heartbeat-response-time-max, heartbeat gaps and group stability These client heartbeat, session and assignor settings describe the classic group protocol. With consumer protocol, broker-side settings and assignors apply. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| enable.auto.commit Java client 4.4 Evaluate | true → false | Controls periodic offset commits. With false, the application must coordinate commits with successful processing. Tradeoff: Disabling auto commit does not implement exactly-once processing. Crashes can replay uncommitted work, and committing before completion can skip work. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: An application without explicit, tested offset management. Measure: commit failures, replay after restart, processed-versus-committed offsets Manual commits and read_committed do not alone implement exactly-once processing. Commit only completed work; handle commit failures and possible replay. In librdkafka, review enable.auto.offset.store as well. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| isolation.level Java client 4.4 Keep | read_uncommitted (unchanged) | read_committed hides aborted transactional records and reads up to the last stable offset. It also returns non-transactional records. Tradeoff: Open transactions can delay visibility until commit, abort or timeout. This alone does not make application processing exactly-once. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Expecting this setting to atomically coordinate side effects or offset commits. Measure: last stable offset lag, transaction duration and processing duplicates Manual commits and read_committed do not alone implement exactly-once processing. Commit only completed work; handle commit failures and possible replay. In librdkafka, review enable.auto.offset.store as well. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| auto.offset.reset Java client 4.4 Keep | latest (unchanged) | Chooses a start position when no valid committed offset exists; it does not reset an existing valid offset on every restart. Tradeoff: earliest can replay retained history; latest can skip existing records when no valid offset exists. Neither recovers data already deleted by retention. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Using a default reset policy without an explicit recovery and replay decision. Measure: offset reset events, replay volume and unexpected gaps Offset reset applies only when a valid committed offset is unavailable. Retention can remove records that an earliest reset can no longer recover. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| group.protocol Java client 4.4 Keep | classic (unchanged) | These group-management recommendations use the classic protocol. Choose consumer explicitly to use the newer broker-managed protocol. Tradeoff: Classic session, heartbeat and client assignor settings do not apply to the consumer protocol. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: A deliberate migration to the consumer protocol. Measure: group protocol, rebalance behavior and coordinator errors These client heartbeat, session and assignor settings describe the classic group protocol. With consumer protocol, broker-side settings and assignors apply. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Other controls | ||
| request.timeout.ms Java client 4.4 Evaluate | 30 s → 15 s | Bounds waiting for a Java client request response. For producers, review it together with the delivery window. Tradeoff: A shorter request timeout can trigger retries during slow responses; it is not an application processing deadline. librdkafka request.timeout.ms has different, broker-enforced acknowledgement semantics. Workload, validation and sourcesWorkload: Low-latency consumption with measured processing tails and an explicit offset strategy. Avoid when: Translating this setting directly to librdkafka or setting it below observed response tails. Measure: request-latency-max, timeout rate and retry rate In Java, delivery.timeout.ms must be >= linger.ms + request.timeout.ms. librdkafka timeout names and validation rules are different. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |