Repository navigation
D16: pace the telemetry consumer so a busy host never wakes it - #15
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.