Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FG:InPlacePodVerticalScaling] A proposal for CPU allocated strategy when Pod scale up and down #8

Conversation

Chunxia202410
Copy link

@Chunxia202410 Chunxia202410 commented Nov 7, 2024

What type of PR is this?

/kind cleanup

This PR is based on the kubernetes#123319.

What this PR does / why we need it:

When Guaranteed QoS Class Pod scale up and down with Static CPU management policy alongside InPlacePodVerticalScaling, the allocated CPU should meet the kubernetes CPUs allocation rules.

For scaling up, keep the original CPUs, and only allocate the additional number of CPUs. when allocate additional CPUs, it is necessary to ensure that the combination of the original CPUs and the additional CPUs complies with the Kubernetes CPU allocation rules.
For takeByTopologyNUMAPacked:
For example:
Assuming the CPU topology is as follows, and kubernetes CPUs allocation rules is Packed(takeByTopologyNUMAPacked):
image
Allocated CPUs of Pod0 is {2,3}, Allocated CPUs of Pod1 is {13}. Other CPUs are free.
-When scale up of Pod 1 from 1 CPU to 2 CPUs. ==> CPU {12} should to be allocated to Pod1, so CPUset of Pod1 is {12,13}
-When scale up of Pod 1 from 1 CPU to 4 CPUs. ==> CPU {12,14,15} should to be allocated to Pod1, so CPUset of Pod1 is {12,13,14,15}
-When scale up of Pod 1 from 1 CPU to 8 CPUs. ==> CPU {8-12,14,15} should to be allocated to Pod1, so CPUset of Pod1 is {8-15}

For scaling down, if there are mustKeepCPUsForResize, when allocate remained CPUs, it is necessary to ensure that the combination of the mustKeepCPUsForResize CPUs and the allocated remained CPUs complies with the Kubernetes CPU allocation rules.

Which issue(s) this PR fixes:

The step as follows for allocate additional CPUs when scale up with CPU allocated packet(takeByTopologyNUMAPacked) rule, and assume that the NUMA nodes are higher than Sockets in the memory hierarchy.

  1. Keep the original CPUs.
  2. Take remain CPUs in the numa which only allocated CPUs to this Pod. (newly add step)
  3. Take full numa nodes.
  4. Take remain CPUs in the socket which only allocated CPUs to this Pod, than take full sockets in numa nodes which allocated CPUs to this Pod. (newly add step)
  5. Take full sockets.
  6. Take remain CPUs in the physical cores which only allocated CPUs to this Pod, than take full cores in sockets which allocated CPUs to this Pod, than take remain full cores in numa which allocated CPUs to this Pod. (newly add step)
  7. Take full physical cores.
  8. Take remain CPUs in the physical cores which only allocated CPUs to this Pod, than take remain CPUs in sockets which allocated CPUs to this Pod, than take remain CPUs in numa which allocated CPUs to this Pod. (newly add step)
  9. Take remain CPUs

For takeByTopologyNUMADistributed:
The allocated should be a subset of the combo. and the number of allocated CPU is not more than distribute number.

Special notes for your reviewer:
UncoreCaches need to be considerd

Does this PR introduce a user-facing change?

NONE

@esotsal esotsal force-pushed the esotsal/policy_static branch 6 times, most recently from cb0c2f9 to c3cdfa2 Compare November 13, 2024 16:30
@esotsal esotsal force-pushed the esotsal/policy_static branch from c3cdfa2 to dd29062 Compare November 14, 2024 09:22
@esotsal esotsal force-pushed the esotsal/policy_static branch from dd29062 to 407dde3 Compare November 19, 2024 16:38
@esotsal esotsal force-pushed the esotsal/policy_static branch 2 times, most recently from b9e6355 to 8c3741d Compare November 25, 2024 02:31
@Chunxia202410 Chunxia202410 changed the title [WIP] [FG:InPlacePodVerticalScaling] A proposal for CPU allocated strategy when Pod scale up and down [FG:InPlacePodVerticalScaling] A proposal for CPU allocated strategy when Pod scale up and down Dec 9, 2024
@esotsal
Copy link

esotsal commented Jan 28, 2025

Thanks @Chunxia202410 for the proposal, can you please update PR using kubernetes#129719 as base ? Thanks

@Chunxia202410
Copy link
Author

Yes~

@Chunxia202410
Copy link
Author

This PR is replaced by esotsal#3

@esotsal
Copy link

esotsal commented Feb 5, 2025

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants