cruise-control icon indicating copy to clipboard operation
cruise-control copied to clipboard

Feature Request: Allow fractional CPU core values in BrokerCapacityInfo

Open kyguy opened this issue 3 years ago • 2 comments

When running Kafka in container environments such as Kubernetes it's possible to configure fractional CPU capacities for the Kafka brokers. For example, Kubernetes allows users to specify CPU resources in "milliCPU" (suffixed "m"), where 1000m is equivalent to a single core CPU, so a user could specify 100m to get the equivalent of 0.1 of a single core CPU [1].

It would be really cool if we allowed this CPU capacity precision in Cruise Control! It would be a really nice feature for Kubernetes users! From what I understand, it would be a non-intrusive change. It would mostly involve switching the of BrokerCapacityInfo's _numCpuCores [2] field type from a short to a double and then updating the related methods which interact with that field. The _brokerCapacity arrays [3] already store CPU capacity as double anyway!

Let me know what you think! If it sounds like a reasonable request, I would be happy to contribute this feature!

[1] https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#cpu-units [2] https://github.com/linkedin/cruise-control/blob/migrate_to_kafka_2_5/cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/config/BrokerCapacityInfo.java#L32 [3] https://github.com/linkedin/cruise-control/blob/migrate_to_kafka_2_5/cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/model/Broker.java#L75

kyguy avatar Mar 16 '22 19:03 kyguy

Any thoughts on this @efeg?

kyguy avatar May 05 '22 20:05 kyguy

@kyguy This seems like a useful change -- thanks for bringing this up and proposing to contribute!

efeg avatar May 06 '22 01:05 efeg