quinn icon indicating copy to clipboard operation
quinn copied to clipboard

Add rtt estimator snapshots, if more accurate rtt analysis is demanded

Open StarStarJ opened this issue 1 year ago • 1 comments

Motivation:

This would allow users to get more accurate RTT information for specific needs like the range of jitter in the rtt. Additionally it was not possible to request the other member variables of the rtt estimator before. (https://github.com/quinn-rs/quinn/issues/931#issuecomment-2185200803)

This can be useful for more accurate timer tracking between server & client on less stable connections (or a dos attack on the server or similar things)

For example here, we see that the smoothed is kinda outdated

[quinn/examples/client.rs:147:5] conn.rtt_estimator_snapshot() = RttEstimatorSnapshot {
    latest: 126.72µs,
    smoothed: Some(
        391.996µs,
    ),
    var: 237.002µs,
    min: 126.72µs,
}

On linux you can also use: sudo tc qdisc add dev lo root netem delay 300ms 300ms

to simulate a massive lag, and then the smooth rtt value will only provide a rough estimate of the average latency, not about the range of the rtts.

If you think a whole snapshot is too much, I'd already be happy to get access to just the latest member of the rtt estimator, so I could at least fire up my own logic without applying a custom congestion controller.

StarStarJ avatar Jun 24 '24 07:06 StarStarJ