Repository navigation
Description
What's the problem
The case for a Rust port rests on cost nobody has measured. rigforge-api-refresh.timer fires every 15 s (OnCalendar=*:*:0/15 in systemd/rigforge-api-refresh.timer.template) and each tick runs $SCRIPT_DIR/rigforge.sh api-refresh (systemd/rigforge-api-refresh.service.template), which loads the roughly 6.2k-line rigforge.sh plus sourced utils and spawns many jq processes (_api_rigforge_block alone is one jq -n with many --argjson inputs). CPU time, peak memory and spawn count per tick are unknown, so the port cannot be judged, and any gain could be credited to Rust that a cheap shell fix would also deliver.
What it impacts
The decision to flip the default in the Rust port tracker (#669) and every later issue in it. Also rigs: a small always-on cost on mining hosts.
How I found it
Reading the timer and service templates and rigforge.sh (api_refresh, _api_rigforge_block, _api_refresh_status, _pool_conn_status, _tcp_probe) while scoping the Rust port, at ea41133. No measurement exists in the repo; #669 already makes the baseline the first deliverable. Benchmark method follows pithead#3811.
How important is it
High for the port, which cannot be justified without it. Low urgency otherwise. It changes no product behavior and unblocks the final flip decision.
Acceptance criteria
- A committed script under
tests/orscripts/measures, per run: CPU time, peak RSS and process-spawn count for oneapi-refreshtick, plus wall time forstatus,doctor --jsonandapply --dry-run. - Each measurement uses at least 5 interleaved repetitions and a discarded warm-up, reports median and spread, and states warm or cold cache.
- Runs on a KVM guest and on a rig-class host, described by class only; no hostnames, addresses or paths appear in the committed report (
make lint-topologypasses). - Raw results and the exact commit measured are committed under
docs/dev/rust-port/. - A control arm is measured: the cheapest change to the current Bash that targets the profiled hot spot (for example fewer
jqspawns per tick). It is a measurement branch or patch, not merged unless the owner asks. - The report states what fraction of tick cost is interpreter startup versus
jqand other spawns, or says it could not separate them. -
make checkpasses.
Possible solutions
/usr/bin/time -vplusstrace -c -f -e trace=execve(orperf stat) around one tick on the KVM guest; median of repeated runs.- A small sampler script modelled on the Pithead benchmark sampler in pithead#3811.
- Unknown: how many ticks per day the cost actually matters for; the report should state it rather than assume.
Release: date 2026-12-04
Who: operator
Activity
pithead-developer commentedon Nov 24, 2026
Data points for the baseline, from a read-only audit of
developatf37640f5.api-refreshtickjq91,tr62,dirname16), 0.85 s wall, 0.87 CPU-secondsrigforge-api-refreshunit, systemd CPU accounting, last 40 runsrigforge-watchdogunit, last 20 runsversionThe rig figure is under full mining load, so it includes contention with the miner. The container figure is the idle floor.
Not measured: peak RSS of a tick, an A/A noise floor, and a second rig.
The spawn sources and a cheap shell control arm are listed in #818.
pithead-developer commentedon Nov 24, 2026
Blocked on #847
Status, 24 November 2026. For the refresh tick the baseline and the control arm exist:
The next arm (a tick that does not redo unchanged work) and the readings on a rig-class host are tracked in #847. This issue waits for #847 so that no second harness is built. Left for this issue afterwards: wall time of
status,doctor --jsonandapply --dry-run, the KVM guest run, and committing the script and the raw results.pithead-developer commentedon Nov 24, 2026
Owner decision, 24 November 2026: the compiled refresh (#717) is built now, so this measurement is done now too. #847 no longer blocks it.
Already measured, in one container session with the versions taking turns: started programs and CPU per refresh for today's shell, for the shell fix of #818 (the control arm this issue asks for), for a caching arm, and for single-process stand-ins in C, Go and Rust. The numbers are on #847.
Still to do here:
status,doctor --jsonandapply --dry-run;