19장. 성능 프로파일 작성

Performance Profile Creator(PPC)와 이를 사용하여 성능 프로필을 만드는 방법을 설명합니다.

19.1. 성능 프로파일 작성툴 정보

PPC(Performance Profile creator)는 성능 프로필을 생성하는 데 사용되는 Performance Addon Operator와 함께 제공되는 명령행 툴입니다. 이 툴은 클러스터의 must-gather 데이터와 여러 사용자가 제공하는 프로필 인수를 사용합니다. PPC는 하드웨어 및 토폴로지에 적합한 성능 프로필을 생성합니다.

툴은 다음 방법 중 하나로 실행됩니다.

  • podman 호출
  • 래퍼 스크립트 호출

19.1.1. must-gather 명령을 사용하여 클러스터에 대한 데이터 수집

PPC(Performance Profile creator) 툴에는 must-gather 데이터가 필요합니다. 클러스터 관리자는 must-gather 명령을 실행하여 클러스터에 대한 정보를 캡처합니다.

사전 요구 사항

  • cluster-admin 역할을 가진 사용자로 클러스터에 액세스합니다.
  • Performance Addon Operator 이미지에 액세스합니다.
  • OpenShift CLI(oc)가 설치되어 있습니다.

프로세스

  1. must-gather 데이터를 저장하려는 디렉터리로 이동합니다.
  2. 클러스터에서 must-gather를 실행합니다.

    $ oc adm must-gather --image=<PAO_image> --dest-dir=<dir>
    참고

    must-gather 명령은 performance-addon-operator-must-gather 이미지를 사용하여 실행해야 합니다. 출력을 선택적으로 압축할 수 있습니다. Performance Profile Creator 래퍼 스크립트를 실행하는 경우 압축 출력이 필요합니다.

    $ oc adm must-gather --image=registry.redhat.io/openshift4/performance-addon-operator-must-gather-rhel8:v4.8 --dest-dir=must-gather

  3. must-gather 디렉터리에서 압축 파일을 만듭니다.

    $ tar cvaf must-gather.tar.gz must-gather/

19.1.2. podman을 사용하여 Performance Profile Creator 실행

클러스터 관리자는 podman 및 Performance Profile Creator를 실행하여 성능 프로필을 만들 수 있습니다.

사전 요구 사항

  • cluster-admin 역할을 가진 사용자로 클러스터에 액세스합니다.
  • 클러스터가 베어 메탈 하드웨어에 설치되어 있어야 합니다.
  • podman 및 OpenShift CLI(oc)가 설치된 노드가 있습니다.

프로세스

  1. 머신 구성 풀을 확인합니다.

    $ oc get mcp

    출력 예

    NAME         CONFIG                                                 UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE
    master       rendered-master-acd1358917e9f98cbdb599aea622d78b       True      False      False      3              3                   3                     0                      22h
    worker-cnf   rendered-worker-cnf-1d871ac76e1951d32b2fe92369879826   False     True       False      2              1                   1                     0                      22h

  2. Podman을 사용하여 registry.redhat.io를 인증합니다.

    $ podman login registry.redhat.io
    Username: myrhusername
    Password: ************
  3. 선택 사항: PPC 도구에 대한 도움말을 표시합니다.

    $ podman run --entrypoint performance-profile-creator registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8 -h

    출력 예

    A tool that automates creation of Performance Profiles
    
    Usage:
      performance-profile-creator [flags]
    
    Flags:
          --disable-ht                        Disable Hyperthreading
      -h, --help                              help for performance-profile-creator
          --info string                       Show cluster information; requires --must-gather-dir-path, ignore the other arguments. [Valid values: log, json] (default "log")
          --mcp-name string                   MCP name corresponding to the target machines (required)
          --must-gather-dir-path string       Must gather directory path (default "must-gather")
          --power-consumption-mode string     The power consumption mode.  [Valid values: default, low-latency, ultra-low-latency] (default "default")
          --profile-name string               Name of the performance profile to be created (default "performance")
          --reserved-cpu-count int            Number of reserved CPUs (required)
          --rt-kernel                         Enable Real Time Kernel (required)
          --split-reserved-cpus-across-numa   Split the Reserved CPUs across NUMA nodes
          --topology-manager-policy string    Kubelet Topology Manager Policy of the performance profile to be created. [Valid values: single-numa-node, best-effort, restricted] (default "restricted")
          --user-level-networking             Run with User level Networking(DPDK) enabled

  4. 검색 모드에서 Performance Profile Creator 툴을 실행합니다.

    참고

    검색 모드는 must-gather의 출력을 사용하여 클러스터를 검사합니다. 생성된 출력에는 다음에 대한 정보가 포함됩니다.

    • 할당된 CPU ID로 NUMA 셀 파티셔닝
    • 하이퍼스레딩 활성화 여부

    이 정보를 사용하여 Performance Profile Creator 툴에 제공된 일부 인수에 대해 적절한 값을 설정할 수 있습니다.

    $ podman run --entrypoint performance-profile-creator -v /must-gather:/must-gather:z registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8 --info log --must-gather-dir-path /must-gather
    참고

    이 명령은 Performance Profile Creator 툴을 podman의 새 진입점으로 사용합니다. 호스트의 must-gather 데이터를 컨테이너 이미지에 매핑하고 필요한 사용자 제공 프로필 인수를 호출하여 my-performance-profile.yaml 파일을 생성합니다.

    -v 옵션은 다음 중 하나로 설정할 수 있습니다.

    • must-gather 출력 디렉터리
    • must-gather 압축 해제된 tarball이 포함된 기존 디렉터리

    info 옵션에는 출력 형식을 지정하는 값이 필요합니다. 가능한 값은 log 및 JSON입니다. JSON 형식은 디버깅을 위해 예약되어 있습니다.

  5. podman을 실행합니다.

    $ podman run --entrypoint performance-profile-creator -v /must-gather:/must-gather:z registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8 --mcp-name=worker-cnf --reserved-cpu-count=20 --rt-kernel=true --split-reserved-cpus-across-numa=false --topology-manager-policy=single-numa-node --must-gather-dir-path /must-gather  --power-consumption-mode=ultra-low-latency > my-performance-profile.yaml
    참고

    Performance Profile Creator 인수는 Performance Profile Creator 인수 테이블에 표시됩니다. 다음 인수가 필요합니다.

    • reserved-cpu-count
    • mcp-name
    • rt-kernel

    이 예제의 mcp-name 인수는 oc get mcp 명령의 출력에 따라 worker-cnf로 설정됩니다. SNO(Single Node OpenShift)는 --mcp-name=master를 사용합니다.

  6. 생성된 YAML 파일을 검토합니다.

    $ cat my-performance-profile.yaml

    출력 예

    apiVersion: performance.openshift.io/v2
    kind: PerformanceProfile
    metadata:
      name: performance
    spec:
      additionalKernelArgs:
      - nmi_watchdog=0
      - audit=0
      - mce=off
      - processor.max_cstate=1
      - intel_idle.max_cstate=0
      - idle=poll
      cpu:
        isolated: 1,3,5,7,9,11,13,15,17,19-39,41,43,45,47,49,51,53,55,57,59-79
        reserved: 0,2,4,6,8,10,12,14,16,18,40,42,44,46,48,50,52,54,56,58
      nodeSelector:
        node-role.kubernetes.io/worker-cnf: ""
      numa:
        topologyPolicy: single-numa-node
      realTimeKernel:
        enabled: true

  7. 생성된 프로필을 적용합니다.

    참고

    프로필을 적용하기 전에 Performance Addon Operator를 설치합니다.

    $ oc apply -f my-performance-profile.yaml

19.1.2.1. podman을 실행하여 성능 프로파일을 만드는 방법

다음 예제에서는 podman을 실행하여 NUMA 노드 간에 분할될 예약된 20개의 CPU가 있는 성능 프로필을 생성하는 방법을 보여줍니다.

노드 하드웨어 구성:

  • 80 CPU
  • 하이퍼 스레딩 활성화
  • 두 개의 NUMA 노드
  • 짝수 번호의 CPU는 NUMA 노드 0에서 실행되고 홀수 번호의 CPU는 NUMA 노드 1에서 실행

podman을 실행하여 성능 프로필을 생성합니다.

$ podman run --entrypoint performance-profile-creator -v /must-gather:/must-gather:z registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8 --mcp-name=worker-cnf --reserved-cpu-count=20 --rt-kernel=true --split-reserved-cpus-across-numa=true --must-gather-dir-path /must-gather > my-performance-profile.yaml

생성된 프로필은 다음 YAML에 설명되어 있습니다.

  apiVersion: performance.openshift.io/v2
  kind: PerformanceProfile
  metadata:
    name: performance
  spec:
    cpu:
      isolated: 10-39,50-79
      reserved: 0-9,40-49
    nodeSelector:
      node-role.kubernetes.io/worker-cnf: ""
    numa:
      topologyPolicy: restricted
    realTimeKernel:
      enabled: true
참고

이 경우 NUMA 노드 0에 CPU 10개가 예약되고 NUMA 노드 1에 CPU 10개가 예약됩니다.

19.1.3. Performance Profile Creator 래퍼 스크립트 실행

성능 프로필 래퍼 스크립트는 PPC(Performance Profile Creator) 툴의 실행을 간소화합니다. podman 실행과 관련된 복잡성을 숨기고 매핑 디렉터리를 지정하면 성능 프로필을 만들 수 있습니다.

사전 요구 사항

  • Performance Addon Operator 이미지에 액세스합니다.
  • must-gather tarball에 액세스합니다.

프로세스

  1. 예를 들어 다음과 같이 run-perf-profile-creator.sh라는 이름의 파일을 로컬 시스템에 생성합니다

    $ vi run-perf-profile-creator.sh
  2. 다음 코드를 파일에 붙여넣습니다.

    #!/bin/bash
    
    readonly CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-podman}
    readonly CURRENT_SCRIPT=$(basename "$0")
    readonly CMD="${CONTAINER_RUNTIME} run --entrypoint performance-profile-creator"
    readonly IMG_EXISTS_CMD="${CONTAINER_RUNTIME} image exists"
    readonly IMG_PULL_CMD="${CONTAINER_RUNTIME} image pull"
    readonly MUST_GATHER_VOL="/must-gather"
    
    PAO_IMG="registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8"
    MG_TARBALL=""
    DATA_DIR=""
    
    usage() {
      print "Wrapper usage:"
      print "  ${CURRENT_SCRIPT} [-h] [-p image][-t path] -- [performance-profile-creator flags]"
      print ""
      print "Options:"
      print "   -h                 help for ${CURRENT_SCRIPT}"
      print "   -p                 Performance Addon Operator image"
      print "   -t                 path to a must-gather tarball"
    
      ${IMG_EXISTS_CMD} "${PAO_IMG}" && ${CMD} "${PAO_IMG}" -h
    }
    
    function cleanup {
      [ -d "${DATA_DIR}" ] && rm -rf "${DATA_DIR}"
    }
    trap cleanup EXIT
    
    exit_error() {
      print "error: $*"
      usage
      exit 1
    }
    
    print() {
      echo  "$*" >&2
    }
    
    check_requirements() {
      ${IMG_EXISTS_CMD} "${PAO_IMG}" || ${IMG_PULL_CMD} "${PAO_IMG}" || \
          exit_error "Performance Addon Operator image not found"
    
      [ -n "${MG_TARBALL}" ] || exit_error "Must-gather tarball file path is mandatory"
      [ -f "${MG_TARBALL}" ] || exit_error "Must-gather tarball file not found"
    
      DATA_DIR=$(mktemp -d -t "${CURRENT_SCRIPT}XXXX") || exit_error "Cannot create the data directory"
      tar -zxf "${MG_TARBALL}" --directory "${DATA_DIR}" || exit_error "Cannot decompress the must-gather tarball"
      chmod a+rx "${DATA_DIR}"
    
      return 0
    }
    
    main() {
      while getopts ':hp:t:' OPT; do
        case "${OPT}" in
          h)
            usage
            exit 0
            ;;
          p)
            PAO_IMG="${OPTARG}"
            ;;
          t)
            MG_TARBALL="${OPTARG}"
            ;;
          ?)
            exit_error "invalid argument: ${OPTARG}"
            ;;
        esac
      done
      shift $((OPTIND - 1))
    
      check_requirements || exit 1
    
      ${CMD} -v "${DATA_DIR}:${MUST_GATHER_VOL}:z" "${PAO_IMG}" "$@" --must-gather-dir-path "${MUST_GATHER_VOL}"
      echo "" 1>&2
    }
    
    main "$@"
  3. 이 스크립트에 모든 사용자에 대한 실행 권한을 추가합니다.

    $ chmod a+x run-perf-profile-creator.sh
  4. 선택 사항: run-perf-profile-creator.sh 명령 사용을 표시합니다.

    $ ./run-perf-profile-creator.sh -h

    예상 출력

    Wrapper usage:
      run-perf-profile-creator.sh [-h] [-p image][-t path] -- [performance-profile-creator flags]
    
    Options:
       -h                 help for run-perf-profile-creator.sh
       -p                 Performance Addon Operator image 1
       -t                 path to a must-gather tarball 2
    
    A tool that automates creation of Performance Profiles
    
       Usage:
         performance-profile-creator [flags]
    
       Flags:
             --disable-ht                        Disable Hyperthreading
         -h, --help                              help for performance-profile-creator
             --info string                       Show cluster information; requires --must-gather-dir-path, ignore the other arguments. [Valid values: log, json] (default "log")
             --mcp-name string                   MCP name corresponding to the target machines (required)
             --must-gather-dir-path string       Must gather directory path (default "must-gather")
             --power-consumption-mode string     The power consumption mode.  [Valid values: default, low-latency, ultra-low-latency] (default "default")
             --profile-name string               Name of the performance profile to be created (default "performance")
             --reserved-cpu-count int            Number of reserved CPUs (required)
             --rt-kernel                         Enable Real Time Kernel (required)
             --split-reserved-cpus-across-numa   Split the Reserved CPUs across NUMA nodes
             --topology-manager-policy string    Kubelet Topology Manager Policy of the performance profile to be created. [Valid values: single-numa-node, best-effort, restricted] (default "restricted")
             --user-level-networking             Run with User level Networking(DPDK) enabled

    참고

    두 가지 유형의 인수가 있습니다.

    • 래퍼 인수 즉 -h,-p-t
    • PPC 인수
    1
    선택 사항: Performance Addon Operator 이미지를 지정합니다. 설정되지 않은 경우 기본 업스트림 이미지( registry.redhat.io/openshift4/performance-addon-rhel8-operator:v4.8 )가 사용됩니다.
    2
    -t는 필수 래퍼 스크립트 인수이며 must-gather tarball의 경로를 지정합니다.
  5. 검색 모드에서 performance profile creator 툴을 실행합니다.

    참고

    검색 모드는 must-gather의 출력을 사용하여 클러스터를 검사합니다. 생성된 출력에는 다음에 대한 정보가 포함됩니다.

    • 할당된 CPU ID로 NUMA 셀 파티션을 분할
    • 하이퍼스레딩 활성화 여부

    이 정보를 사용하여 Performance Profile Creator 툴에 제공된 일부 인수에 대해 적절한 값을 설정할 수 있습니다.

    $ ./run-perf-profile-creator.sh -t /must-gather/must-gather.tar.gz -- --info=log
    참고

    info 옵션에는 출력 형식을 지정하는 값이 필요합니다. 가능한 값은 log 및 JSON입니다. JSON 형식은 디버깅을 위해 예약되어 있습니다.

  6. 머신 구성 풀을 확인합니다.

    $ oc get mcp

    출력 예

    NAME         CONFIG                                                 UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE
    master       rendered-master-acd1358917e9f98cbdb599aea622d78b       True      False      False      3              3                   3                     0                      22h
    worker-cnf   rendered-worker-cnf-1d871ac76e1951d32b2fe92369879826   False     True       False      2              1                   1                     0                      22h

  7. 성능 프로파일을 생성합니다.

    $ ./run-perf-profile-creator.sh -t /must-gather/must-gather.tar.gz -- --mcp-name=worker-cnf --reserved-cpu-count=2 --rt-kernel=true > my-performance-profile.yaml
    참고

    Performance Profile Creator 인수는 Performance Profile Creator 인수 테이블에 표시됩니다. 다음 인수가 필요합니다.

    • reserved-cpu-count
    • mcp-name
    • rt-kernel

    이 예제의 mcp-name 인수는 oc get mcp 명령의 출력에 따라 worker-cnf로 설정됩니다. SNO(Single Node OpenShift)는 --mcp-name=master를 사용합니다.

  8. 생성된 YAML 파일을 검토합니다.

    $ cat my-performance-profile.yaml

    출력 예

    apiVersion: performance.openshift.io/v2
    kind: PerformanceProfile
    metadata:
      name: performance
    spec:
      cpu:
        isolated: 1-39,41-79
        reserved: 0,40
      nodeSelector:
        node-role.kubernetes.io/worker-cnf: ""
      numa:
        topologyPolicy: restricted
      realTimeKernel:
        enabled: false

  9. 생성된 프로필을 적용합니다.

    참고

    프로필을 적용하기 전에 Performance Addon Operator를 설치합니다.

    $ oc apply -f my-performance-profile.yaml

19.1.4. Performance Profile Creator 인수

표 19.1. Performance Profile Creator 인수

인수설명

disable-ht

하이퍼스레딩을 비활성화합니다.

가능한 값: true 또는 false.

기본값: false

주의

이 인수가 true로 설정된 경우 BIOS에서 하이퍼 스레딩을 비활성화해서는 안 됩니다. 하이퍼 스레딩 비활성화는 커널 명령줄 인수를 사용하여 수행됩니다.

info

이는 클러스터 정보를 캡처하며 검색 모드에서만 사용됩니다. 검색 모드에서는 must-gather-dir-path 인수도 필요합니다. 다른 인수가 설정되면 무시됩니다.

가능한 값은 다음과 같습니다.

  • log
  • JSON

    참고

    이러한 옵션은 디버깅을 위해 예약되는 JSON 형식을 사용하여 출력 형식을 정의합니다.

기본값: log.

mcp-name

대상 머신에 해당하는 MCP 이름 (예:worker-cnf)입니다. 이 매개 변수는 필수입니다.

must-gather-dir-path

디렉터리 경로를 수집해야 합니다. 이 매개 변수는 필수입니다.

사용자가 래퍼 스크립트 must-gather로 툴을 실행하는 경우 스크립트 자체에서 제공되고 사용자는 이를 지정해서는 안 됩니다.

power-consumption-mode

전력 소비 모드입니다.

가능한 값은 다음과 같습니다.

  • default
  • low-latency
  • ultra-low-latency

기본값: default.

profile-name

생성할 성능 프로파일의 이름입니다. 기본값: performance.

reserved-cpu-count

예약된 CPU 수입니다. 이 매개 변수는 필수입니다.

참고

이것은 자연수여야 합니다. 0 값은 허용되지 않습니다.

rt-kernel

실시간 커널을 활성화합니다. 이 매개 변수는 필수입니다.

가능한 값: true 또는 false.

split-reserved-cpus-across-numa

NUMA 노드에서 예약된 CPU를 분할합니다.

가능한 값: true 또는 false.

기본값: false

topology-manager-policy

생성할 성능 프로필의 Kubelet Topology Manager 정책입니다.

가능한 값은 다음과 같습니다.

  • single-numa-node
  • best-effort
  • restricted

기본값: restricted.

user-level-networking

DPDK(사용자 수준 네트워킹)가 활성화된 상태에서 실행합니다.

가능한 값: true 또는 false.

기본값: false