Repository navigation
Description
What's the problem
Every 15 s the whole Bash script loads to run api_refresh, which assembles summary.json, summary-authed.json, health.json and tune.json from _api_rigforge_block, _health_json, _watchdog_json, _api_tune_json, _api_power_json, _api_config_json, _api_control_history_json, _api_refresh_status, _pool_conn_status and _tcp_probe, plus util/revision-key.sh. This is the hot path and the main place a performance claim could be earned.
What it impacts
The sister feed that Pithead and LAN clients read; CPU and memory on rigs; the contract fixtures tests/contract/v1/feed.json and feed-authed.json.
How I found it
Reading systemd/rigforge-api-refresh.service.template and the functions above at ea41133. Per-tick cost is unmeasured (see #704), so this must not start before that issue reports.
How important is it
Medium; value depends on the baseline.
Acceptance criteria
- The PR links the Measure a baseline and a control arm for the RigForge refresh tick and verbs before porting #704 report and states the expected saving versus the control arm.
- Any feed field added by merged v1.19 or v1.20 issues is covered by a contract fixture before the port.
- With
RIGFORGE_IMPL=rust,rigforge.sh api-refreshruns the native tick and the generated feed files byte-matchtests/contract/v1/feed.jsonandfeed-authed.jsonafter the same normalization the suite applies. -
make test-suitepasses unchanged underRIGFORGE_IMPL=rust, honoring the sandbox env hooks (MEMINFO,GOVERNOR_FILE,RAPL_DIR,SERVICE_NAME,RIGFORGE_REVISION_KEY,API_CMD, PATH-stubbed externals). - Output files are written atomically exactly as today; a failed probe degrades to the same health values pinned in
tests/contract/v1/README.md. - The Measure a baseline and a control arm for the RigForge refresh tick and verbs before porting #704 script is rerun at this head; CPU time, peak RSS and spawn count per tick are reported against the baseline and the control arm, including a null or negative result.
-
PARITY.mdupdated.make checkpasses.
Possible solutions
- Reuse the library from Port config validation and the writable allowlist to a Rust library #714, Port the xmrig overlay, RandomX profile and daemon-pool helpers to Rust #715 and Port revision key, feed identity, config-apply state and doctor JSON to Rust #716 for config and feed types; call
systemctland probes viastd::process::Commandwhere no native replacement is wanted. - Keep the tick as a CLI verb run by the existing oneshot unit rather than a daemon.
- Unknown: how much of the gain the control arm already captures.
Release: issue rigforge#716 closed
Who: operator
Activity
pithead-developer commentedon Nov 24, 2026
Blocked on #847
Owner direction, 24 November 2026, for the compiled tick:
Findings from a design pass against the test stack, for whoever builds it:
api_refreshin process. With the hand-over inside that function and the shell variables exported, 12 of the 20 can reach a binary with no test edited. 8 replace helpers and stay shell-only, for the ledger.curl,systemctl,journalctlanddmidecodeby name through PATH, or the stand-ins in the suite stop working. About 8 started programs per tick remain.pithead-developer commentedon Nov 24, 2026
Blocked on #704
Blocked on #716
Owner decision, 24 November 2026: build the compiled refresh now, in Rust, ahead of its place in the shipping order. This replaces the direction in the comment above.
Measured first, in one container session with the versions taking turns (CPU per refresh against today's shell): the shell fix of #818 uses 2.2 to 2.4 times less, a caching version on top of it 4.7 to 5.4 times less, and a single compiled process 45 to 50 times less in Rust or C and about 30 times less in Go. Rust and C are equal within noise. The numbers and the method are on #847.
Order of work, under the ground rules of #669:
RIGFORGE_IMPLswitch, the parity job and the ledger).The default stays
bash. Nothing here changes what a rig runs until the switch is set. #847 no longer blocks this issue: a compiled refresh needs no cache.