Skip to main content

Module rtt_tracker

Module rtt_tracker 

Source
Expand description

for adaptive deadlines on every wire round-trip.

Sits alongside super::address_book::AddressBook in the framework. Keyed by crate::ids::NodeSiteId so a single physical peer hosting two logical sites (a fast ping handler + an async GPU compute handler) keeps independent EMAs.

§Hierarchical fallback for estimate_budget_ns

When the engine needs a deadline for a Send to a site, it walks these tiers in order, stopping at the first warm hit:

  1. Per-edge stats for (site, chain_id, hop_index) - exact match in this chain context.
  2. Per-site aggregate Jacobson - every round-trip to this site feeds this EMA regardless of context.
  3. Per-chain prior - refines the global “what’s typical for the kind of topology this chain represents” based on any peer that’s carried chain traffic before.
  4. Global prior - every round-trip in the runtime feeds this EMA with a small learning rate.
  5. Static NodeConfig.per_hop_budget_ns fallback.

§Reverse-path piggyback (consumed in Phase 3e-iii)

On response landing, the runtime parses [EdgeRttReport] entries that downstream sites attached. Each report becomes a reported_outgoing entry on the caller’s per-site RttTrackerEntry so multi-hop chain budgets can compose from one address-book entry per direct neighbor.

Structs§

ChainContext
Optional chain context the engine threads to RttTracker::estimate_budget_ns and RttTracker::observe_round_trip.
EdgeKey
Per-(chain, hop) refinement key.
PhiAccrualState
φ-accrual failure detector per direct chain neighbor. Heartbeat = any wire round-trip in the last window; rising φ indicates the peer is silent relative to its historical inter-arrival distribution.
RttEma
Jacobson/Karels RTT EMA: smoothed SRTT + smoothed RTTVAR with sample-count tracking. Mirrors RFC 6298 §2 with α = 1/8 and β = 1/4.
RttTracker
Runtime-owned RTT tracker.
RttTrackerEntry
One AddressBook-side entry per logical site we’ve ever observed.

Enums§

PhiState
Discrete states tracked by RttTracker::scan_phi for each per-site φ-accrual detector.
PhiTransition
State transitions surfaced by RttTracker::scan_phi. The engine maps each entry onto a bus crate::bus::InfraEvent::PeerSuspect / crate::bus::InfraEvent::PeerDown / crate::bus::InfraEvent::PeerLive.

Functions§

chain_id_from_targets
Hash the compiler’s ai.bytesandbrains.wire.chain_targets metadata value into a stable ChainId. The hash is FNV-1a over the raw bytes - fast, no allocations, deterministic across runs.

Type Aliases§

ChainId
Stable identifier for a chain. Hash of the compiler-stamped comma-separated chain_targets string. Producer and consumer derive the same value from the same string, so cross-site EMAs align without exchanging the raw chain composition.