1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/cnf-configuring-hyperthreading-for-a-cluster.adoc
Aidan Reilly d51917ed74 low latency tuning refactor
Changes for Martin

Martin's 3rd review comments

Martin's 4th review

Final comments from Martin

More updates for Martin

Tweaks for Martin

Martin's comments 22-Apr - workload pods

Apr 30 review comments

final review comments

Michael's comments
2024-05-10 09:01:21 +00:00

134 lines
4.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * scalability_and_performance/low_latency_tuning/cnf-tuning-low-latency-nodes-with-perf-profile.adoc
:_mod-docs-content-type: PROCEDURE
[id="cnf-configuring-hyperthreading-for-a-cluster_{context}"]
= Configuring Hyper-Threading for a cluster
To configure Hyper-Threading for an {product-title} cluster, set the CPU threads in the performance profile to the same cores that are configured for the reserved or isolated CPU pools.
[NOTE]
====
If you configure a performance profile, and subsequently change the Hyper-Threading configuration for the host, ensure that you update the CPU `isolated` and `reserved` fields in the `PerformanceProfile` YAML to match the new configuration.
====
[WARNING]
====
Disabling a previously enabled host Hyper-Threading configuration can cause the CPU core IDs listed in the `PerformanceProfile` YAML to be incorrect. This incorrect configuration can cause the node to become unavailable because the listed CPUs can no longer be found.
====
.Prerequisites
* Access to the cluster as a user with the `cluster-admin` role.
* Install the OpenShift CLI (oc).
.Procedure
. Ascertain which threads are running on what CPUs for the host you want to configure.
+
You can view which threads are running on the host CPUs by logging in to the cluster and running the following command:
+
[source,terminal]
----
$ lscpu --all --extended
----
+
.Example output
+
[source,terminal]
----
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ
0 0 0 0 0:0:0:0 yes 4800.0000 400.0000
1 0 0 1 1:1:1:0 yes 4800.0000 400.0000
2 0 0 2 2:2:2:0 yes 4800.0000 400.0000
3 0 0 3 3:3:3:0 yes 4800.0000 400.0000
4 0 0 0 0:0:0:0 yes 4800.0000 400.0000
5 0 0 1 1:1:1:0 yes 4800.0000 400.0000
6 0 0 2 2:2:2:0 yes 4800.0000 400.0000
7 0 0 3 3:3:3:0 yes 4800.0000 400.0000
----
+
In this example, there are eight logical CPU cores running on four physical CPU cores. CPU0 and CPU4 are running on physical Core0, CPU1 and CPU5 are running on physical Core 1, and so on.
+
Alternatively, to view the threads that are set for a particular physical CPU core (`cpu0` in the example below), open a shell prompt and run the following:
+
[source,terminal]
----
$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
----
+
.Example output
+
[source,terminal]
----
0-4
----
. Apply the isolated and reserved CPUs in the `PerformanceProfile` YAML. For example, you can set logical cores CPU0 and CPU4 as `isolated`, and logical cores CPU1 to CPU3 and CPU5 to CPU7 as `reserved`. When you configure reserved and isolated CPUs, the infra containers in pods use the reserved CPUs and the application containers use the isolated CPUs.
+
[source,yaml]
----
...
cpu:
isolated: 0,4
reserved: 1-3,5-7
...
----
+
[NOTE]
====
The reserved and isolated CPU pools must not overlap and together must span all available cores in the worker node.
====
[IMPORTANT]
====
Hyper-Threading is enabled by default on most Intel processors. If you enable Hyper-Threading, all threads processed by a particular core must be isolated or processed on the same core.
When Hyper-Threading is enabled, all guaranteed pods must use multiples of the simultaneous multi-threading (SMT) level to avoid a "noisy neighbor" situation that can cause the pod to fail.
See link:https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options[Static policy options] for more information.
====
[id="disabling_hyperthreading_for_low_latency_applications_{context}"]
== Disabling Hyper-Threading for low latency applications
When configuring clusters for low latency processing, consider whether you want to disable Hyper-Threading before you deploy the cluster. To disable Hyper-Threading, perform the following steps:
. Create a performance profile that is appropriate for your hardware and topology.
. Set `nosmt` as an additional kernel argument. The following example performance profile illustrates this setting:
+
[source,yaml]
----
apiVersion: performance.openshift.io/v2
kind: PerformanceProfile
metadata:
name: example-performanceprofile
spec:
additionalKernelArgs:
- nmi_watchdog=0
- audit=0
- mce=off
- processor.max_cstate=1
- idle=poll
- intel_idle.max_cstate=0
- nosmt
cpu:
isolated: 2-3
reserved: 0-1
hugepages:
defaultHugepagesSize: 1G
pages:
- count: 2
node: 0
size: 1G
nodeSelector:
node-role.kubernetes.io/performance: ''
realTimeKernel:
enabled: true
----
+
[NOTE]
====
When you configure reserved and isolated CPUs, the infra containers in pods use the reserved CPUs and the application containers use the isolated CPUs.
====