Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Kafka Producer Config: 'request.timeout.ms' VS. 'max.block.ms' properties

Given the below synchronous kafka producer

Properties props = new Properties();
props.put("max.block.ms", 30000);
props.put("request.timeout.ms", 30000);
props.put("retries", 5);

KafkaProducer<String, byte[]> produce = new KafkaProducer<>(props);

//Send message
producer.send(producerRecord).get();

help me understand the difference between request.timeout.ms and max.block.ms producer configs. Does either include max time for all retries? Or does each retry have its own timeout?

like image 846
rugden Avatar asked Jan 24 '17 18:01

rugden


People also ask

What is Kafka request timeout MS?

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.

What is Max Block MS?

max.block.ms is used for producer to block buffer time, serialization time etc. For details look at this one.


1 Answers

request.timeout.ms is used to timeout request, I would set this to the maximum time I can wait for the response.

max.block.ms is used for producer to block buffer time, serialization time etc.

For details look at this one. https://cwiki.apache.org/confluence/display/KAFKA/KIP-19+-+Add+a+request+timeout+to+NetworkClient

like image 99
Paresh Avatar answered Oct 04 '22 20:10

Paresh