fix(services/lib): defaults favour throughput; opt-in politeness; add sccache (#188) #190
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills!190
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_mik_build_perf_quickwins"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The cargo invocation in svc_install used
nice 19 ionice 3 -j 4defaultsto protect live Hero services from build-storm. That made sense when
hero_proc had a chatty SQLite log store fighting cargo for I/O bandwidth
(hero_proc#85). With the SQLite→hero_log refactor (a2eff7c), that
contention is gone and the polite-defaults are just leaving CPU on the
floor. Verified live during the 2026-05-01 herodemo deploy: setting
HERO_CARGO_JOBS=0 mid-deploy took load avg from 1.14 to 15.22, with
iowait staying at 0-4% — the box is CPU-bound, and we were using ~6%
of available CPU.
Three changes, all behaviour-equivalent for callers that set the env
vars explicitly:
Defaults flipped: HERO_CARGO_JOBS now defaults to 0 (cargo auto =
nproc), HERO_CARGO_NICE to 0 (no priority adjustment),
HERO_CARGO_IONICE_C to "" (skip ionice prefix entirely on the cargo
invocation). Operators on live boxes that need politeness set
HERO_CARGO_NICE=19 HERO_CARGO_IONICE_C=3 explicitly (same env vars,
inverted defaults).
New env: HERO_CARGO_SCCACHE (default "auto"). When sccache is
available in PATH, RUSTC_WRAPPER=sccache is exported into the
cargo build env. Shared compile cache across services means the
second build of any common dep (axum, tokio, rustls, hyper, …)
short-circuits to a copy. Big win on a service_install_all that
compiles 22 services with overlapping dep trees. "1" = require
(error if missing). "0" = disabled.
ionice prefix is now skipped when HERO_CARGO_IONICE_C is empty,
matching the macOS skip path. The build line print also shows
sccache state ("[sccache=ON]") for operator visibility.
Verified: nu --ide-check returns only type hints, no parse errors.
Refs: #188
Signed-off-by: mik-tf
The cargo invocation in svc_install used `nice 19 ionice 3 -j 4` defaults to protect live Hero services from build-storm. That made sense when hero_proc had a chatty SQLite log store fighting cargo for I/O bandwidth (hero_proc#85). With the SQLite→hero_log refactor (a2eff7c), that contention is gone and the polite-defaults are just leaving CPU on the floor. Verified live during the 2026-05-01 herodemo deploy: setting HERO_CARGO_JOBS=0 mid-deploy took load avg from 1.14 to 15.22, with iowait staying at 0-4% — the box is CPU-bound, and we were using ~6% of available CPU. Three changes, all behaviour-equivalent for callers that set the env vars explicitly: 1. Defaults flipped: HERO_CARGO_JOBS now defaults to 0 (cargo auto = nproc), HERO_CARGO_NICE to 0 (no priority adjustment), HERO_CARGO_IONICE_C to "" (skip ionice prefix entirely on the cargo invocation). Operators on live boxes that need politeness set HERO_CARGO_NICE=19 HERO_CARGO_IONICE_C=3 explicitly (same env vars, inverted defaults). 2. New env: HERO_CARGO_SCCACHE (default "auto"). When sccache is available in PATH, RUSTC_WRAPPER=sccache is exported into the cargo build env. Shared compile cache across services means the second build of any common dep (axum, tokio, rustls, hyper, …) short-circuits to a copy. Big win on a service_install_all that compiles 22 services with overlapping dep trees. "1" = require (error if missing). "0" = disabled. 3. ionice prefix is now skipped when HERO_CARGO_IONICE_C is empty, matching the macOS skip path. The build line print also shows sccache state ("[sccache=ON]") for operator visibility. Verified: nu --ide-check returns only type hints, no parse errors. Refs: #188 Signed-off-by: mik-tf