'Kafka producer config: Why request.timeout.ms should be larger than replica.lag.time.max.ms

From Kafka doc https://kafka.apache.org/11/documentation.html#producerconfigs , it says that:

The configuration controls the maximum amount of time the client will wait for the response of a request. If the response is not received before the timeout elapses the client will resend the request if necessary or fail the request if retries are exhausted. This should be larger than replica.lag.time.max.ms (a broker configuration) to reduce the possibility of message duplication due to unnecessary producer retries.

Why a small request.timeout.ms may cause duplication? Could someone elaborate more on that?

And does this still hold true if the producer retries config is set to 0?



Solution 1:[1]

if it's smaller than replica.lag.time.max.ms , then follower broker might persistent the msg successfully but producer req timed out, which will cause the duplication due to unnecessary producer retries

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joey Deng