I\'m using the new kafka producer client and set the timeout.ms property to 50 ms.
Here is the complete configuration used in the producer:
props.put(\"
In the new Kafka 2.0 Producer API, you can use one of the following properties : https://kafka.apache.org/documentation/#producerconfigs
See usage examples on https://kafka.apache.org/20/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html
The timeout is now defined by the max.block.ms
property.
The new timeout.ms
property works with the ack
configuration of the producer. For example consider the following situation
ack = all
timeout.ms = 3000
In this case ack = all
means that the leader will not respond untill it receives acknowledgement for the full set of in-sync replicas (ISR) and the maximum wait time to get this acknowledgement will be 3000 ms
. If it didn't receive the expected number of acknowledgements within the given time it will return an error.
Also note this property does not consider network latency.
From the doc page :
The configuration controls the maximum amount of time the server will wait for acknowledgments from followers to meet the acknowledgment requirements the producer has specified with the acks configuration. If the requested number of acknowledgments are not met when the timeout elapses an error will be returned. This timeout is measured on the server side and does not include the network latency of the request.
So in your case with ack=1
(I am not 100% sure about this and open to any correction if applicable) if the leader is not able to respond (after writing the record to its own log without awaiting full acknowledgement from all followers) within 50ms should throw an error.