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 String
URI param value to identify thisCongestionControl
strategy.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 newCongestionControl
instance for a received stream image using a static window algorithm. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
Called byDriverConductor
to initialise window length for a newPublicationImage
.int
Called byDriverConductor
limit the window length for a newPublicationImage
.void
onRttMeasurement
(long nowNs, long rttNs, InetSocketAddress srcAddress) Called byReceiver
on reception of an RTT Measurement.void
onRttMeasurementSent
(long nowNs) Called byReceiver
to record that a measurement request has been sent.long
onTrackRebuild
(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred) Called byDriverConductor
upon execution ofPublicationImage.trackRebuild(long)
to pass on current status.boolean
shouldMeasureRtt
(long nowNs) Polled byReceiver
to determine when to initiate an RTT measurement to a Sender.
-
Field Details
-
CC_PARAM_VALUE
URI param value to identify thisCongestionControl
strategy.- 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 newCongestionControl
instance 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCongestionControl
-
shouldMeasureRtt
public boolean shouldMeasureRtt(long nowNs) Polled byReceiver
to determine when to initiate an RTT measurement to a Sender.- Specified by:
shouldMeasureRtt
in interfaceCongestionControl
- Parameters:
nowNs
- in nanoseconds- Returns:
- true for should measure RTT now or false for no measurement
-
onRttMeasurementSent
public void onRttMeasurementSent(long nowNs) Called byReceiver
to record that a measurement request has been sent.- Specified by:
onRttMeasurementSent
in interfaceCongestionControl
- Parameters:
nowNs
- in nanoseconds.
-
onRttMeasurement
Called byReceiver
on reception of an RTT Measurement.- Specified by:
onRttMeasurement
in 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 byDriverConductor
upon execution ofPublicationImage.trackRebuild(long)
to pass on current status.The return value must be packed using
CongestionControl.packOutcome(int, boolean)
.- Specified by:
onTrackRebuild
in 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 byDriverConductor
to initialise window length for a newPublicationImage
.- Specified by:
initialWindowLength
in interfaceCongestionControl
- Returns:
- initial window length for flow and congestion control.
-
maxWindowLength
public int maxWindowLength()Called byDriverConductor
limit the window length for a newPublicationImage
.- Specified by:
maxWindowLength
in interfaceCongestionControl
- Returns:
- maximum window length for flow and congestion control.
-