Kafka Producer Retry Cache for Timeout-Resilient Message Delivery

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In distributed event streaming environments like Apache Kafka, producer failures during upgrades, migrations, or disaster recoveries can lead to message rejections due to exceeding delivery timeout values, resulting in potential message loss and inefficiencies in handling such failures.

Innovation Solution

Implement a centralized cache to store messages that cannot be sent to a particular topic, using a key-partitioner algorithm to pre-compute partition IDs for re-sending, and a recurrent watchdog per microservice group to manage retries, ensuring only one pod attempts re-sending, thereby reducing contention and message loss.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a delivery timeout property is set for the producer, then the system can report success or failure within a defined time, but messages may be rejected during broker upgrades or migrations due to the timeout

Engineering Contradiction:
Improvemessage delivery reliabilityVSAvoidmessage throughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system pre-computes partition IDs using a key-partitioner algorithm before broker upgrades occur. This preliminary computation stores the necessary routing information in advance, allowing messages to be resent to the correct partitions after broker recovery without requiring real-time partition discovery, thus preventing message rejection during timeout periods.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

A recurrent watchdog process acts as an intermediary between the producer and the centralized cache. The watchdog monitors message delivery status and automatically retries sending failed messages to the correct partitions, mediating between the timeout constraint and the need for reliable delivery during broker upgrades.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If messages are resent to the same partition during broker recovery, then message delivery can be attempted, but contention increases when multiple pods attempt re-sending simultaneously

Engineering Contradiction:
Improvemessage delivery assuranceVSAvoidcoordination complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system segments the retry responsibility by assigning specific partitions to specific pods based on pre-computed partition IDs. Each pod is responsible for retrying messages only for its assigned partitions, eliminating the need for complex inter-pod coordination and reducing contention while maintaining reliable message delivery.

Inventive Principle:
Principle #1Segmentation

3Reliability

If the delivery timeout value is increased to allow broker upgrades, then message rejection is reduced, but the time to report success or failure increases significantly

Engineering Contradiction:
Improvemessage delivery success rateVSAvoidtimeout duration
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

Partition IDs are pre-computed and stored before broker upgrades occur, eliminating the need for extended timeout periods. When brokers recover, messages can be immediately resent to the correct partitions using the pre-stored routing information, achieving high reliability without increasing timeout duration.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The recurrent watchdog continuously monitors and retries message delivery after broker recovery, ensuring that the useful action of message delivery continues without interruption rather than waiting for an extended timeout period to expire.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS20260056817A1System and method for use with a distributed event streaming environment for making services resilient of producer failures
Publication Date: 2026.02.26 ORACLE INT CORP
  • US20260056817A1 patent drawing
  • US20260056817A1 patent drawing
  • US20260056817A1 patent drawing

AI summary

In accordance with an embodiment, described herein are a system and method for use with a distributed event streaming environment (e.g., a Kafka environment), for making services resilient of producer failures. When a determination is made that one or more messages could not be sent to a particular topic after a timeout error, those messages are stored in a centralized cache (e.g., as provided by a database service). A key-partitioner algorithm or process is used to pre-compute a partition ID into which the message will be re-sent. The pre-computed partition ID is used to compute the key of the cache entry for the message as stored within the centralized cache. A recurrent watchdog per group of microservice resources (e.g., per pod) operates to query the centralized cache for the messages to be re-sent into the partitions pertaining to those resources (i.e., that pod).