strimzi-kafka-operator icon indicating copy to clipboard operation
strimzi-kafka-operator copied to clipboard

Creating one HTTP client per `KafkaRebalance` reconcile

Open ppatierno opened this issue 4 years ago • 0 comments

With the current implementation in the HttpClientUtils class, a new HttpClient instance is created and closed every time.

https://github.com/strimzi/strimzi-kafka-operator/blob/main/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/HttpClientUtils.java#L27

This is mostly used in the Kafka Connect and Cruise Control API. Mostly related to the Cruise Control API, it means that after asking for a rebalance, the periodic check on the user task status, done every 5 secs, creates a new HTTP client every time. So assuming one rebalance request a new client is created, then assuming some time for having the rebalance done one to N clients created, during the same reconcile. This could lead to use a lot of more resources if the cluster operator is handling more and more Kafka instances.

One improvement could be creating just one HTTP client per reconcile (in the KafkaRebalanceAssemblyOperator.reconcileRebalance so that the same is used for asking a rebalance and checking the user task status.

ppatierno avatar Apr 27 '22 14:04 ppatierno