Measurement · 2 September 2026
A historian forwarder that cost a core: 13 million rows decoded to ship 7 thousand
Two 20-second CPU profiles of the standing instance before and after a change to how the Parquet history store is read for forwarding.
Question
Once lock contention was out of the way, the next question was “what other performance improvements are there?” It was answered with a CPU profile of the quiet standing instance rather than with a list of guesses.
Method
Two 20-second go tool pprof CPU profiles were taken of the standing instance
(32 tasks, RT kernel, no IDE open), one before and one after the change. The
change also added telemetry to the history store and the forwarder: passes,
files listed and skipped, rows decoded and rows emitted. The live store could
then report its own read amplification. The two reader changes each have a
test against a reference answer (the original generic reader; a read over
every file). Mutants of their guards were put back and caught: swapped
columns, a dropped seek, a dropped short-read error, and the file filter as a
no-op.
Result
| 20 s profile | Before (1.0.1546) | After (1.0.1547) |
|---|---|---|
| Process CPU | 2.18 cores | 1.17 cores |
| TDengine forwarder | 19.30 s (43.9 %) | 0.52 s (2.2 %) |
| Raw substrate read | 19.10 s | 0.30 s |
| Scans | 15.36 s | 14.93 s |
The forwarder polled the store every 5 s from its oldest cursor, about 60 s back. Two causes made each poll cost about a core:
- Time selection stopped at the hour. Every minute file in the current hour was handed to the reader without a time test. By minute 28 a pass decoded about 13 million rows to send about 7 thousand, and the pass took longer than its tick.
- The row reader paid for reflection and a schema conversion on every row. These two accounted for 12.6 of the forwarder’s 19.3 s.
The fix reads each file’s footer statistics once and skips any file whose rows all fall outside the window. A file whose bounds cannot be read is kept, so errors still surface. Projected columns are now read directly, without reflection. Steady state after deployment: a 5 s pass decodes about 1.1 million rows to send about 65–70 thousand (11.7× amplification), at 0.07–0.10 µs per decoded row, and 959 of 2,703 listed files are skipped on their footer alone.
Limits
- The remaining 11.7× amplification is the cost of a 60 s late-write grace behind a 5 s tick, and is still open (see Open problems).
- The trend-query paths were not moved to the column reader in this change.
- One instance, one workload, two profiles.
What it rests on
Sources
Repository paths name records in the ControlForge repository, which is private and not available for review.
- Performance record with both profiles
docs/perf/forward-path/README.md - Footer-bounds skip (withinWindow)
pkg/historian/parquet_query.go - Projected column reader (projReader)
pkg/historian/parquet_query_purego.go
Still open: Can a store-and-forward reader keep a late-write grace without re-reading it every tick?