Prepare a MicroShift workload for low latency

To use low latency, configure pod annotations to set the microshift-low-latency container runtime configuration for your workloads by using the RuntimeClass feature.

Prerequisites
  • You installed the microshift-low-latency RPM package.

  • You configured workload partitioning.

Procedure
  • Use the following example to set the following annotations in the pod spec:

    cpu-load-balancing.crio.io: "disable"
    irq-load-balancing.crio.io: "disable"
    cpu-quota.crio.io: "disable"
    cpu-load-balancing.crio.io: "disable"
    cpu-freq-governor.crio.io: "<governor>"

    Example pod that runs oslat test:

    apiVersion: v1
    kind: Pod
    metadata:
      name: oslat
      annotations:
        cpu-load-balancing.crio.io: "disable"
        irq-load-balancing.crio.io: "disable"
        cpu-quota.crio.io: "disable"
        cpu-c-states.crio.io: "disable"
        cpu-freq-governor.crio.io: "<governor>"
    spec:
      runtimeClassName: microshift-low-latency
      containers:
      - name: oslat
        image: quay.io/container-perf-tools/oslat
        imagePullPolicy: Always
        resources:
          requests:
            memory: "400Mi"
            cpu: "2"
          limits:
            memory: "400Mi"
            cpu: "2"
        env:
        - name: tool
          value: "oslat"
        - name: manual
          value: "n"
        - name: PRIO
          value: "1"
        - name: delay
          value: "0"
        - name: RUNTIME_SECONDS
          value: "60"
        - name: TRACE_THRESHOLD
          value: ""
        - name: EXTRA_ARGS
          value: ""
        securityContext:
          privileged: true
          capabilities:
            add:
              - SYS_NICE
              - IPC_LOCK
    metadata.annotations.cpu-load-balancing.crio.io

    Disables the CPU load balancing for the pod.

    metadata.annotations.irq-load-balancing.crio.io

    Opts the pod out of interrupt handling (IRQ).

    metadata.annotations.cpu-quota.crio.io

    Disables the CPU completely fair scheduler (CFS) quota at the pod run time.

    metadata.annotations.cpu-c-states.crio.io

    Enables or disables C-states for each CPU. Set the value to disable to provide the best performance for a high-priority pod.

    metadata.annotations.cpu-freq-governor.crio.io

    Sets the cpufreq governor for each CPU. The performance governor is recommended for high-priority workloads.

    spec.runtimeClassName

    The runtimeClassName must match the name of the performance profile configured in the node. For example, microshift-low-latency.

    Note

    Disable CPU load balancing only when the CPU manager static policy is enabled and for pods with guaranteed QoS that use whole CPUs. Otherwise, disabling CPU load balancing can affect the performance of other containers in the node.

    Important

    For the pod to have the Guaranteed QoS class, it must have the same values of CPU and memory in requests and limits. See Guaranteed (Kubernetes upstream documentation)