6.3. NUMA 인식 워크로드 예약
대기 시간에 민감한 워크로드를 실행하는 클러스터는 일반적으로 워크로드 대기 시간을 최소화하고 성능을 최적화하는 데 도움이 되는 성능 프로필을 제공합니다. NUMA 인식 스케줄러는 사용 가능한 노드 NUMA 리소스를 기반으로 워크로드를 배포하고 노드에 적용되는 성능 프로필 설정과 관련하여 워크로드를 배포합니다. NUMA 인식 배포와 워크로드의 성능 프로파일을 결합하면 성능을 극대화하는 방식으로 워크로드를 예약할 수 있습니다.
6.3.1. NUMAResourcesOperator 사용자 정의 리소스 생성
NUMA Resources Operator 를 설치한 경우 NUMA Resources Operator에 데몬 세트 및 API를 포함하여 NUMA 인식 스케줄러를 지원하는 데 필요한 모든 클러스터 인프라를 설치하도록 지시하는 NUMAResourcesOperator CR(사용자 정의 리소스)을 생성합니다.
사전 요구 사항
-
OpenShift CLI(
oc)를 설치합니다. -
cluster-admin권한이 있는 사용자로 로그인합니다. - NUMA Resources Operator를 설치합니다.
절차
NUMAResourcesOperator사용자 정의 리소스를 만듭니다.다음 YAML을
nrop.yaml파일에 저장합니다.apiVersion: nodetopology.openshift.io/v1 kind: NUMAResourcesOperator metadata: name: numaresourcesoperator spec: nodeGroups: - machineConfigPoolSelector: matchLabels: pools.operator.machineconfiguration.openshift.io/worker: ""다음 명령을 실행하여
NUMAResourcesOperatorCR을 만듭니다.$ oc create -f nrop.yaml
검증
다음 명령을 실행하여 NUMA Resources Operator가 성공적으로 배포되었는지 확인합니다.
$ oc get numaresourcesoperators.nodetopology.openshift.io
출력 예
NAME AGE numaresourcesoperator 10m
6.3.2. NUMA 인식 보조 Pod 스케줄러 배포
NUMA Resources Operator를 설치한 후 다음을 수행하여 NUMA 인식 보조 Pod 스케줄러를 배포합니다.
- 성능 프로필을 구성합니다.
- NUMA 인식 보조 스케줄러를 배포합니다.
사전 요구 사항
-
OpenShift CLI(
oc)를 설치합니다. -
cluster-admin권한이 있는 사용자로 로그인합니다. - 필요한 머신 구성 풀을 생성합니다.
- NUMA Resources Operator를 설치합니다.
절차
PerformanceProfileCR(사용자 정의 리소스)을 생성합니다.다음 YAML을
nro-perfprof.yaml파일에 저장합니다.apiVersion: performance.openshift.io/v2 kind: PerformanceProfile metadata: name: perfprof-nrop spec: cpu: 1 isolated: "4-51,56-103" reserved: "0,1,2,3,52,53,54,55" nodeSelector: node-role.kubernetes.io/worker: "" numa: topologyPolicy: single-numa-node- 1
cpu.isolated및cpu.reserved사양은 분리된 CPU 및 예약된 CPU의 범위를 정의합니다. CPU 구성에 유효한 값을 입력합니다. 성능 프로필 구성에 대한 자세한 내용은 추가 리소스 섹션을 참조하십시오.
다음 명령을 실행하여
PerformanceProfileCR을 생성합니다.$ oc create -f nro-perfprof.yaml
출력 예
performanceprofile.performance.openshift.io/perfprof-nrop created
NUMA 인식 사용자 정의 Pod 스케줄러를 배포하는
NUMAResourcesScheduler사용자 정의 리소스를 생성합니다.nro-scheduler.yaml파일에 다음 YAML을 저장합니다.apiVersion: nodetopology.openshift.io/v1 kind: NUMAResourcesScheduler metadata: name: numaresourcesscheduler spec: imageSpec: "registry.redhat.io/openshift4/noderesourcetopology-scheduler-container-rhel8:v4.13" cacheResyncPeriod: "5s" 1- 1
- 스케줄러 캐시의 동기화를 위해 간격 값(초)을 입력합니다. 대부분의 구현에서 값은 일반적인
5s입니다.
참고-
cacheResyncPeriod사양을 활성화하여 NUMA Resource Operator가 노드에서 보류 중인 리소스를 모니터링하고 이 정보를 정의된 간격으로 스케줄러 캐시에 동기화하여 보다 정확한 리소스 가용성을 보고할 수 있도록 지원합니다. 이는 또한 하위 선택 예약 결정에따라 토폴로지 선호도 오류오류를 최소화하는 데 도움이 됩니다. 네트워크 로드가 늘어납니다.cacheResyncPeriod사양은 기본적으로 비활성화되어 있습니다. -
NUMAResourcesOperatorCR에서podsFingerprinting사양에 대해Enabled값을 설정하는 것은cacheResyncPeriod사양의 구현이 필요합니다.
다음 명령을 실행하여
NUMAResourcesSchedulerCR을 생성합니다.$ oc create -f nro-scheduler.yaml
검증
다음 명령을 실행하여 성능 프로필이 적용되었는지 확인합니다.
$ oc describe performanceprofile <performance-profile-name>
다음 명령을 실행하여 필요한 리소스가 성공적으로 배포되었는지 확인합니다.
$ oc get all -n openshift-numaresources
출력 예
NAME READY STATUS RESTARTS AGE pod/numaresources-controller-manager-7575848485-bns4s 1/1 Running 0 13m pod/numaresourcesoperator-worker-dvj4n 2/2 Running 0 16m pod/numaresourcesoperator-worker-lcg4t 2/2 Running 0 16m pod/secondary-scheduler-56994cf6cf-7qf4q 1/1 Running 0 16m NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE daemonset.apps/numaresourcesoperator-worker 2 2 2 2 2 node-role.kubernetes.io/worker= 16m NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/numaresources-controller-manager 1/1 1 1 13m deployment.apps/secondary-scheduler 1/1 1 1 16m NAME DESIRED CURRENT READY AGE replicaset.apps/numaresources-controller-manager-7575848485 1 1 1 13m replicaset.apps/secondary-scheduler-56994cf6cf 1 1 1 16m
추가 리소스
6.3.3. NUMA 인식 스케줄러로 워크로드 예약
워크로드를 처리하는 데 필요한 최소 리소스를 지정하는 Deployment CR을 사용하여 NUMA 인식 스케줄러로 워크로드를 예약할 수 있습니다.
다음 예제 배포에서는 샘플 워크로드에 대해 NUMA 인식 스케줄링을 사용합니다.
사전 요구 사항
-
OpenShift CLI(
oc)를 설치합니다. -
cluster-admin권한이 있는 사용자로 로그인합니다. - NUMA Resources Operator를 설치하고 NUMA 인식 보조 스케줄러를 배포합니다.
절차
다음 명령을 실행하여 클러스터에 배포된 NUMA 인식 스케줄러의 이름을 가져옵니다.
$ oc get numaresourcesschedulers.nodetopology.openshift.io numaresourcesscheduler -o json | jq '.status.schedulerName'
출력 예
topo-aware-scheduler
다음과 같이
topo-aware-scheduler라는 스케줄러를 사용하는배포CR을 생성합니다.nro-deployment.yaml파일에 다음 YAML을 저장합니다.apiVersion: apps/v1 kind: Deployment metadata: name: numa-deployment-1 namespace: openshift-numaresources spec: replicas: 1 selector: matchLabels: app: test template: metadata: labels: app: test spec: schedulerName: topo-aware-scheduler 1 containers: - name: ctnr image: quay.io/openshifttest/hello-openshift:openshift imagePullPolicy: IfNotPresent resources: limits: memory: "100Mi" cpu: "10" requests: memory: "100Mi" cpu: "10" - name: ctnr2 image: gcr.io/google_containers/pause-amd64:3.0 imagePullPolicy: IfNotPresent command: ["/bin/sh", "-c"] args: [ "while true; do sleep 1h; done;" ] resources: limits: memory: "100Mi" cpu: "8" requests: memory: "100Mi" cpu: "8"- 1
schedulerName은 클러스터에 배포된 NUMA 인식 스케줄러의 이름과 일치해야 합니다(예:topo-aware-scheduler).
다음 명령을 실행하여
DeploymentCR을 생성합니다.$ oc create -f nro-deployment.yaml
검증
배포가 성공했는지 확인합니다.
$ oc get pods -n openshift-numaresources
출력 예
NAME READY STATUS RESTARTS AGE numa-deployment-1-56954b7b46-pfgw8 2/2 Running 0 129m numaresources-controller-manager-7575848485-bns4s 1/1 Running 0 15h numaresourcesoperator-worker-dvj4n 2/2 Running 0 18h numaresourcesoperator-worker-lcg4t 2/2 Running 0 16h secondary-scheduler-56994cf6cf-7qf4q 1/1 Running 0 18h
다음 명령을 실행하여
topo-aware-scheduler에서 배포된 Pod를 예약하는지 확인합니다.$ oc describe pod numa-deployment-1-56954b7b46-pfgw8 -n openshift-numaresources
출력 예
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 130m topo-aware-scheduler Successfully assigned openshift-numaresources/numa-deployment-1-56954b7b46-pfgw8 to compute-0.example.com
참고예약에 사용할 수 있는 것보다 많은 리소스를 요청하는 배포는
MinimumReplicasUnavailable오류로 실패합니다. 필요한 리소스를 사용할 수 있게 되면 배포에 성공합니다. Pod는 필요한 리소스를 사용할 수 있을 때까지Pending상태로 유지됩니다.예상 할당된 리소스가 노드에 나열되어 있는지 확인합니다.
다음 명령을 실행하여 배포 Pod를 실행 중인 노드를 확인하고 <namespace>를
DeploymentCR에 지정한 네임스페이스로 교체합니다.$ oc get pods -n <namespace> -o wide
출력 예
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES numa-deployment-1-65684f8fcc-bw4bw 0/2 Running 0 82m 10.128.2.50 worker-0 <none> <none>
다음 명령을 실행하여 <node_name>을 배포 Pod를 실행 중인 해당 노드의 이름으로 교체합니다.
$ oc describe noderesourcetopologies.topology.node.k8s.io
출력 예
... Zones: Costs: Name: node-0 Value: 10 Name: node-1 Value: 21 Name: node-0 Resources: Allocatable: 39 Available: 21 1 Capacity: 40 Name: cpu Allocatable: 6442450944 Available: 6442450944 Capacity: 6442450944 Name: hugepages-1Gi Allocatable: 134217728 Available: 134217728 Capacity: 134217728 Name: hugepages-2Mi Allocatable: 262415904768 Available: 262206189568 Capacity: 270146007040 Name: memory Type: Node- 1
- 보장된 Pod에 할당된 리소스로 인해
사용 가능한용량이 줄어듭니다.
보장된 Pod에서 사용하는 리소스는 node
resourcetopology.node.k8s.io에 나열된 사용 가능한 노드리소스에서 차감됩니다.
Best-effort또는Burstable서비스 품질(qosClass)이 있는 Pod의 리소스 할당은 noderesourcetopology.topology.node.k8s.io의 NUMA 노드리소스에 반영되지 않습니다. Pod의 소비된 리소스가 노드 리소스 계산에 반영되지 않으면 Pod에Guaranteed가 있고 CPU 요청은 10진수 값이 아닌 정수 값인지 확인합니다.다음 명령을 실행하여 Pod에GuaranteedqosClass가 있는지 확인할 수 있습니다.$ oc get pod <pod_name> -n <pod_namespace> -o jsonpath="{ .status.qosClass }"출력 예
Guaranteed