Class StaticWindowCongestionControl

java.lang.Object
io.aeron.driver.StaticWindowCongestionControl
All Implemented Interfaces:
CongestionControl, AutoCloseable

public class StaticWindowCongestionControl extends Object implements CongestionControl
Congestion control algorithm which uses the min of MediaDriver.Context.initialWindowLength() or half a term length as a static window.
  • Field Details

  • 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 new CongestionControl 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 interface AutoCloseable
      Specified by:
      close in interface CongestionControl
    • shouldMeasureRtt

      public boolean shouldMeasureRtt(long nowNs)
      Polled by Receiver to determine when to initiate an RTT measurement to a Sender.
      Specified by:
      shouldMeasureRtt in interface CongestionControl
      Parameters:
      nowNs - in nanoseconds
      Returns:
      true for should measure RTT now or false for no measurement
    • onRttMeasurementSent

      public void onRttMeasurementSent(long nowNs)
      Called by Receiver to record that a measurement request has been sent.
      Specified by:
      onRttMeasurementSent in interface CongestionControl
      Parameters:
      nowNs - in nanoseconds.
    • onRttMeasurement

      public void onRttMeasurement(long nowNs, long rttNs, InetSocketAddress srcAddress)
      Called by Receiver on reception of an RTT Measurement.
      Specified by:
      onRttMeasurement in interface CongestionControl
      Parameters:
      nowNs - in nanoseconds
      rttNs - to the Sender in nanoseconds
      srcAddress - of the Sender
    • onTrackRebuild

      public long onTrackRebuild(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred)
      Called by DriverConductor upon execution of PublicationImage.trackRebuild(long) to pass on current status.

      The return value must be packed using CongestionControl.packOutcome(int, boolean).

      Specified by:
      onTrackRebuild in interface CongestionControl
      Parameters:
      nowNs - current time
      newConsumptionPosition - of the subscribers
      lastSmPosition - of the image
      hwmPosition - of the image
      startingRebuildPosition - of the rebuild
      endingRebuildPosition - of the rebuild
      lossOccurred - during rebuild
      Returns:
      outcome of congestion control calculation containing window length and whether to force sending an SM.
    • initialWindowLength

      public int initialWindowLength()
      Called by DriverConductor to initialise window length for a new PublicationImage.
      Specified by:
      initialWindowLength in interface CongestionControl
      Returns:
      initial window length for flow and congestion control.
    • maxWindowLength

      public int maxWindowLength()
      Called by DriverConductor limit the window length for a new PublicationImage.
      Specified by:
      maxWindowLength in interface CongestionControl
      Returns:
      maximum window length for flow and congestion control.