Expand description
Where an export’s latency actually goes, measured from inside the process.
These exist because the 32-to-96-connection plateau could not be explained
from outside. A closed-loop load generator reports connections × batch / ack latency, so every hypothesis predicts the same throughput curve, and
the server’s CPU was flat at 2.23 of 12 cores at both ends of the sweep —
which rules out “it is working harder” and says nothing about what it is
doing instead. The answer needed a number from inside: the parts of
submit do not add up to submit, and the gap is the finding.
They are also the reason the finding is checkable. Section 11’s numbers are reproducible on the machine that produced them, and a diagnosis resting on instrumentation that was deleted before the commit is not.
Cost. Two Instant::now() pairs and five relaxed atomics per export.
On aarch64-apple-darwin Instant::now() is mach_absolute_time, ~25 ns, so
the whole of it is under 150 ns against a critical section measured at 2.2
ms — five parts per million, and it is on the path whose milliseconds are
the subject. Nothing here allocates and nothing takes a lock; a counter that
contended would be measuring itself.
Reading them. Nothing prints unless the dump task is running, which
mira only starts when its target is enabled:
RUST_LOG=mira=info,mira_core=info,mira::probe=debug mira --data-dir ./dataCounters are cumulative from start, so two dumps five seconds apart are a rate and one dump is a mean over the run.
Structs§
- Probe
- Count, total, maximum and two tail buckets for one interval.
- Scope
- Records elapsed time into
pwhen dropped, so an earlyreturninside the measured function still lands a sample. - WalScope
Statics§
- RUNTIME_
LAG - How late a task that asked to sleep 50 ms actually woke.
- SUBMIT_
ADMIT - Admission:
reserve(), plus theADMIT_WAITpark if every shard was full. - SUBMIT_
TOTAL - The whole of
submit, so the parts can be checked against the sum. They do not add up, which is the entire reason the rest of this module exists. - SUBMIT_
WAIT_ ACK - Waiting for the publish, on the no-log ack path.
- WAL_
ENCODE encode_to_vec— the re-encode an export pays to be framed.- WAL_
HELD - Holding it: the CRC over the body, the three
write_alls, the enqueue. - WAL_
INFLIGHT - Callers currently inside
append_then, and the high-water mark. - WAL_
INFLIGHT_ MAX - WAL_
LOCK_ WAIT - Entering
crate::wal::Wal::append_thento holding the log’s mutex. - WAL_
WRITE - Of that, just the three
write_allsyscalls.