Kafka new producer timeout

后端 未结 2 2010
-上瘾入骨i
-上瘾入骨i 2021-02-19 05:44

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(\"         


        
2条回答
  •  南旧
    南旧 (楼主)
    2021-02-19 06:23

    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.

提交回复
热议问题