Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-10167

Improve CPU detection for the unicorn workers number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Blocker Blocker
    • None
    • None
    • Gateway, System
    • None

      One outcome of the investigation of https://issues.redhat.com/browse/THREESCALE-10003 was that OpenShift moved to cgroups-v2 since OCP 4.14 (see OCPSTRAT-696).

      System depends on some cgroups v1 files to detect the CPU shares for calculating the appropriate number of Unicorn workers (the value can be overriden by UNICORN_WORKERS and UNICORN_WORKER_MULTIPLIER env vars).

      Specifically, the code checks the value of /sys/fs/cgroup/cpu/cpu.shares which is not present when using cgroups-v2. Instead of CPU shares, CPU weight is used.

      More information about this change: https://linuxera.org/cpu-memory-management-kubernetes-cgroupsv2/#cpu-bandwidth-configuration-on-the-node
      The article also has some links to the kubernetes source code. Particularly, these are interesting:

      We probably need to find a better way to detect the amount of available (requested) CPU, independently of the cgroups version used by the cluster.

            Unassigned Unassigned
            rhn-support-dmayorov Daria Mayorova
            Daria Mayorova Daria Mayorova
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: