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

Docs: Windows CPU and Memory Affinity #48469

Merged
merged 7 commits into from
Nov 25, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Removed from Kubernetes
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
title: WindowsCPUAndMemoryAffinity
content_type: feature_gate

_build:
list: never
render: false

stages:
- stage: alpha
defaultValue: false
fromVersion: "1.32"
---
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
Add CPU and Memory Affinity support to Windows nodes with [CPUManager](/docs/tasks/administer-cluster/cpu-management-policies#windows-support), [MemoryManager](/docs/tasks/administer-cluster/memory-manager.md#windows-support) and Topology manager.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ However, in workloads where CPU cache affinity and scheduling latency
significantly affect workload performance, the kubelet allows alternative CPU
management policies to determine some placement preferences on the node.

## Windows Support

{{< feature-state for_k8s_version="v1.32" state="alpha" feature_gate_name="WindowsCPUAndMemoryAffinity" >}}
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

The CPU Manager support can be enabled on Windows by using the `WindowsCPUAndMemoryAffinity` feature flag and requires a support in the container runtime.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
Once feature is enabled follow the steps above to configure the [CPU Manager Policy](#configuration).
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

### Configuration

The CPU Manager policy is set with the `--cpu-manager-policy` kubelet
Expand Down
31 changes: 28 additions & 3 deletions content/en/docs/tasks/administer-cluster/memory-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Preceding v1.22, the `kubelet` must be started with the following flag:

in order to enable the Memory Manager feature.

## How Memory Manager Operates?
## How does the Memory Manager Operates?
tengqm marked this conversation as resolved.
Show resolved Hide resolved

The Memory Manager currently offers the guaranteed memory (and hugepages) allocation
for Pods in Guaranteed QoS class.
Expand All @@ -57,7 +57,7 @@ prepare and deploy a `Guaranteed` pod as illustrated in the section

The Memory Manager is a Hint Provider, and it provides topology hints for
the Topology Manager which then aligns the requested resources according to these topology hints.
It also enforces `cgroups` (i.e. `cpuset.mems`) for pods.
On Linux, it also enforces `cgroups` (i.e. `cpuset.mems`) for pods.
The complete flow diagram concerning pod admission and deployment process is illustrated in
[Memory Manager KEP: Design Overview][4] and below:

Expand Down Expand Up @@ -91,6 +91,12 @@ The problem has been solved as elaborated in
Also, reference [Memory Manager KEP: Simulation - how the Memory Manager works? (by examples)][1]
illustrates how the management of groups occurs.

### Windows Support

{{< feature-state for_k8s_version="v1.32" state="alpha" feature_gate_name="WindowsCPUAndMemoryAffinity" >}}
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

Windows support can be enabled via the `WindowsCPUAndMemoryAffinity` feature gate and requires a support in the container runtime. Only the [BestEffort Policy](#policy-best-effort) is supported on Windows.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

## Memory Manager configuration

Other Managers should be first pre-configured. Next, the Memory Manager feature should be enabled
Expand All @@ -103,7 +109,8 @@ node stability (section [Reserved memory flag](#reserved-memory-flag)).
Memory Manager supports two policies. You can select a policy via a `kubelet` flag `--memory-manager-policy`:

* `None` (default)
* `Static`
* `Static` (Linux only)
* `BestEffort` (Windows Only)

#### None policy {#policy-none}

Expand All @@ -123,6 +130,24 @@ In the case of the `BestEffort` or `Burstable` pod, the `Static` Memory Manager
the default topology hint as there is no request for the guaranteed memory,
and does not reserve the memory in the internal [NodeMap][2] object.

This policy is only Supported on Linux.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

#### BestEffort policy {#policy-best-effort}

{{< feature-state for_k8s_version="v1.32" state="alpha" feature_gate_name="WindowsCPUAndMemoryAffinity" >}}
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

This policy is only Support on Windows.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

On Windows, NUMA node assignment works differently than Linux. There is no mechanism
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
to ensure that Memory access only comes from a specific NUMA node, instead the Windows
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
internals will select the most optimal NUMA node based on the CPU assignment and it is
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
possible that Windows might use other nodes if required or deemed optimal. For this
reason this policy is best effort.

The policy does track the amount of memory available and requested through the internal
[NodeMap][2] to make a best effort at ensuring that memory enough memory is available on
a NUMA node before making the hint to assign it to the NODE. This means that in most cases, this should function as expected.
tengqm marked this conversation as resolved.
Show resolved Hide resolved

### Reserved memory flag

The [Node Allocatable](/docs/tasks/administer-cluster/reserve-compute-resources/) mechanism
Expand Down
6 changes: 6 additions & 0 deletions content/en/docs/tasks/administer-cluster/topology-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ the pod can be accepted or rejected from the node based on the selected hint.
The hint is then stored in the Topology Manager for use by the *Hint Providers* when making the
resource allocation decisions.

## Windows Support

{{< feature-state for_k8s_version="v1.32" state="alpha" feature_gate_name="WindowsCPUAndMemoryAffinity" >}}
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

The Topology Manager support can be enabled on Windows by using the `WindowsCPUAndMemoryAffinity` feature flag and requires a support in the container runtime.
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

## Topology manager scopes and policies

The Topology Manager currently:
Expand Down