Kafka Producer Durability Configuration
Review replica acknowledgements, retries and transactional prerequisites. Application error handling remains essential.
producer
| Config / reference | Default → proposal | Rationale and conditions |
|---|---|---|
| Delivery and transactions | ||
| acks Java client 4.4 Keep | all (unchanged) | With acks=all, successful writes require the relevant in-sync replica acknowledgements and the configured minimum ISR. Tradeoff: Durability depends on replication, ISR and failure conditions. acks=1 can lose acknowledged writes after leader failure and conflicts with explicitly enabled idempotence. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Using acks=all as a substitute for reviewing topic replication and min.insync.replicas. Measure: UnderMinIsrPartitionCount, produce errors, replication state and acknowledgement latency Java idempotence requires acks=all, retries>0 and max.in.flight.requests.per.connection<=5. Explicit conflicting settings are rejected. acks=all must be reviewed with actual topic replication, ISR and failure scenarios. A single-replica ISR can satisfy a minimum ISR of one. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| enable.idempotence Java client 4.4 Keep | true (unchanged) | Deduplicates retried producer batches within the producer protocol and preserves ordering with compatible settings. It is not end-to-end exactly-once processing. Tradeoff: Requires acks=all, retries greater than zero and at most five in-flight requests in Java. Application retries across producer sessions can still duplicate business events. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Conflicting acknowledgement, retry or in-flight settings; unsupported client versions. Measure: duplicate business events, producer errors and sequence-related failures Java idempotence requires acks=all, retries>0 and max.in.flight.requests.per.connection<=5. Explicit conflicting settings are rejected. Without idempotence, retries with multiple in-flight requests can reorder records. Idempotence does not deduplicate arbitrary application resends. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| transactional.id Java client 4.4 Manual decision | unset → <stable-logical-producer-id> Commented out in export; prerequisites require review. | Identifies a transactional producer across sessions. Transactions can atomically commit Kafka records and consumed offsets when the application uses the transactional API. Tradeoff: An ID must be stable for its logical producer and unique among concurrent producers. Setting the property alone does not implement transactions or cover external side effects. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Copying the placeholder, sharing an ID across live producers, or claiming atomicity with an external system. Measure: transaction commits/aborts, fencing and read_committed consumer progress Transactions require application use of the transactional API and unique logical producer identities. A read-process-write transaction must commit consumed offsets with its Kafka outputs. External effects are outside that transaction. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| transaction.timeout.ms Java client 4.4 Keep | 1 min (unchanged) | Defines the producer transaction timeout requested from the coordinator; it must not exceed the broker maximum. Tradeoff: Long-running transactions may be aborted when the timeout expires. Excessive values can prolong the visibility delay for read_committed consumers. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Transactions whose observed duration exceeds the value, or a value above transaction.max.timeout.ms. Measure: transaction duration, abort rate and last stable offset lag Transactions require application use of the transactional API and unique logical producer identities. A read-process-write transaction must commit consumed offsets with its Kafka outputs. External effects are outside that transaction. A producer transaction timeout above broker transaction.max.timeout.ms is rejected. A transaction that later runs too long can be aborted by the coordinator. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| retries Java client 4.4 Keep | 2147483647 (unchanged) | Allows retryable produce failures to be retried; delivery.timeout.ms also bounds delivery in clients that support it. Tradeoff: Retries do not handle every error. Applications must inspect send futures or callbacks and handle failed or ambiguous outcomes. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Treating a high retry count as a guarantee that records cannot fail or be duplicated by application retries. Measure: record-retry-rate, record-error-rate and delivery failures Java idempotence requires acks=all, retries>0 and max.in.flight.requests.per.connection<=5. Explicit conflicting settings are rejected. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| delivery.timeout.ms Java client 4.4 Evaluate | 2 min → 5 min | Bounds the delivery attempt window after send() returns, including batching, acknowledgement waits and retryable failures. Tradeoff: A longer window delays final failure reporting and can hold buffered records longer. It must be at least request.timeout.ms + linger.ms in Java. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: A failure-response budget shorter than this window, or treating it as a guarantee of successful delivery. Measure: delivery failures, record-queue-time and recovery during broker outages 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 |
| max.in.flight.requests.per.connection Java client 4.4 Keep | 5 (unchanged) | Controls request pipelining per broker connection. Java idempotent production supports at most five in-flight requests. Tradeoff: Without idempotence, retries with more than one in-flight request can reorder records. Serializing requests reduces concurrency. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Raising beyond the client idempotence limit or disabling ordering protections without application review. Measure: request latency, in-flight requests, throughput and record ordering Java idempotence requires acks=all, retries>0 and max.in.flight.requests.per.connection<=5. Explicit conflicting settings are rejected. Without idempotence, retries with multiple in-flight requests can reorder records. Idempotence does not deduplicate arbitrary application resends. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| retry.backoff.ms Java client 4.4 Evaluate | 100 ms → 200 ms | Sets the initial wait between retry attempts; combine it with retry.backoff.max.ms where supported. Tradeoff: Longer waits reduce retry pressure but can delay recovery. Jitter, processing and timeout budgets affect the actual retry schedule. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: A retry delay chosen without measuring failure recovery and broker load. Measure: record-retry-rate, request rate and recovery latency Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| retry.backoff.max.ms Java client 4.4 Evaluate | 1 s → 5 s | Caps the exponential retry backoff where supported by the selected client version. Tradeoff: Increasing the cap can delay recovery after a short outage. It does not imply a fixed number of attempts within the delivery window. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Recovery objectives that cannot tolerate the proposed backoff. Measure: retry rate, failure recovery time and delivery timeout rate 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: Replicated Kafka writes with explicit error handling; transactions require application changes. 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 |
| max.block.ms Java client 4.4 Keep | 1 min (unchanged) | Bounds blocking in producer API calls for metadata and buffer availability; it is separate from asynchronous delivery timing. Tradeoff: The application thread can block for this duration. User serializer or partitioner time is not included in the documented send() bound. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: Blocking latency-sensitive application threads or assuming this is constrained by linger.ms. Measure: blocked send duration, buffer exhaustion and synchronous send exceptions The producer buffer is shared across partitions. Exhaustion can block send() until max.block.ms; handle synchronous exceptions as well as asynchronous send failures. max.block.ms bounds synchronous waiting for metadata/buffer allocation; linger.ms concerns batching after enqueueing. There is no general requirement that max.block.ms exceed linger.ms. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |
| Batching and compression | ||
| buffer.memory Java client 4.4 Evaluate | 32 MiB → 64 MiB | Budgets producer record buffering during bursts or temporary downstream slowdown. Tradeoff: It is not a hard cap on total producer process memory, and increasing it cannot fix sustained downstream saturation. Workload, validation and sourcesWorkload: Replicated Kafka writes with explicit error handling; transactions require application changes. Avoid when: A process memory limit that cannot accommodate the proposed budget and other allocations. Measure: buffer-available-bytes, bufferpool-wait-time, process memory and send failures The producer buffer is shared across partitions. Exhaustion can block send() until max.block.ms; handle synchronous exceptions as well as asynchronous send failures. Versioned reference · 2026-10-27 · unbenchmarked tuning proposal |