From 6e3fda770099b749fe11b61c84ff809274573eb9 Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Thu, 11 Jun 2026 10:57:39 -0400 Subject: [PATCH] crio: inject gomaxprocs by default Go processes run on nodes with many CPUs suffer a problem where the go runtime creates runtime threads per CPUs it can see, assuming there isn't a CPU limit on the process. However, the kubernetes scheduler is binpacking pods based on CPU request, which means go processes actually have access to less CPU time than the go runtime is expecting. This causes scheduling and GC latency. min_injected_gomaxprocs is a feature in CRI-O that injects the GOMAXPROCS environment variable into all pods based on their CPU request. if the pod has a limit, GOMAXPROCS isn't set. Otherwise, it is set to 2*requested CPUs. The 2* figure was found from perf testing, allowing the go runtime to burst up to capacity, while mitigating the latency. Turn this on by default. Signed-off-by: Peter Hunt --- .../arbiter/01-arbiter-container-runtime/_base/files/crio.yaml | 1 + .../master/01-master-container-runtime/_base/files/crio.yaml | 1 + .../worker/01-worker-container-runtime/_base/files/crio.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/arbiter/01-arbiter-container-runtime/_base/files/crio.yaml b/templates/arbiter/01-arbiter-container-runtime/_base/files/crio.yaml index 315172252d..d86b9387d6 100644 --- a/templates/arbiter/01-arbiter-container-runtime/_base/files/crio.yaml +++ b/templates/arbiter/01-arbiter-container-runtime/_base/files/crio.yaml @@ -33,6 +33,7 @@ contents: "/etc/hostname", ] drop_infra_ctr = true + min_injected_gomaxprocs = 1 [crio.runtime.runtimes.runc] runtime_root = "/run/runc" diff --git a/templates/master/01-master-container-runtime/_base/files/crio.yaml b/templates/master/01-master-container-runtime/_base/files/crio.yaml index 315172252d..d86b9387d6 100644 --- a/templates/master/01-master-container-runtime/_base/files/crio.yaml +++ b/templates/master/01-master-container-runtime/_base/files/crio.yaml @@ -33,6 +33,7 @@ contents: "/etc/hostname", ] drop_infra_ctr = true + min_injected_gomaxprocs = 1 [crio.runtime.runtimes.runc] runtime_root = "/run/runc" diff --git a/templates/worker/01-worker-container-runtime/_base/files/crio.yaml b/templates/worker/01-worker-container-runtime/_base/files/crio.yaml index 7829a1c7a5..51a7fd4a83 100644 --- a/templates/worker/01-worker-container-runtime/_base/files/crio.yaml +++ b/templates/worker/01-worker-container-runtime/_base/files/crio.yaml @@ -33,6 +33,7 @@ contents: "/etc/hostname", ] drop_infra_ctr = true + min_injected_gomaxprocs = 1 [crio.runtime.runtimes.runc] runtime_root = "/run/runc"