Skip to content

fix(rust): size the build slice from host RAM - #129

Merged
catinspace-au merged 1 commit into
mainfrom
fix/rust-slice-from-ram
Nov 9, 2026
Merged

catinspace-au merged 1 commit into
mainfrom
fix/rust-slice-from-ram

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

rustbuild.slice allowed 70% of RAM before killing a build. On a 30 GB host that was 21 GB, and one 16 GB clippy run took the whole machine down.

The developer-rust role sets memory limits from host RAM at converge. It also adds agents.slice for Claude Code sessions, which hyperi-ai attaches at SessionStart.

Defaults, all role vars a host can override:

  • rustbuild.slice: MemoryMax 33%, MemoryHigh 27%, floors 4 GiB and 3 GiB.
  • Desktop reserve: the larger of 30% of RAM and 9 GiB.
  • agents.slice: MemoryMax is RAM minus reserve minus the rust MemoryMax. MemoryHigh is 90% of that. CPUWeight 25, TasksMax 1024 per vCPU.
  • Off by default: an oomd drop-in on agents.slice, and a user@.service Delegate drop-in (system scope, applies at next login).

Template values (ansible --check --diff):

30 GB host (memtotal 31149 MB, 12 vCPU):

  • reserve 9344M
  • rustbuild.slice High 8410M, Max 10279M
  • agents.slice High 10373M, Max 11526M, CPUWeight 25, TasksMax 12288

92 GB host (94208 MB, 32 vCPU):

  • reserve 28262M
  • rustbuild.slice High 25436M, Max 31088M
  • agents.slice High 31372M, Max 34858M, CPUWeight 25, TasksMax 32768

tools/ci/run-tests.sh passes (syntax check, shellcheck, 106 pytest, matrix and file-reference gates). ansible-lint reports nothing in the changed files. Host execution is untested.

This repo holds no inventory for desktop-derek, so a bigger build share for it goes in that host's vars, e.g. rust_governor_memory_max_pct: 60.

rustbuild.slice allowed 70% of RAM before killing a build. That was 21 GB on a 30 GB host. One 16 GB clippy run took down the host, VS Code and every session.

The developer-rust role works out the limits from ansible_facts memtotal_mb at converge:

- rustbuild.slice: MemoryMax 33% and MemoryHigh 27%, floors 4 GiB and 3 GiB. A build-dedicated host raises rust_governor_memory_max_pct and rust_governor_memory_high_pct in its own vars.
- Add agents.slice, the cgroup hyperi-ai attaches each Claude Code session to. MemoryMax is RAM minus a desktop reserve (the larger of 30% and 9 GiB) minus the rust MemoryMax. The three budgets add up to RAM. MemoryHigh is 90% of that. CPUWeight is 25. TasksMax is 1024 per vCPU.
- Off by default: a systemd-oomd drop-in on agents.slice (agents_oomd_enabled).
- Also off by default: a user@.service drop-in delegating cpuset and io (agents_delegate_enabled, system scope, applies at next login).

The shim's nice 19 and the slice CPUWeight are unchanged.
@catinspace-au
catinspace-au merged commit be61bb3 into main Nov 9, 2026
18 checks passed
@catinspace-au
catinspace-au deleted the fix/rust-slice-from-ram branch November 9, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant