Skip to main content

Module system_load

Module system_load 

Source
Expand description

G28-D: system load average observation (pre-spawn saturation check). G28-D: system load average observation before spawning LLM subprocesses.

The 2026-06-03 incident saturated a 10-CPU host with load 276 because parallel enrich workers kept spawning claude -p / codex exec children even when the system was already at saturation. This module exposes a single helper that returns true when the 1-minute load average is above 2 × ncpus (the conservative threshold the G28-D original discussion recommended).

Uses sysinfo::System::load_average() which is already a transitive dependency of the project. The read is cheap (single syscall on Linux) and throttled to once per second via a Mutex-cached timestamp.

Functions§

is_system_saturated
G28-D: returns true when the 1-minute load average exceeds 2 × ncpus (the conservative threshold originally proposed in the G28 audit). The default threshold can be overridden by the SQLITE_GRAPHRAG_MAX_LOAD_PER_NCPU env var.
load_average_one
Returns the 1-minute load average as reported by the OS.
ncpus
Returns the number of logical CPUs the runtime can detect.