[FLINK-24093] Supports setting the percentage of kubernetes Request resources #17092
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
For the current native Kubernetes, we start the job to apply for resources (CPU,Memory) of the same limit and request, so as to achieve the best performance. However, in general, when the kubernetes cluster resources are used up by request allocation, In fact, there are still some physical resources left. If there is a way to reduce the number of requests per job, more jobs can be run and the resource utilization of the cluster can be improved.
Here are some simple configurations to scale down the value of request:
kubernetes.mem.request.percent: the default value is 1.0, the effective range of 0.0 to 1.0, the meaning of this value is: If the value is 0.5 and the total memory of taskmanager/jobmanager is 2048MB, the value of request is 2048MB*0.5=1024MB. That is, if the remaining memory of nodes is larger than 1024MB, pods can be allocated to run
kubernetes.cpu.request.percent: the default value is 1.0, the effective range of 0.0 to 1.0, the meaning of this value is: If the value is 0.5 and the number of cpus requested by TaskManager/JobManager is 1, the value of request is 1 x 0.5=0.5, that is, the remaining CPU usage of Nodes is greater than 0.5 to allocate pods to run
Brief change log
Supports setting the percentage of kubernetes Request resources
Verifying this change
This change added tests and can be verified as follows:
org.apache.flink.kubernetes.utils.KubernetesUtilsTest#testRequestMemory
org.apache.flink.kubernetes.utils.KubernetesUtilsTest#testRequestCpu
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation