Package io.aeron.driver
Class StaticWindowCongestionControl
java.lang.Object
io.aeron.driver.StaticWindowCongestionControl
- All Implemented Interfaces:
CongestionControl,AutoCloseable
Congestion control algorithm which uses the min of
MediaDriver.Context.initialWindowLength() or half a term
length as a static window.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringURI param value to identify thisCongestionControlstrategy.Fields inherited from interface io.aeron.driver.CongestionControl
FORCE_STATUS_MESSAGE_BIT -
Constructor Summary
ConstructorsConstructorDescriptionStaticWindowCongestionControl(long registrationId, UdpChannel udpChannel, int streamId, int sessionId, int termLength, int senderMtuLength, InetSocketAddress controlAddress, InetSocketAddress sourceAddress, NanoClock nanoClock, MediaDriver.Context context, CountersManager countersManager) Construct a newCongestionControlinstance for a received stream image using a static window algorithm. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intCalled byDriverConductorto initialise window length for a newPublicationImage.intCalled byDriverConductorlimit the window length for a newPublicationImage.voidonRttMeasurement(long nowNs, long rttNs, InetSocketAddress srcAddress) Called byReceiveron reception of an RTT Measurement.voidonRttMeasurementSent(long nowNs) Called byReceiverto record that a measurement request has been sent.longonTrackRebuild(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred) Called byDriverConductorupon execution ofPublicationImage.trackRebuild(long)to pass on current status.booleanshouldMeasureRtt(long nowNs) Polled byReceiverto determine when to initiate an RTT measurement to a Sender.
-
Field Details
-
CC_PARAM_VALUE
URI param value to identify thisCongestionControlstrategy.- See Also:
-
-
Constructor Details
-
StaticWindowCongestionControl
public StaticWindowCongestionControl(long registrationId, UdpChannel udpChannel, int streamId, int sessionId, int termLength, int senderMtuLength, InetSocketAddress controlAddress, InetSocketAddress sourceAddress, NanoClock nanoClock, MediaDriver.Context context, CountersManager countersManager) Construct a newCongestionControlinstance for a received stream image using a static window algorithm.- Parameters:
registrationId- for the publication image.udpChannel- for the publication image.streamId- for the publication image.sessionId- for the publication image.termLength- for the publication image.senderMtuLength- for the publication image.controlAddress- for the publication image.sourceAddress- for the publication image.nanoClock- for the precise timing.context- for configuration options applied in the driver.countersManager- for the driver.
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCongestionControl
-
shouldMeasureRtt
public boolean shouldMeasureRtt(long nowNs) Polled byReceiverto determine when to initiate an RTT measurement to a Sender.- Specified by:
shouldMeasureRttin interfaceCongestionControl- Parameters:
nowNs- in nanoseconds- Returns:
- true for should measure RTT now or false for no measurement
-
onRttMeasurementSent
public void onRttMeasurementSent(long nowNs) Called byReceiverto record that a measurement request has been sent.- Specified by:
onRttMeasurementSentin interfaceCongestionControl- Parameters:
nowNs- in nanoseconds.
-
onRttMeasurement
Called byReceiveron reception of an RTT Measurement.- Specified by:
onRttMeasurementin interfaceCongestionControl- Parameters:
nowNs- in nanosecondsrttNs- to the Sender in nanosecondssrcAddress- of the Sender
-
onTrackRebuild
public long onTrackRebuild(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred) Called byDriverConductorupon execution ofPublicationImage.trackRebuild(long)to pass on current status.The return value must be packed using
CongestionControl.packOutcome(int, boolean).- Specified by:
onTrackRebuildin interfaceCongestionControl- Parameters:
nowNs- current timenewConsumptionPosition- of the subscriberslastSmPosition- of the imagehwmPosition- of the imagestartingRebuildPosition- of the rebuildendingRebuildPosition- of the rebuildlossOccurred- during rebuild- Returns:
- outcome of congestion control calculation containing window length and whether to force sending an SM.
-
initialWindowLength
public int initialWindowLength()Called byDriverConductorto initialise window length for a newPublicationImage.- Specified by:
initialWindowLengthin interfaceCongestionControl- Returns:
- initial window length for flow and congestion control.
-
maxWindowLength
public int maxWindowLength()Called byDriverConductorlimit the window length for a newPublicationImage.- Specified by:
maxWindowLengthin interfaceCongestionControl- Returns:
- maximum window length for flow and congestion control.
-