|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | + |
| 3 | +[id="configuring-shared-cpus-for-a-workload_{context}"] |
| 4 | += Configuring shared CPUs in a performance profile |
| 5 | + |
| 6 | +You can define and enable shared CPUs by using a performance profile. You can use these shared CPUs for lightweight application tasks. |
| 7 | + |
| 8 | +.Prerequisites |
| 9 | + |
| 10 | +* Log in as a user with `cluster-admin` privileges. |
| 11 | + |
| 12 | +.Procedure |
| 13 | + |
| 14 | +. Create a `PerformanceProfile` resource: |
| 15 | + |
| 16 | +.. Create a YAML file that defines the `PerformanceProfile` resource: |
| 17 | ++ |
| 18 | +.Example `shared-cpu-pp.yaml` file |
| 19 | +[source,yaml] |
| 20 | +---- |
| 21 | +apiVersion: performance.openshift.io/v2 |
| 22 | +kind: PerformanceProfile |
| 23 | +metadata: |
| 24 | + name: example-shared-cpu-pp |
| 25 | +spec: |
| 26 | + cpu: |
| 27 | + reserved: "0-1" |
| 28 | + isolated: "4-8" |
| 29 | + shared: "2-3" <1> |
| 30 | + workloadHints: |
| 31 | + mixedCpus: true <2> |
| 32 | + nodeSelector: |
| 33 | + node-role.kubernetes.io/performance: "test" |
| 34 | +---- |
| 35 | +<1> Define the shared CPU cores. |
| 36 | +<2> Enable the shared CPUs feature by enabling on the `mixedCpus` workload hint. |
| 37 | + |
| 38 | +.. Create the `PerformanceProfile` resource by running the following command: |
| 39 | ++ |
| 40 | +[source,bash] |
| 41 | +---- |
| 42 | +$ oc create -f shared-cpu-pp.yaml |
| 43 | +---- |
| 44 | ++ |
| 45 | +.Example output |
| 46 | +[source,terminal] |
| 47 | +---- |
| 48 | +performanceprofile.performance.openshift.io/example-shared-cpu-pp created |
| 49 | +---- |
| 50 | + |
| 51 | + |
| 52 | +.Verification |
| 53 | + |
| 54 | +. Verify that the performance profile is active by running the following command: |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +$ oc describe performanceprofile example-shared-cpu-pp |
| 59 | +---- |
| 60 | ++ |
| 61 | +.Example output |
| 62 | +[source,terminal] |
| 63 | +---- |
| 64 | +... |
| 65 | +Events: |
| 66 | + Type Reason Age From Message |
| 67 | + ---- ------ ---- ---- ------- |
| 68 | + Normal Creation succeeded 27m (x17 over 35m) performance-profile-controller Succeeded to create all components |
| 69 | +---- |
| 70 | + |
| 71 | +. Verify the shared CPUs are present under the `reservedSystemCPUs` pool: |
| 72 | + |
| 73 | +.. Enter into a debug session on the target node: |
| 74 | ++ |
| 75 | +[source,terminal] |
| 76 | +---- |
| 77 | +$ oc debug node/<node_name> |
| 78 | +---- |
| 79 | + |
| 80 | +.. Set `/host` as the root directory within the debug shell prompt. |
| 81 | ++ |
| 82 | +[source,terminal] |
| 83 | +---- |
| 84 | +sh-4.4# chroot /host |
| 85 | +---- |
| 86 | + |
| 87 | +.. Check that the `reservedSystemCPUs` pool includes the `shared` and `reserved` CPUs by running the following command: |
| 88 | ++ |
| 89 | +[source,terminal] |
| 90 | +---- |
| 91 | +sh-5.1# cat /etc/kubernetes/kubelet.conf | grep "reservedSystemCPUs" |
| 92 | +---- |
| 93 | ++ |
| 94 | +.Example output |
| 95 | +[source,terminal] |
| 96 | +---- |
| 97 | +"reservedSystemCPUs": "0-3", |
| 98 | +---- |
| 99 | + |
| 100 | +[role="_additional-resources"] |
| 101 | +.Next steps |
| 102 | + |
| 103 | +* [link to assigning workload tasks to shared CPUs - overkill?] |
0 commit comments