Skip to main content

Module diag

Module diag 

Source
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 ./data

Counters 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 p when dropped, so an early return inside 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 the ADMIT_WAIT park 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_then to holding the log’s mutex.
WAL_WRITE
Of that, just the three write_all syscalls.

Functions§

dump
wal_scope