Class Bbr
- All Implemented Interfaces:
Controller
bbr_sender.cc) and draft-cardwell-iccrg-bbr-congestion-control.
The controller moves through four modes: Bbr.Mode.STARTUP doubles the
sending rate each round trip until the bandwidth estimate stops growing by 25% for three rounds
(or a loss happens in that round), Bbr.Mode.DRAIN empties the queue built up doing so, and
Bbr.Mode.PROBE_BW cycles its pacing gain through 1.25, 0.75 and six rounds of 1.0 around the
estimate. When no PROBE_RTT has started for ten seconds, Bbr.Mode.PROBE_RTT cuts the window
to three quarters of the bandwidth-delay product for at least 200 ms to measure the minimum RTT
again. Losses put it in conservation, then growth, recovery until a round passes without any.
Where quinn's port departs from BBRv1, this one follows the draft: the bandwidth comes from
the connection's delivery rate samples (onRateSample(long, io.github.mahmoudimus.quic.congestion.RateSample)) through a max filter that expires
after ten round trips, the minimum RTT expires ten seconds after it was last measured or
refreshed and only then starts a PROBE_RTT, and STARTUP grows the window only below its target.
pacingRate() reaches the connection's pacer, which quinn's ignores, so DRAIN drains.
The README of this module lists what still differs from the draft.
Rates are bytes per second; times are nanoseconds.
Threads. Not thread-safe; owned by one connection.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface io.github.mahmoudimus.quic.congestion.Controller
BASE_DATAGRAM_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionA controller in STARTUP.Bbr(BbrConfig config, long now, int currentMtu, RandomGenerator.SplittableGenerator random) A controller in STARTUP with a chosen source of randomness, for reproducible runs. -
Method Summary
Modifier and TypeMethodDescriptionlongThe bottleneck bandwidth estimate: the largest delivery rate sampled, not application limited, over the last ten round trips.copy()A copy of the controller's state, for a new path that starts from this one.longThe initial window.booleanWhether STARTUP found the bottleneck bandwidth.metrics()Metrics for statistics and tracing.longminRtt()The minimum RTT the model uses.mode()The current mode.voidonAck(long now, long sent, long bytes, boolean appLimited, RttEstimator rtt) A packet's delivery was confirmed.voidonCongestionEvent(long now, long sent, boolean persistentCongestion, boolean ecn, long lostBytes) Packets were deemed lost, or marked with ECN congestion experienced.voidonEndAcks(long now, long inFlight, boolean appLimited, long largestPacketNumberAcked) A batch of acknowledgements, all with the samenow, is complete.voidonMtuUpdate(int newMtu) The path's MTU changed.voidonRateSample(long now, RateSample sample) The delivery rate sample of a batch of acknowledgements, given after theirController.onAck(long, long, long, boolean, io.github.mahmoudimus.quic.congestion.RttEstimator)calls and beforeController.onEndAcks(long, long, boolean, long), when the batch acknowledged packets in flight. quinn has no such call.voidonSent(long now, long bytes, long lastPacketNumber) One or more packets were just sent.longThe pacing rate: the bandwidth estimate times the pacing gain, or in STARTUP never less than the initial window per minimum RTT.longThe round trips counted so far.longwindow()The congestion window.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.mahmoudimus.quic.congestion.Controller
onSpuriousCongestionEvent
-
Constructor Details
-
Bbr
A controller in STARTUP.- Parameters:
config- the configurationnow- the current timecurrentMtu- the path's maximum UDP payload size
-
Bbr
A controller in STARTUP with a chosen source of randomness, for reproducible runs.- Parameters:
config- the configurationnow- the current timecurrentMtu- the path's maximum UDP payload sizerandom- picks where in the PROBE_BW gain cycle each PROBE_BW starts
-
-
Method Details
-
onSent
public void onSent(long now, long bytes, long lastPacketNumber) Description copied from interface:ControllerOne or more packets were just sent.- Specified by:
onSentin interfaceController- Parameters:
now- the current timebytes- the bytes sentlastPacketNumber- the number of the last packet sent
-
onAck
Description copied from interface:ControllerA packet's delivery was confirmed.- Specified by:
onAckin interfaceController- Parameters:
now- the current timesent- when the packet was sentbytes- the packet's sizeappLimited- whether the connection was limited by the application, not the window, before these acknowledgementsrtt- the path's RTT estimate
-
onRateSample
Description copied from interface:ControllerThe delivery rate sample of a batch of acknowledgements, given after theirController.onAck(long, long, long, boolean, io.github.mahmoudimus.quic.congestion.RttEstimator)calls and beforeController.onEndAcks(long, long, boolean, long), when the batch acknowledged packets in flight. quinn has no such call.- Specified by:
onRateSamplein interfaceController- Parameters:
now- the current timesample- the sample
-
onEndAcks
public void onEndAcks(long now, long inFlight, boolean appLimited, long largestPacketNumberAcked) Description copied from interface:ControllerA batch of acknowledgements, all with the samenow, is complete.- Specified by:
onEndAcksin interfaceController- Parameters:
now- the current timeinFlight- the bytes still in flightappLimited- whether the connection was application limitedlargestPacketNumberAcked- the largest packet number ever acknowledged in the space, or -1
-
onCongestionEvent
public void onCongestionEvent(long now, long sent, boolean persistentCongestion, boolean ecn, long lostBytes) Description copied from interface:ControllerPackets were deemed lost, or marked with ECN congestion experienced.- Specified by:
onCongestionEventin interfaceController- Parameters:
now- the current timesent- when the most recent lost packet was sentpersistentCongestion- whether every packet in the persistent congestion period ending with that packet was lost (RFC 9002 section 7.6)ecn- whether this is an ECN signal rather than losslostBytes- the bytes lost, zero for ECN
-
onMtuUpdate
public void onMtuUpdate(int newMtu) Description copied from interface:ControllerThe path's MTU changed.- Specified by:
onMtuUpdatein interfaceController- Parameters:
newMtu- the new maximum UDP payload size
-
window
public long window()Description copied from interface:ControllerThe congestion window.- Specified by:
windowin interfaceController- Returns:
- the ack-eliciting bytes that may be in flight
-
metrics
Description copied from interface:ControllerMetrics for statistics and tracing.- Specified by:
metricsin interfaceController- Returns:
- the window and, where known, the slow start threshold
-
copy
Description copied from interface:ControllerA copy of the controller's state, for a new path that starts from this one.- Specified by:
copyin interfaceController- Returns:
- an independent copy
-
initialWindow
public long initialWindow()Description copied from interface:ControllerThe initial window.- Specified by:
initialWindowin interfaceController- Returns:
- bytes
-
mode
The current mode.- Returns:
- the mode
-
bandwidthEstimate
public long bandwidthEstimate()The bottleneck bandwidth estimate: the largest delivery rate sampled, not application limited, over the last ten round trips.- Returns:
- bytes per second, 0 before the first sample
-
pacingRate
public long pacingRate()The pacing rate: the bandwidth estimate times the pacing gain, or in STARTUP never less than the initial window per minimum RTT.- Specified by:
pacingRatein interfaceController- Returns:
- bytes per second, or -1 before the first bandwidth sample
-
minRtt
public long minRtt()The minimum RTT the model uses.- Returns:
- nanoseconds, 0 before the first measurement
-
isAtFullBandwidth
public boolean isAtFullBandwidth()Whether STARTUP found the bottleneck bandwidth.- Returns:
- true once the bandwidth estimate stopped growing
-
roundCount
public long roundCount()The round trips counted so far.- Returns:
- the round count
-