Expand description
Adaptive Kademlia lookup scheduler that tunes alpha (parallelism) based on observed latency.
§Overview
Kademlia’s alpha parameter controls how many concurrent RPCs are issued per lookup
iteration. The standard value is 3, but a static setting is suboptimal:
- A congested network benefits from lower alpha so that fewer in-flight requests compete for the same scarce bandwidth.
- A fast network with low latency can sustain higher alpha, reducing total lookup latency through more parallelism.
This module provides:
AdaptiveLookupScheduler— adjusts alpha in[1, 8]based on a rolling p90 latency window.PeerLatencyTracker— per-peer latency tracking with median-based ranking.LookupSchedulerStats— snapshot statistics (no atomics, clone-friendly).
Structs§
- Adaptive
Lookup Scheduler - Maintains a rolling latency window and adaptively tunes Kademlia
alpha. - Lookup
Scheduler Stats - Point-in-time snapshot of
AdaptiveLookupSchedulerstate. - Peer
Latency Tracker - Tracks per-peer latency with sliding windows and enables peer ranking.
Constants§
- ALPHA_
DEFAULT - Default parallelism degree (standard Kademlia value).
- ALPHA_
MAX - Maximum parallelism degree for Kademlia lookups.
- ALPHA_
MIN - Minimum parallelism degree for Kademlia lookups.