Difference between request.timeout.ms and timeout.ms properties of Kafka producer

20,370

Solution 1

request.timeout.ms is the timeout configured on the client side. It says that the client is going to wait this much time for the server to respond to a request.

timeout.ms is the timeout configured on the leader in the Kafka cluster. This is the timeout on the server side. For example if you have set the acks setting to all, the server will not respond until all of its followers have sent a response back to the leader. The leader will wait timeout.ms amount of time for all the followers to respond.

So client sends a request to the server (leader). Based on the acks setting, the server will either wait or respond back to the client. timeout.ms is the amount of time the leader waits for its followers whereas request.timeout.ms is the amount of time the client waits for the server(leader).

Solution 2

They are both used for the common underlying network client, meaning the max amount of time for awaiting a response from the request, although timeout.ms is marked as 'Deprecated'. Actually, timeout.ms is only used on the producer side, and request.timeout.ms can be defined for both client(including producer and consumer) and server(for replicating threads).

Kafka recommends that user specify request.timeout.ms instead of timeout.ms

Share:
20,370
vatsal mevada
Author by

vatsal mevada

Updated on July 09, 2022

Comments

  • vatsal mevada
    vatsal mevada almost 2 years

    Refering the kafka documentation, a Kafka message prducer configuration have request.timeout.ms and timeout.ms properties. Reading the discription of these two properties, I am not able clearly distinguish between them.

    Can anyone explain the difference using small example.