Kafka Consumer Processing and Commit Safety
Coordinate successful processing with offset commits. Read-committed isolation alone does not provide exactly-once processing.
consumer
| Config / reference | Default → proposal | Rationale and conditions |
|---|---|---|
| Consumer group and offsets | ||
| 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 Evaluate | read_uncommitted → read_committed | 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 Evaluate | latest → earliest | 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 |
| session.timeout.ms Java client 4.4 Keep | 45 s (unchanged) | 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 |
| check.crcs Java client 4.4 Keep | true (unchanged) | Checks record CRCs to detect corruption. Keeping it enabled avoids suppressing this validation. Tradeoff: CRC checks do not repair corrupted records. Applications need a response to corrupt data and the resulting read failures. Workload, validation and sourcesWorkload: Consumption that commits only successfully processed work; external side effects need their own coordination. Avoid when: Disabling validation only to pursue an unmeasured CPU saving. Measure: corrupt-record errors, read failures and consumer CPU Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| partition.assignment.strategy Java client 4.4 Evaluate | class org.apache.kafka.clients.consumer.RangeAssignor,class org.apache.kafka.clients.consumer.CooperativeStickyAssignor → org.apache.kafka.clients.consumer.CooperativeStickyAssignor | For classic groups, CooperativeStickyAssignor can reduce reassignment disruption. All members need a compatible migration strategy. Tradeoff: Java class names are not librdkafka assignor names. Follow the rolling migration procedure; consumer-protocol assignment uses broker-side assignors. Workload, validation and sourcesWorkload: Consumption that commits only successfully processed work; external side effects need their own coordination. Avoid when: Switching an existing group without checking common assignors and the supported migration path. Measure: rebalance duration, revoked partitions and processing interruptions These client heartbeat, session and assignor settings describe the classic group protocol. With consumer protocol, broker-side settings and assignors apply. Follow the documented rolling assignor migration; classic group members need a common compatible assignor. Java class names must not be copied into librdkafka. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| group.instance.id Java client 4.4 Manual decision | unset → <unique-per-instance-id> Commented out in export; prerequisites require review. | Enables static group membership with a stable logical instance identity. Tradeoff: Concurrent members must not share an ID. Failure detection and partition reassignment can be delayed by session timeout. Workload, validation and sourcesWorkload: Consumption that commits only successfully processed work; external side effects need their own coordination. Avoid when: An autoscaling deployment that cannot maintain unique stable identities. Measure: fencing errors, rebalance frequency and failover time Static instance IDs must be stable across restarts and unique among concurrent members of the same group. Duplicate IDs cause fencing. 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 |
| Fetching and processing | ||
| 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 Keep | 5 min (unchanged) | 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 |
| Other controls | ||
| request.timeout.ms Java client 4.4 Keep | 30 s (unchanged) | 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: Consumption that commits only successfully processed work; external side effects need their own coordination. 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 |