Repository navigation
Description
What's the problem
There is no dashboard performance result. The /api/state history projection (copy, filter, bucket-average over up to about 86,400 rows, synchronous on the event loop) is suspected hot from a laptop replica (about 85 ms, order of magnitude only). The earlier baseline produced 1 to 5 eligible pairs of the 10 required per cell and the fixed-Python arm was never run. Poll-tick and per-worker scaling (unbounded probe fan-out, per-tick writes, share-list copies, PPLNS window scans) is never measured.
What it impacts
The only candidate for a Rust piece, the dashboard piece decision (fix Python, Go, or Rust), and the dashboard memory claim (about 0.06 GiB in a compose comment, 512m limit).
How I found it
Benchmark track data: five Python cells at 2, 50 and 100 rigs, 24 h history (not 30 days), 1 and 10 clients, none qualified; a descriptive smoke run showed peak RSS about 62 to 65 MB, which is not a baseline. Two confounds are recorded: seeded history ages during a run and the watcher cost CPU. Code read: handle_state runs build_state on the loop per request with no cache.
How important is it
High for the Go-vs-Rust call; no dashboard piece may ship on speed grounds without it. Not release-blocking.
Acceptance criteria
- Arms A (current Python), B (Python with a caching or incremental-downsample fix), C (read-only Go prototype of the projection); conditional arm D (Rust prototype) runs only if both B and C miss the owner budget.
- 2, 50 and 100 rigs, a pinned history fixture that does not age, 1 and 10 clients, 10 eligible pairs per cell or the cell is reported unqualified. The 30-day fixture is a new design choice versus the prior 24 h cells.
- p50, p95 and p99 for /api/state and /metrics, event-loop block time, CPU and memory.current/peak.
- With no HTTP clients: poll-tick duration, process CPU share and event-loop lag at 2, 50 and 100 rigs, plus a per-step profile of build_state, probe fan-out and share scans.
- The report presents arms A to C with a recommended latency and memory budget, and the owner sets the budget from it; an ADR next to docs/dev/config-layer-language.md recommends fix Python, Go sidecar, Rust, or keep.
Possible solutions
Reuse the collector, orchestrator and interleaved-pair harness on go-port/3811-bench after fixing host-noise filtering and fixture aging. Build arm C from go/internal/dashboard charts, series and stateview. Unknown: how many rigs real deployments reach.
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
developatf6ddd449.DIY test server (12 threads, remote-node mode, no rigs connected, a few hours of history), so this is the idle floor:
/api/state: about 10 ms for the 1h range, 21 ms for 24h, 27 to 28 ms for all./metrics: 7 ms.Laptop, synthetic 100 rigs and 30 days of history (order of magnitude only):
/api/state: 50 to 130 ms, on the event loop.worker_history, 80 to 260 ms per call across runs (The worker detail page scans worker_history without a name index #4455).Not measured: poll-tick cost by rig count, the 50-rig and 100-rig cells on server hardware, and the fixed-Python arm.
pithead-developer commentedon Nov 24, 2026
A local three-arm measurement of the dashboard hot paths is in progress: the current Python, a fixed-Python arm, and compiled arms in C and Go, on fixtures of 2, 50 and 100 rigs with 30 days of history and a pinned clock. The harness and the results will be posted here. It runs on one laptop, so it gives ratios between arms, not the cells this issue asks for; those stay open.
Owner direction, 24 November 2026: pull a part out into compiled code where it measurably performs better. A small, simple component may be C if it is tested properly; anything large is Rust.
pithead-developer commentedon Nov 25, 2026
Measured on 24 and 25 November 2026. Six arms answered the same requests from the same pinned data, taking turns in one session. A second pass rebuilt every arm from its sources and ran the numbers again; the figures below are from that second pass.
Setup.
developas it stood on 24 November (version file 2.0.4), CPython 3.11, the dashboard's own aiohttp app, a history of about 80,000 rows, fleets of 2, 50 and 100 rigs. A development machine (arm64, macOS) under other load, not the Linux image. Identical code measured against itself differed by 0.98 to 1.06 at the median, so that is the noise floor.Default request,
GET /api/state?range=all&avg=10m, about 283 KB of JSON, 100 rigs, nothing cached:/metrics: 31 ms today, 12 ms with the Python fix, 3.6 ms with the compiled kernel.Per day, one open tab plus the container health check, which requests
HEAD /api/stateevery 30 seconds. These are computed from the readings above and the request pattern in the code, not measured over a day:With no tab open nothing hits the cache: the compiled kernel is then at about 96 and the Python arm at about 130.
Same output. Every arm returned byte-identical bodies for all 87 reference requests (3 fleet sizes, 29 queries each). Two exceptions that are not about the body:
Problems with the compiled kernel. With the native module switched on, five of the project's own test files crash the interpreter (exit status 139), for the C and the Go library alike. A mocked state object reaches the foreign-function call, and a wrong object becomes a crash instead of an exception. The kernel would also need a compiler in the image build, one build per architecture, and tests of its own for the coverage gate.
Reading, for #4226. The Python route is the better buy at this scale:
A compiled kernel would save at most about 110 CPU-seconds a day beyond the Python fixes without a cache, which is 0.13% of one core, and nothing once the cache is in and a tab is open. Rust was not measured; C and Go were equal within noise in process.
Not measured: the Linux image, a real browser (focus and visibility events fire extra requests), a run over days, and how often a metrics scrape really happens.