Skip to content

D16: pace the telemetry consumer so a busy host never wakes it - #15

Merged
JBailes merged 1 commit into
mainfrom
feat/telemetry-pacing
Oct 31, 2026
Merged

JBailes merged 1 commit into
mainfrom
feat/telemetry-pacing

Conversation

@JBailes

@JBailes JBailes commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

A consumer that slept on the doorbell after every drain was woken once per
pump while the host was busy, and read each record right behind the host,
so every record's cache lines crossed cores. Pinned on a Threadripper 3970X
that cost 17 to 30 ns per event and about 30,000 doorbell writes per 2
million events.

The host now publishes drain_interval_ns and idle_after_ns in the region
header (offsets 32 and 40, from reserved space). A consumer that found
records recently keeps consumer_waiting down and drains every interval; only
after idle_after without records does it sleep on the doorbell. A busy host
then makes no system calls for telemetry and the cost is 5 to 6 ns per
event with 0 to 2 doorbell writes per run; an idle ring still costs
nothing. Defaults are 10 us and 1 ms; the host operator overrides them with
OURO_TELEMETRY_DRAIN_INTERVAL_US and OURO_TELEMETRY_IDLE_AFTER_US, an
embedding with ouro_host_telemetry_pacing. The C and Go readers follow it,
an explicit Interrupt still ends a paced wait, and the reader struct gains
a field, so VERSION goes to 0.4.0.

The dispatch bench pins its threads (OURO_BENCH_HOST_CPU,
OURO_BENCH_DRAIN_CPU) and prints the host's doorbell writes, and the perf
budget holds that count under a ceiling, a check that means the same on
every machine.

Separately, a Release configuration defined NDEBUG, which compiled out every
assert in the C tests and conformance harnesses, so the suite would build
and pass while testing nothing (it failed to build only because of unused
variables). Those targets now always keep their asserts, and CI builds and
runs a Release configuration.
@JBailes
JBailes merged commit 96e8000 into main Oct 31, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant