Skip to main content

Module adaptive_timeout

Module adaptive_timeout 

Source
Expand description

Per-peer adaptive timeout estimation using the TCP-inspired SRTT/RTTVAR algorithm.

This module dynamically adjusts per-peer operation timeouts based on observed RTT history, ensuring timeouts are neither too aggressive nor too conservative. The algorithm is modelled after RFC 6298 (TCP retransmission timer computation).

§Algorithm

On the first RTT sample for a peer:

SRTT   = R
RTTVAR = R / 2

On every subsequent sample:

RTTVAR = (1 - β) * RTTVAR + β * |SRTT - R|
SRTT   = (1 - α) * SRTT   + α * R
RTO    = SRTT + 4 * RTTVAR

where α = 1/8 and β = 1/4 by default (RFC 6298 recommendations).

Structs§

AdaptiveTimeoutConfig
Configuration for PeerAdaptiveTimeout.
PeerAdaptiveTimeout
Per-peer adaptive timeout manager.
RttSample
A single RTT measurement for a specific peer.
TimeoutEstimate
The current timeout estimate and smoothed RTT state for a single peer.
TimeoutStats
Aggregate statistics across all tracked peers.