Performance optimization
You can change certain configurations for your OpenShift Virtualization deployment to improve efficiency, cost-effectiveness, and reliability.
Configuring full physical cores for virtual machines
As a cluster administrator, you can allocate a full physical core to a specific virtual machine (VM), instead of allowing different VMs to share the same physical core. Configuring your VMs to use only full physical cores can optimize performance for high-throughput or latency-critical VMs.
Allocating only full physical cores is important on simultaneous multi-threading (SMT) enabled systems because it offers the following benefits:
-
Prevents noisy neighbors and resource contention
-
Mitigates performance degradation
-
Offers predictable latency
-
Guarantees exclusive CPU resources
You can configure full physical core allocation by modifying the cpuManagerPolicy and cpuManagerPolicyOptions settings in the KubeletConfig custom resource (CR).
-
You have cluster administrator access to a OpenShift Container Platform cluster with OpenShift Virtualization installed.
-
You have installed the OpenShift CLI (
oc). -
You have enabled CPU Manager on the node where your VM runs.
-
Edit the
KubeletConfigCR to add the requiredcpuManagerPolicyandcpuManagerPolicyOptionsconfigurations:apiVersion: machineconfiguration.openshift.io/v1 kind: KubeletConfig # ... cpuManagerPolicy: static cpuManagerPolicyOptions: full-pcpus-only: true kubeReserved: cpu: "1" # ...-
You must set the
cpuManagerPolicy: staticpolicy to enable exclusive CPU allocation. This setting is a prerequisite for configuring thecpuManagerPolicyOptionssettings. -
You must set the
full-pcpus-only: truepolicy option so that the static CPU Manager policy only allocates full physical cores. -
You must reserve 1 CPU for the system by setting
cpu: "1"in thekubeReservedsettings. This ensures that the cluster remains stable, by requiring that the system’s core functions always have access to the CPU that they need to work correctly.
-
-
Run the following command to apply the changes to the
KubeletConfigCR:$ oc apply -f <filename>.yaml
-
Inspect the kubelet configuration on a node where the change you applied the change, by running the following command and inspecting the output:
$ oc debug node/<node_name> -- chroot /host cat /etc/kubernetes/kubelet.conf | grep -E -A 2 'cpuManagerPolicy|kubeReserved'Example output:
cpuManagerPolicy: static cpuManagerPolicyOptions: full-pcpus-only: true -- kubeReserved: cpu: "1"