异步 Kafka Producer 批量大小 a linger.ms

Asynchronous Kafka Producer batch size a linger.ms

我有一个关于优化kafka异步生产者吞吐量的问题:配置batch.size和linger.ms在使用异步生产者时有影响吗?

我问是因为我认为这些参数只会影响同步生产者,因为它会等待代理 acknowledgment.In 异步生产者的情况,这不会有影响吗?

还有,有什么配置参数可以优化异步producer吗?

这两个属性都对异步 Kafka Producer 有影响:

linger.ms-> This instruct the producer upto this configured value(ex:2 millisecond) if batch size is not fill up. There will be latency of 2 ms in case message flow is low.



batch.size -> Message buffer size that will be send in single request. Higher batch size also request more memory (buffer.memory)

acks=all , Slowest but most durable configuration, wait for acknowledgement of all message sent.

具体可以看Kafka文档:https://kafka.apache.org/23/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html