Repository navigation
Start the gofer with GOMAXPROCS bounded by its cgroup and capped at 8. - #16799
Merged
Merged
Conversation
Go sets `GOMAXPROCS` from the host CPU count and cgroup CPU limits. On large hosts or under cgroup v2 CPU quotas, an unbounded gofer allocates per processor runtime structures that increase anonymous memory by ~1.5-2 MiB per container without improving filesystem I/O throughput, while keeping cgroup file descriptors open inside the gofer. So: - Compute and cap GOMAXPROCS before spawning the gofer - Disable Go's in-process cgroup reader/poller - Close the config.json spec FD once startup finishes to let that memory be reclaimed <details> <summary>Expand for full GCE COS benchstat tables</summary> GCE `c4-standard-96` (96 vCPUs, COS, `transparent_hugepage=madvise`): ``` Benchmark before after delta B/Pss_Anon: GoferIdleUnlimited96CPU-96 4.160Mi ± 2% 2.551Mi ± 2% -38.69% (p=0.000) GoferIdleCpuset4CPU-96 2.285Mi ± 2% 2.254Mi ± 2% ~ (p=0.383) GoferIdleParentQuota0_25CPU-96 3.840Mi ± 1% 1.955Mi ± 1% -49.08% (p=0.000) GoferIdleLeafQuota0_25CPU-96 2.811Mi ± 37% 1.977Mi ± 2% -29.67% (p=0.014) GoferSettled10sUnlimited96CPU 4.098Mi ± 1% 2.469Mi ± 3% -39.75% (p=0.000) GoferSettled10sLeafQuota0_25CPU 3.967Mi ± 3% 1.953Mi ± 0% -50.76% (p=0.000) geomean 3.444Mi 2.179Mi -36.72% B/Pss: GoferIdleUnlimited96CPU-96 4.412Mi ± 3% 2.802Mi ± 3% -36.50% (p=0.000) GoferIdleCpuset4CPU-96 2.512Mi ± 2% 2.484Mi ± 3% ~ (p=0.813) GoferIdleParentQuota0_25CPU-96 4.083Mi ± 2% 2.164Mi ± 5% -47.02% (p=0.000) GoferIdleLeafQuota0_25CPU-96 3.372Mi ± 34% 2.192Mi ± 3% -34.99% (p=0.001) GoferSettled10sUnlimited96CPU 4.479Mi ± 2% 2.842Mi ± 3% -36.56% (p=0.000) GoferSettled10sLeafQuota0_25CPU 4.315Mi ± 2% 2.389Mi ± 1% -44.64% (p=0.000) geomean 3.787Mi 2.465Mi -34.92% open-fds / threads: Unlimited & Cpuset4 open-fds 46.00 ± 0% 44.00 ± 0% -4.35% (p=0.000) Parent & Leaf 0.25-CPU open-fds 44.00 ± 0% 42.00 ± 0% -4.55% (p=0.000) threads geomean 6.928 7.109 +2.60% sec/op: ContainerRunUnlimited96CPU-96 44.73m ± 3% 44.06m ± 1% ~ (p=0.119) ContainerRunLeafQuota0_25CPU-96 32.33m ± 5% 36.37m ± 4% +12.50% (p=0.005) GoferCreate1024FilesPar64-96 206.8m ± 7% 204.1m ± 3% ~ (p=0.741) GoferColdStat4096FilesPar64-96 197.0m ± 2% 196.5m ± 2% ~ (p=0.335) geomean 87.60m 89.54m +2.21% ``` GCE `c4-standard-16` (16 vCPUs, COS, `transparent_hugepage=madvise`): ``` Benchmark before after delta B/Pss_Anon: GoferIdleUnlimited16CPU-16 2.588Mi ± 4% 2.508Mi ± 3% -3.09% (p=0.000) GoferIdleCpuset4CPU-16 2.264Mi ± 2% 2.285Mi ± 2% ~ (p=0.446) GoferIdleParentQuota0_25CPU-16 2.371Mi ± 4% 1.938Mi ± 0% -18.29% (p=0.000) GoferIdleLeafQuota0_25CPU-16 2.084Mi ± 14% 1.961Mi ± 1% -5.90% (p=0.042) GoferSettled10sUnlimited16CPU 2.574Mi ± 3% 2.535Mi ± 4% -1.52% (p=0.000) GoferSettled10sLeafQuota0_25CPU 2.377Mi ± 4% 1.953Mi ± 1% -17.83% (p=0.000) geomean 2.370Mi 2.182Mi -7.94% B/Pss: GoferIdleUnlimited16CPU-16 2.877Mi ± 3% 2.700Mi ± 3% -6.14% (p=0.002) GoferIdleCpuset4CPU-16 2.473Mi ± 4% 2.478Mi ± 2% ~ (p=0.971) GoferIdleParentQuota0_25CPU-16 2.659Mi ± 3% 2.139Mi ± 2% -19.54% (p=0.000) GoferIdleLeafQuota0_25CPU-16 2.479Mi ± 11% 2.176Mi ± 4% -12.23% (p=0.022) GoferSettled10sUnlimited16CPU 2.997Mi ± 1% 2.903Mi ± 3% -3.11% (p=0.016) GoferSettled10sLeafQuota0_25CPU 2.809Mi ± 3% 2.390Mi ± 1% -14.91% (p=0.000) geomean 2.708Mi 2.450Mi -9.55% open-fds / threads: Unlimited & Cpuset4 open-fds 46.00 ± 0% 44.00 ± 0% -4.35% (p=0.000) Parent & Leaf 0.25-CPU open-fds 44.00 ± 0% 42.00 ± 0% -4.55% (p=0.000) threads geomean 6.928 6.928 +0.00% sec/op: ContainerRunUnlimited16CPU-16 28.69m ± 3% 29.46m ± 1% +2.66% (p=0.004) ContainerRunLeafQuota0_25CPU-16 29.07m ± 3% 30.64m ± 3% +5.40% (p=0.000) GoferCreate1024FilesPar64-16 170.7m ± 4% 170.4m ± 4% ~ (p=0.971) GoferColdStat4096FilesPar64-16 184.3m ± 3% 179.7m ± 2% ~ (p=0.203) geomean 71.57m 72.51m +1.32% ``` </details> <details> <summary>Expand for end-to-end GKE Agent Substrate checkpoint/restore benchmarks (all 11 workloads)</summary> End-to-end GKE Agent Substrate `glutton` checkpoint/restore suite on `2 x c3-standard-22` (22 vCPUs, 88 GiB RAM, `pd-balanced`, `0%` RPC/HTTP errors, `0` OOMs across all runs). Each cell shows `Clean HEAD median [min-max] (n=4 independent clean-room runs) -> After (delta)`; `~` indicates `After` falls within unmodified `HEAD`'s observed `[min-max]` range across `n=4` runs, and PSI memory stall `%` deltas are reported in percentage points (`pp`): | Workload (per-trial samples) | `app_restore` p50 (ms) | `checkpoint` p50 (ms) | `checkpoint` p95 (ms) | `ResumeActor` p50 (ms) | Worker WS p95 | Worker Mem PSI p95 | | :--- | ---: | ---: | ---: | ---: | ---: | ---: | | `1u sync` (n=41-44 ckpts, 7 scrapes) | 29.00 [28.95-29.52] -> 28.57 (-1.5%) | 33.31 [32.88-33.90] -> 32.61 (-2.1%) | 38.40 [36.90-40.78] -> 38.26 (~) | 80.0 [80.0-81.0] -> 79.0 (-1.2%) | 24.8 MiB [20.9-30.2 MiB] -> 23.7 MiB (~) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `1u pause` (n=52 ckpts, 7 scrapes) | 29.27 [29.05-29.37] -> 28.15 (-3.8%) | 33.44 [32.95-34.74] -> 33.08 (~) | 38.84 [37.76-40.15] -> 42.89 (+10.4%) | 80.5 [79.0-82.0] -> 77.0 (-4.3%) | 21.7 MiB [21.3-22.3 MiB] -> 21.0 MiB (-0.7 MiB) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `5u sync` (n=204-217 ckpts, 7 scrapes) | 29.45 [29.29-29.88] -> 29.05 (-1.3%) | 33.65 [33.22-34.00] -> 33.33 (~) | 40.44 [39.31-41.14] -> 38.98 (-3.6%) | 79.0 [78.0-80.0] -> 78.0 (~) | 35.1 MiB [29.4-45.7 MiB] -> 42.3 MiB (~) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `5u pause` (n=250-252 ckpts, 7 scrapes) | 29.42 [28.97-29.78] -> 29.16 (~) | 33.84 [33.28-34.08] -> 34.48 (+1.9%) | 39.94 [39.63-40.64] -> 40.76 (+2.1%) | 78.5 [77.0-80.0] -> 79.0 (~) | 36.9 MiB [31.2-46.2 MiB] -> 30.4 MiB (-6.5 MiB) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `10u sync` (n=376-412 ckpts, 7 scrapes) | 29.84 [29.71-30.38] -> 29.45 (-1.3%) | 34.08 [33.83-34.12] -> 33.64 (-1.3%) | 42.09 [40.43-42.42] -> 39.61 (-5.9%) | 79.5 [79.0-81.0] -> 78.0 (-1.9%) | 32.2 MiB [21.2-43.3 MiB] -> 43.8 MiB (+11.6 MiB) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `10u pause` (n=478-481 ckpts, 7 scrapes) | 29.25 [28.93-29.35] -> 28.93 (~) | 33.67 [33.40-34.03] -> 33.49 (~) | 39.67 [39.07-40.08] -> 39.24 (~) | 78.5 [78.0-79.0] -> 78.0 (~) | 30.3 MiB [28.2-41.9 MiB] -> 41.6 MiB (~) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `15u oversub` (n=1789-1851 ckpts, 13 scrapes) | 31.24 [31.05-31.78] -> 30.86 (-1.2%) | 34.32 [34.15-34.52] -> 34.38 (~) | 40.67 [40.25-40.88] -> 41.14 (+1.2%) | 83.5 [83.0-84.0] -> 83.0 (~) | 46.7 MiB [43.3-47.1 MiB] -> 44.9 MiB (~) | 0.00% [0.00-0.00%] -> 0.00% (~) | | `1GiB sync` (n=6-7 ckpts, 7 scrapes) | 30.61 [28.48-30.77] -> 29.19 (~) | 3486.4 [3266.6-3977.9] -> 3289.1 (~) | 4957.9 [4749.5-5589.9] -> 5463.2 (~) | 105.0 [100.0-110.0] -> 110.0 (~) | 1.12 GiB [1.06-1.44 GiB] -> 1.19 GiB (~) | 1.17% [0.70-1.77%] -> 0.79% (~) | | `1GiB pause` (n=7-8 ckpts, 7-13 scrapes) | 32.22 [30.97-37.16] -> 31.63 (~) | 3917.3 [3244.3-4572.4] -> 3404.1 (~) | 5235.5 [4086.0-6378.8] -> 4979.6 (~) | 155.0 [100.0-270.0] -> 400.0 (+158.1%) | 1.28 GiB [1.04-1.29 GiB] -> 1.23 GiB (~) | 1.43% [1.33-1.89%] -> 1.49% (~) | | `2GiB sync` (n=3 ckpts, 7 scrapes) | 29.73 [29.42-30.13] -> 29.10 (-2.1%) | 8967.6 [8790.8-9274.4] -> 8952.7 (~) | 9991.1 [9246.3-10440.0] -> 10510.8 (+5.2%) | 110.0 [100.0-110.0] -> 97.0 (-11.8%) | 2.12 GiB [1.35-2.30 GiB] -> 2.34 GiB (+10.0%) | 2.02% [1.63-3.15%] -> 1.98% (~) | | `2GiB pause` (n=3-4 ckpts, 9-13 scrapes) | 31.54 [31.06-32.28] -> 30.19 (-4.3%) | 9677.6 [8719.4-10786.0] -> 9731.3 (~) | 10004.0 [8770.5-16934.0] -> 10592.8 (~) | 205.0 [100.0-290.0] -> 210.0 (~) | 2.19 GiB [1.47-2.47 GiB] -> 2.30 GiB (~) | 3.23% [2.03-3.38%] -> 2.84% (~) | Tradeoffs & variance notes: - Sub-threshold host scaling: `c3-standard-22` nodes have 22 vCPUs (`GOMAXPROCS` 22 -> 8, saving 14 `P`s per gofer vs 88 `P`s on 96-vCPU hosts). Even on 22-vCPU nodes, `app_restore` p50 is faster than `HEAD`'s 4-run `[min-max]` band on 8/11 workloads (`-1.2%` to `-4.3%`) and `~` on the remaining 3/11. - Lightweight checkpoint & scrape variance: `checkpoint` p50 is `~` or `-1.3%` to `-2.1%` faster on 10/11 workloads (`+1.9%` / `+0.64 ms` on `5u pause`); `10u sync` worker working set (`43.8 MiB` vs `32.2 [21.2-43.3] MiB`) is `0.5 MiB` above `HEAD` max across `n=7` 10s Prometheus scrapes that alias with idle (`~21 MiB`) vs mid-sandbox (`~43 MiB`) intervals. - Large-memory single-trial I/O variance (`n=3-7` ckpts): `1GiB pause` client `ResumeActor` p50 (`400.0 ms`, `n=6` RPCs) reflects an async wake request arriving while background `1 GiB` `pd-balanced` writeout is still flushing (node-local `app_restore` p50 was `31.63 ms` `~`), and `2GiB sync` worker working set (`2.34 GiB`, `n=7` scrapes) is `0.04 GiB` above `HEAD`'s `2.30 GiB` max. </details> Fixes #16153 PiperOrigin-RevId: 1011949210
copybara-service
Bot
force-pushed
the
test/cl1009280923
branch
from
November 2, 2026 08:34
8f55936 to
0cf7325
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start the gofer with GOMAXPROCS bounded by its cgroup and capped at 8.
Go sets
GOMAXPROCSfrom the host CPU count and cgroup CPU limits.On large hosts or under cgroup v2 CPU quotas, an unbounded gofer allocates
per processor runtime structures that increase anonymous memory by ~1.5-2 MiB
per container without improving filesystem I/O throughput, while
keeping cgroup file descriptors open inside the gofer.
So:
be reclaimed
Expand for full GCE COS benchstat tables
GCE
c4-standard-96(96 vCPUs, COS,transparent_hugepage=madvise):GCE
c4-standard-16(16 vCPUs, COS,transparent_hugepage=madvise):Expand for end-to-end GKE Agent Substrate checkpoint/restore benchmarks (all 11 workloads)
End-to-end GKE Agent Substrate
gluttoncheckpoint/restore suite on2 x c3-standard-22(22 vCPUs, 88 GiB RAM,pd-balanced,0%RPC/HTTP errors,0OOMs across all runs). Each cell showsClean HEAD median [min-max] (n=4 independent clean-room runs) -> After (delta);~indicatesAfterfalls within unmodifiedHEAD's observed[min-max]range acrossn=4runs, and PSI memory stall%deltas are reported in percentage points (pp):app_restorep50 (ms)checkpointp50 (ms)checkpointp95 (ms)ResumeActorp50 (ms)1u sync(n=41-44 ckpts, 7 scrapes)1u pause(n=52 ckpts, 7 scrapes)5u sync(n=204-217 ckpts, 7 scrapes)5u pause(n=250-252 ckpts, 7 scrapes)10u sync(n=376-412 ckpts, 7 scrapes)10u pause(n=478-481 ckpts, 7 scrapes)15u oversub(n=1789-1851 ckpts, 13 scrapes)1GiB sync(n=6-7 ckpts, 7 scrapes)1GiB pause(n=7-8 ckpts, 7-13 scrapes)2GiB sync(n=3 ckpts, 7 scrapes)2GiB pause(n=3-4 ckpts, 9-13 scrapes)Tradeoffs & variance notes:
c3-standard-22nodes have 22 vCPUs (GOMAXPROCS22 -> 8, saving 14Ps per gofer vs 88Ps on 96-vCPU hosts). Even on 22-vCPU nodes,app_restorep50 is faster thanHEAD's 4-run[min-max]band on 8/11 workloads (-1.2%to-4.3%) and~on the remaining 3/11.checkpointp50 is~or-1.3%to-2.1%faster on 10/11 workloads (+1.9%/+0.64 mson5u pause);10u syncworker working set (43.8 MiBvs32.2 [21.2-43.3] MiB) is0.5 MiBaboveHEADmax acrossn=710s Prometheus scrapes that alias with idle (~21 MiB) vs mid-sandbox (~43 MiB) intervals.n=3-7ckpts):1GiB pauseclientResumeActorp50 (400.0 ms,n=6RPCs) reflects an async wake request arriving while background1 GiBpd-balancedwriteout is still flushing (node-localapp_restorep50 was31.63 ms~), and2GiB syncworker working set (2.34 GiB,n=7scrapes) is0.04 GiBaboveHEAD's2.30 GiBmax.Fixes #16153