1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/configuring_hyperthreading_for_a_cluster.adoc
2023-10-30 10:13:25 -04:00

131 lines
4.4 KiB
Plaintext

// Module included in the following assemblies:
//
// scalability_and_performance/cnf-low-latency-tuning.adoc
:_mod-docs-content-type: PROCEDURE
[id="configuring_hyperthreading_for_a_cluster_{context}"]
= Configuring hyperthreading for a cluster
To configure hyperthreading 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 hyperthreading 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 hyperthreading 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 command 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]
====
Hyperthreading is enabled by default on most Intel processors. If you enable hyperthreading, all threads processed by a particular core must be isolated or processed on the same core.
====
[id="disabling_hyperthreading_for_low_latency_applications_{context}"]
== Disabling hyperthreading for low latency applications
When configuring clusters for low latency processing, consider whether you want to disable hyperthreading before you deploy the cluster. To disable hyperthreading, do the following:
. 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.
====