Class Cubic
java.lang.Object
io.github.mahmoudimus.quic.congestion.Cubic
- All Implemented Interfaces:
Controller
The CUBIC congestion controller (RFC 9438), counting the window in bytes: slow start, then the
cubic window function
W_cubic(t) = C * (t - K)^3 + W_max with the Reno-friendly
estimate W_est, fast convergence, and a multiplicative decrease of beta_cubic =
0.7. A congestion event later found spurious restores the state from before it.
Threads. Not thread-safe; owned by one connection.
-
Field Summary
Fields inherited from interface io.github.mahmoudimus.quic.congestion.Controller
BASE_DATAGRAM_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionCubic(CubicConfig config, long now, int currentMtu) A controller in slow start. -
Method Summary
Modifier and TypeMethodDescriptioncopy()A copy of the controller's state, for a new path that starts from this one.longThe initial window.metrics()Metrics for statistics and tracing.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.voidonMtuUpdate(int newMtu) The path's MTU changed.voidPackets deemed lost were all acknowledged after all: the last congestion event was spurious.longThe slow start threshold.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
onEndAcks, onRateSample, onSent, pacingRate
-
Constructor Details
-
Cubic
A controller in slow start.- Parameters:
config- the configurationnow- the current time, in nanosecondscurrentMtu- the path's maximum UDP payload size
-
-
Method Details
-
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
-
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
-
onSpuriousCongestionEvent
public void onSpuriousCongestionEvent()Description copied from interface:ControllerPackets deemed lost were all acknowledged after all: the last congestion event was spurious.- Specified by:
onSpuriousCongestionEventin interfaceController
-
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
-
slowStartThreshold
public long slowStartThreshold()The slow start threshold.- Returns:
- bytes,
Long.MAX_VALUEbefore the first congestion event
-
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
-