Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/a2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ The Required list is ordered by priority. Independent children may proceed concu
- [Native metric integration](/quest/a2/native-stream-stats.md) - actual native delivered-versus-queued progress
- [Native metric availability](/quest/a2/native-stats-upstream.md) - advance external accessor prerequisites
- [QMux draft readiness](/quest/a2/qmux-draft-readiness.md) - establish strict-validation compatibility boundary
- [Quiche send-rate audit](/quest/a2/quiche-delivery-rate.md) - app-limited samples under legacy controllers
- [Quinn provider-neutral rustls release](/quest/a2/quinn-provider-release.md) - waiting on quinn-rs/quinn#2341
- [Quinn adapter removal](/quest/a2/quinn-adapter-removal.md) - switch to upstream and delete the port
13 changes: 0 additions & 13 deletions quest/a2/quiche-delivery-rate.md

This file was deleted.

47 changes: 47 additions & 0 deletions rs/web-transport-quiche/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,53 @@ Call `Connection::close` before dropping to choose the close code and reason;
final drop preserves an explicit close already in progress. Await
`Connection::closed` when the application needs the driver to complete teardown.

## Send-rate statistics

`Connection::stats()` returns `ez::ConnectionStats`; its `send_rate` field and
`web_transport_trait::Stats::estimated_send_rate()` expose the same estimate in
bits per second. The driver snapshots Quiche's public `PathStats::delivery_rate`
and converts bytes per second with saturating multiplication by eight.
`None` means no path statistics have been sampled yet; `Some(0)` is possible
before a usable sample. The estimate is not a guarantee of link capacity or application throughput,
and it can remain stale while the application sends too little to measure capacity.

For the audited tokio-quiche 0.20.1 and Quiche 0.30.0 releases, both client and
server use the [default `cubic` controller][cc-default]. Pass `Settings` to either builder's
`with_settings` method to select another `cc_algorithm`:
Comment thread
kixelated marked this conversation as resolved.
Resolved

| `Settings::cc_algorithm` | Meaning of the reported estimate |
| --- | --- |
| `cubic` (default), `reno` | Latest accepted delivery-rate sample. A sample marked app-limited may raise the rate but cannot lower it. There is no windowed maximum or expiry of the retained estimate. |
| `bbr`, `bbr2`, `bbr2_gcongestion` | All select BBR2. Its maximum-bandwidth filter rejects lower app-limited samples; the reported estimate is also capped by BBR2's congestion-derived `bandwidth_lo` when present. |

The client builder's `with_settings` replaces its defaults, and
`Settings::default()` leaves `verify_peer` false. When starting a client from
`Settings::default()`, set `verify_peer = true` or configure
`with_root_certificates` or `with_server_certificate_hashes`; otherwise the
client skips certificate verification.

Quiche's [controller selector][cc-selector] accepts those five names and rejects
others. The [CUBIC/Reno sampler][legacy-rate] already checks the app-limited flag
before replacing its stored rate, so this value is not an unfiltered raw sample.
Its per-sample flag is internal, and `PathStats::max_bandwidth` is `None` for
these controllers. The public statistics therefore cannot support a separate
application-side windowed filter that distinguishes app-limited samples.
Deriving `cwnd / rtt` would give a send-window heuristic rather than a measured
delivery rate, and would not recover that missing flag.

For BBR2, [the network model][bbr-model] reports
`min(max_bandwidth, bandwidth_lo)` when the congestion bound exists, and
`max_bandwidth` otherwise. Using the public `PathStats::max_bandwidth` instead
would discard that bound. Keeping `delivery_rate` preserves both upstream sample
filtering and the controller's response to congestion. Delivery-rate accuracy
also depends on respecting Quiche's pacing hints: disabling pacing or ignoring
those hints in the transport or platform can distort the estimate.

[cc-default]: https://github.com/cloudflare/quiche/blob/925b225825e2188f8e58e359114150500557bf61/tokio-quiche/src/settings/quic.rs
[cc-selector]: https://github.com/cloudflare/quiche/blob/be47c5011215b9f13bad06bd7627d3ae49888a19/quiche/src/recovery/mod.rs
[legacy-rate]: https://github.com/cloudflare/quiche/blob/be47c5011215b9f13bad06bd7627d3ae49888a19/quiche/src/recovery/congestion/delivery_rate.rs
[bbr-model]: https://github.com/cloudflare/quiche/blob/be47c5011215b9f13bad06bd7627d3ae49888a19/quiche/src/recovery/gcongestion/bbr2/network_model.rs

## Testing

Run `cargo test -p web-transport-quiche` for the unit tests and socket integration
Expand Down
1 change: 1 addition & 0 deletions rs/web-transport-quiche/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ impl web_transport_trait::Stats for ez::ConnectionStats {
self.rtt
}

/// Returns [`ez::ConnectionStats::send_rate`], with its controller-specific limits.
fn estimated_send_rate(&self) -> Option<u64> {
self.send_rate
}
Expand Down
2 changes: 1 addition & 1 deletion rs/web-transport-quiche/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use web_transport_proto::error_from_http3;

use crate::ez;

/// An error returned by [Connection], split based on whether they are underlying QUIC errors or WebTransport errors.
/// An error returned by [Connection](crate::Connection), split based on whether they are underlying QUIC errors or WebTransport errors.
#[derive(Clone, thiserror::Error, Debug)]
pub enum SessionError {
#[error("remote closed: code={0} reason={1}")]
Expand Down
16 changes: 13 additions & 3 deletions rs/web-transport-quiche/src/ez/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,18 @@ pub struct ConnectionStats {
pub packets_lost: u64,
/// Smoothed round-trip time for the active path, if one is established.
pub rtt: Option<Duration>,
/// Estimated send rate in bits per second (from the congestion controller),
/// if a path is established.
/// Estimated available send bandwidth in bits per second, if a path exists.
///
/// Uses Quiche 0.30's [`PathStats::delivery_rate`](quiche::PathStats::delivery_rate).
/// BBR2 reports its filtered bandwidth estimate, capped by its congestion
/// bound. CUBIC (the default) and Reno report the most recent accepted rate
/// sample: a lower app-limited sample cannot replace the previous rate,
/// but there is no windowed maximum or expiry for stale estimates.
///
/// This is not a guarantee of link capacity or application throughput.
/// Estimates can remain stale while the sender is app-limited. `Some(0)`
/// is possible before a usable sample; `None` means no path statistics have
/// been sampled yet.
pub send_rate: Option<u64>,
}

Expand All @@ -57,7 +67,7 @@ impl ConnectionStats {
packets_received: stats.recv as u64,
packets_lost: stats.lost as u64,
rtt: path.as_ref().map(|p| p.rtt),
// quiche reports the delivery rate in bytes/sec; the trait wants bits/sec.
// Quiche reports bytes/sec; the trait wants bits/sec.
send_rate: path.as_ref().map(|p| p.delivery_rate.saturating_mul(8)),
}
}
Expand Down
Loading