Open totaam opened 7 months ago
We can probably subclass RenoCongestionControl or CubicCongestionControl or both, and override on_packets_expired
+ on_packets_lost
to take some actions beyond the default congestion control algorithms.
If we register it:
register_congestion_control("xpra", XpraCongestionControl)
Then it can easily be configured (perhaps just via an env var for now): https://github.com/aiortc/aioquic/blob/a6d91fbcb5d7660adb1597bb711f6f963c598e03/src/aioquic/quic/configuration.py#L29
Improving upon #3376, see also #3854.
My understanding of aioquic packet loss is that
QuicConnection
Instantiates aQuicPacketRecovery
, which is a Packet loss and congestion controller. There is no easy way to override this class. Loss detection happens in_detect_loss
Which calls_on_packets_lost
In turn, this callsdelivery_handlers
(see below) and the congestion controllerThe
congestion_control_algorithm
string comes from theQuicConfiguration
and defaults toreno
. The congestion control algorithm is instantiated bycreate_congestion_control
New implementations can be registered viaregister_congestion_control
The abstract base class
QuicCongestionControl
Has useful methods:on_packets_lost
,on_rtt_measurement
, etcThe
on_packets_lost
congestion control methods only affect thecongestion_window
and other congestion attributes:RenoCongestionControl.on_packets_lost
CubicCongestionControl.on_packets_lost
At a lower level: the
QuicPacketBuilder
.start_frame
records an optionalhandler
for each buffer head it creates. This is used for calling methods such as_on_ping_delivery
When we send data: https://github.com/Xpra-org/xpra/blob/e3b595a231a01d41ec139bbb79fe6eb994c26e53/xpra/net/quic/connection.py#L124 This ends up just calling
self._quic.send_stream_data(stream_id, encode_frame(FrameType.DATA, data), end_stream)
which just creates aQuicStream
if needed, and then callswrite
on theQuicStreamSender
TODO, question and ideas:
QuicRttMonitor
.is_rtt_increasing
to drive speed and quality? (it is going to have better granularity and precision than our own ping packets)