Commit 94f99ff
authored
osdc/hf-cache: cap rclone Go heap with GOMEMLIMIT (#892)
rclone is a Go binary, and its OOMs are a **GC** problem, not a genuine
memory requirement: under bursty `--vfs-cache-mode full` buffering the
Go heap grows past the cgroup limit before the GC runs, so the kernel
OOM-kills rclone and the `/mnt/hf_cache` FUSE mount dies node-wide (→
job-pod `CreateContainerError`).
## What
Give the Go runtime a soft heap ceiling (`GOMEMLIMIT`) at **~90% of the
reserved limit** so the GC reclaims buffering before the kernel does —
no limit changes.
`deploy.sh` derives `GOMEMLIMIT` from each tier's memory (the value it
already renders for `__RCLONE_MEMORY_LIMIT__`) and injects it as a
**literal env value**:
```yaml
env:
- name: GOMEMLIMIT
value: "__GOMEMLIMIT__" # e.g. 460MiB for the 512Mi tier
```
So there's:
- no runtime shell arithmetic (a `bytes * 90` intermediate overflows
32-bit busybox);
- no downward-API indirection to resolve at runtime;
- a literal you can read straight out of the rendered manifest.
Go needs `MiB`/`GiB` suffixes (it rejects k8s `Mi`/`Gi`), so the value
is converted in `deploy.sh`, not reused verbatim.
Per tier: 256Mi→230MiB, 512Mi→460MiB, 1Gi→921MiB, 2Gi→1843MiB,
4Gi→3686MiB.
## Verification
- `just lint` 13/13, `just test` pass.
- Rendered each tier via `deploy.sh`'s logic and validated with
`kubeconform -strict`; confirmed the manifest carries a literal
`GOMEMLIMIT` (no `resourceFieldRef`) that sits below the container
limit.1 parent 0b994ee commit 94f99ff
4 files changed
Lines changed: 47 additions & 10 deletions
File tree
- osdc
- integration-tests/workflows
- modules/hf-cache
- kubernetes
- tests/smoke
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
| 719 | + | |
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| |||
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | | - | |
| 734 | + | |
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
| |||
1076 | 1076 | | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | | - | |
| 1079 | + | |
1080 | 1080 | | |
1081 | 1081 | | |
1082 | 1082 | | |
| |||
1091 | 1091 | | |
1092 | 1092 | | |
1093 | 1093 | | |
1094 | | - | |
| 1094 | + | |
1095 | 1095 | | |
1096 | 1096 | | |
1097 | 1097 | | |
| |||
1467 | 1467 | | |
1468 | 1468 | | |
1469 | 1469 | | |
1470 | | - | |
| 1470 | + | |
1471 | 1471 | | |
1472 | 1472 | | |
1473 | 1473 | | |
| |||
1482 | 1482 | | |
1483 | 1483 | | |
1484 | 1484 | | |
1485 | | - | |
| 1485 | + | |
1486 | 1486 | | |
1487 | 1487 | | |
1488 | 1488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | 103 | | |
| |||
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| 111 | + | |
100 | 112 | | |
101 | 113 | | |
102 | 114 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| |||
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
160 | | - | |
| 167 | + | |
| 168 | + | |
161 | 169 | | |
162 | 170 | | |
163 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| |||
0 commit comments