Improving performance of Kafka Producer

前端 未结 3 1488
囚心锁ツ
囚心锁ツ 2021-01-15 07:55

We\'re running on apache kafka 0.10.0.x and spring 3.x and cannot use spring kafka as it is supported with spring framework version 4.x.

Therefore, we are using the

3条回答
  •  醉梦人生
    2021-01-15 08:43

    Your understanding is partially right.

    As @leshkin pointed out there are configuration parameters to tune how the KafkaProducer will handle buffering of messages to be sent.

    However independently from the buffering strategy, the producer will take care of caching established connections to topic-leader brokers.

    Indeed you can tune for how long the producer will keep such connection around using the connections.max.idle.ms parameter (defaults to 9 minutes).

    So to respond to your original question, the I/O cost of establishing a connection to the broker happens only on the first send invocation and will be amortised over time as long as you have data to send.

提交回复
热议问题