Repository navigation
Description
What's the problem
The 15-second timer runs api_refresh (rigforge.sh:5209), which calls the whole parse_config (:420-797) every tick, then builds several JSON documents with many small jq calls.
_warn_unknown_config_keys(:758) startstrper config key per known key and its output is discarded.parse_configreads about 30 scalar keys with onejqeach._api_control_history_json(:5204) runs onejqper outcome file, up to 20._cpu_eff_khz(:4877) runscatonce per core.- The tail of
api_refreshruns about 7jqpasses over the same body.
What it impacts
Every mining rig pays a steady cost on a machine whose cores are meant to mine. The cost grows with the number of config keys and cores.
How I found it
Measured. One tick started 214 external commands in a Linux container (jq 91, tr 62, dirname 16), about 0.87 CPU-seconds. On a fully loaded 96-thread test rig the unit's own accounting showed a mean of 2.5 CPU-seconds per run over 40 runs, about 17% of one core at one run per 15 seconds. A second fixture (20 control outcome files, 64 cores) counted 240, of which parse_config was 158 (95 tr, 61 jq). Unknown: how much of a tick is interpreter start-up versus spawns.
Code references are from develop at b7bf3b1. Checked for an existing issue: none found (complements #704, which asks for a baseline and a control arm, and #717, the port; this supplies measured numbers and a cheap-shell candidate for the control arm, it does not replace either).
How important is it
Medium. A constant, avoidable load that scales with rig size, but no behaviour is wrong.
Acceptance criteria
- A committed count of external commands per tick is at most 100 on a fixture with two pools and 20 control outcomes (285 before the change), with bounds for
jqandtr. Edited 24 November 2026: the first target of about 60 is not reached by this change. The remaining programs come from the pool JSON chain and the feed builders; that work continues in api-refresh redoes work that did not change since the previous tick #847. - Feed files stay byte-identical to
tests/contract/v1/feed.jsonandtests/contract/v1/feed-authed.jsonafter the suite's normalization. - The measurement is reusable as the control arm for Measure a baseline and a control arm for the RigForge refresh tick and verbs before porting #704.
Possible solutions
- Lowercase in the shell (
${k,,}) instead oftr; this alone removes about 62 spawns. - Read plain keys with one
jq ... | @tsv; skip the typo lint when the tick sets the tolerate flag. - Build the control history once when it changes;
read -r v <"$f"instead ofcat; onejqfor the tail. ${k,,}needs Bash 4, newer than macOS ships;rigforge.shalso has no line slack underdocs/dev/file-budget.tsv, so changes must be line-neutral or cut elsewhere.
Activity
perf: api-refresh starts 100 programs per tick instead of 285 (#818)
fix: api-refresh tick starts bounded processes (#818) + file-budget u…
pithead-developer commentedon Nov 27, 2026
Waiting on a transient bench_outage condition, not on another issue. tier4-e2e submit on head 0372478 refused: bench-ci control plane at the configured BENCH_CI_URL refuses connections — bench-ci health/tiers each exhaust 5 read retries with 'request failed: <urlopen error [Errno 61] Connection refused>'; the host answers ping but the service port is CLOSED/REFUSED (nc -z). No job was created. The runner re-checks it (first at 2026-11-27T07:52Z, at most 5 times).
pithead-architect commentedon Nov 27, 2026
Release regroom (owner request, 2026-11-27): moved from v1.20.0 to v1.23.0. Trimmed from v1.20.0 (update API only) per the owner. Perf, hardening and measurement group.
Merge origin/develop into agent/818 (#818)
Cut the programs started per API refresh tick from 263 to 94 (#818) (#…
pithead-developer commentedon Nov 28, 2026
Merged in #848.