Repository navigation
Description
What's the problem
After #818 one api-refresh tick still starts about 100 external programs (fixture: two pools, 20 control outcomes). Most of them redo work whose inputs did not change since the previous tick, 15 seconds earlier:
parse_configchecksconfig.jsonagain: about 29jqcalls plus the unknown-key check.- The config view, the config revision and the control history in the feed are rebuilt from the same files.
- The hardware inventory is read again: RAM modules from
dmidecode, board and firmware strings, CPU model, MAC, OS version. - The autotune unit values are read with
systemctl catagain.
Separately, a design pass for the compiled tick of #717 found that a version the existing tests can check is about 3,000 lines in any compiled language. It is not a small change, and its gain over a cheaper shell tick is not measured.
What it impacts
Every rig: a steady CPU cost on cores meant for mining. On a 96-thread rig that was mining on every thread, before #818, one tick cost 2.5 CPU-seconds, about 17% of one core. It also decides whether, and in which language, the compiled tick of #717 is worth building.
How I found it
- Counted on the container fixture of Each api-refresh tick starts more than 200 processes #818: 285 started programs before that change, 100 after (52
jq, about 29 of them inparse_config). - Timed stand-ins for a single-process tick on the same inputs, interleaved in one container session: about 50 times less CPU than the shell in C and about 30 times in Go. A Rust stand-in is being timed. The stand-ins skip checks the shell makes, so they are a ceiling, not a product.
- A design pass for a compiled tick against the test stack (three code reads, a design, a critique): 2 tests run the tick as a command; 20 call the shell function in process, of which 12 could reach a binary and 8 replace helpers; the binary would still have to start
curl,systemctl,journalctlanddmidecodeby name for the stand-ins in the suite to work. - Unknown: how much a cache really saves (my estimate: from 100 to roughly 25 to 35 programs), how many real rig configs a cautious compiled tick would hand back to the shell, and hashrate with and without the refresh.
How important is it
Medium. No behaviour is wrong. It is the next cheap step after #818, and it is the measurement the port plan asks for before the tick is ported (#704, #717).
Acceptance criteria
- One comparison on the same inputs, variants interleaved in one session: started programs and CPU per tick for
develop, a caching shell tick, and the compiled stand-ins. Reported as ratios, with the method and the raw numbers. - The same before and after readings on a rig-class host while it mines, described by class only.
- If caching is adopted: the four output files are byte-identical to the uncached tick, cold and warm; each cached value is dropped when one of its inputs changes, with a test per input; nothing a non-root account can write is trusted as a cache; a committed bound on started programs for a warm tick fails on the uncached code.
- A written go or no-go for a compiled tick: the gain left after caching, the language, and what must exist first. Owner direction of 24 November 2026: a small, simple component may be C if it is tested properly; anything large is Rust.
- Measure a baseline and a control arm for the RigForge refresh tick and verbs before porting #704 and Port the api-refresh tick to Rust #717 are updated with the result.
Possible solutions
- Key the cached config results on a hash of
config.jsonand of the state files the feed reads, keep them under the root-owned runtime directory, and rebuild on any mismatch. - Read the hardware inventory once per boot.
- Leave the changing part as it is: miner summary, service state, temperature and power, hugepages, MSR status.
- A compiled tick only if the remaining gain justifies a second implementation. By the size found it would be Rust, with the delivery pieces of the port plan first (Add the Rust workspace, toolchain pin and CI gates #705 to Paired Pithead issue: carry the prebuilt RigForge binary in the image #710).
Activity
pithead-developer commentedon Nov 24, 2026
Blocked on #818
The change for this issue touches the same functions as #818 and builds on it, so it lands after #818. The measurement for this issue is in progress.
pithead-developer commentedon Nov 24, 2026
Measured, 24 November 2026. One tick on the same inputs (two pools, 20 control outcomes), all variants interleaved in one container session pinned to four CPUs; medians of 45 idle ticks and 32 ticks with four busy loops. The machine was busy, so read the ratios, not the milliseconds.
developdevelopbefore #818About the cache prototype:
config.jsonand the 20 state files it depends on (onesha256sum, about 3 ms per tick) and keeps the hardware inventory per boot. The cache is data only and lives in a root-only folder.rigforge.sh).About the compiled stand-ins: Rust and C are equal within the noise of the run, Go is about 1.5 times slower than Rust. Rust needed no
unsafe. All three skip five config checks the shell makes, so they show a ceiling, not a product.Not measured: a rig-class host, and hashrate with and without the refresh. Those readings come next, after #848 is merged.
pithead-developer commentedon Nov 24, 2026
Owner decision, 24 November 2026: the compiled refresh (#717) is built now, in Rust.
What that means for this issue:
#704 and #717 no longer wait for this issue.
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.
pithead-developer commentedon Nov 27, 2026
Owner decision (2026-11-27): closed as superseded by the Rust refresh (#717), which makes this cache unnecessary. The measurements in this issue stay as the record.