APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http.quic

public Class QuicPacer

extends Object
Class Inheritance
Imports
jdk.internal.net.http.common.Deadline, .Log, .Utils, jdk.internal.util.OperatingSystem, java.time.temporal.ChronoUnit, java.util.concurrent.TimeUnit

Implementation of pacing. When the connection is sending at a rate lower than permitted by the congestion controller, pacer is responsible for spreading out the outgoing packets across the entire RTT. Technically the pacer provides two functions: - computes the number of packets that can be sent now - computes the time when another packet can be sent When a new flow starts, or when the flow is not pacer-limited, the pacer limits the window to: max(INITIAL_WINDOW, pacingRate / timerFreq) timerFreq is the best timer resolution we can get from the selector. pacingRate is N * congestionWindow / smoothedRTT where N = 2 when in slow start, N = 1.25 otherwise. After that, the window refills at pacingRate, up to two timer periods or 4 packets, whichever is higher. The time when another packet can be sent is computed as the time when the window will allow at least 2 packets. All methods are externally synchronized in congestion controller. Ideas taken from: https://www.rfc-editor.org/rfc/rfc9002.html#name-pacing https://www.ietf.org/archive/id/draft-welzl-iccrg-pacing-03.html

Field Summary

Modifier and TypeField and Description
private boolean
private final QuicCongestionController
private static final long
private Deadline
private long
private final QuicRttEstimator
private static final long

Constructor Summary

AccessConstructor and Description
public
QuicPacer(QuicRttEstimator
the RTT estimator
rttEstimator
,
QuicCongestionController
the congestion controller
congestionController
)

Create a QUIC pacer for the given RTT estimator and congestion controller

Method Summary

Modifier and TypeMethod and Description
public void
appLimited()

called to indicate that the flow is app-limited.

public boolean

Returns:

true if pacer quota not hit yet, false otherwise
canSend
()

Returns true if pacer quota not hit yet, false otherwise.

public void
packetSent(int
packet size in bytes
packetBytes
)

called to indicate that a packet was sent

public Deadline

Returns:

the deadline when quota will increase to two packets
twoPacketDeadline
()

Returns the deadline when quota will increase to two packets.

public void
updateQuota(Deadline
current time
now
)

Update quota based on time since the last call to this method and whether appLimited() was called or not.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

appLimitedback to summary
private boolean appLimited
congestionControllerback to summary
private final QuicCongestionController congestionController
DEFAULT_TIMER_FREQ_HZback to summary
private static final long DEFAULT_TIMER_FREQ_HZ
lastUpdateback to summary
private Deadline lastUpdate
quotaback to summary
private long quota
rttEstimatorback to summary
private final QuicRttEstimator rttEstimator
TIMER_FREQ_HZback to summary
private static final long TIMER_FREQ_HZ

Constructor Detail

QuicPacerback to summary
public QuicPacer(QuicRttEstimator rttEstimator, QuicCongestionController congestionController)

Create a QUIC pacer for the given RTT estimator and congestion controller

Parameters
rttEstimator:QuicRttEstimator

the RTT estimator

congestionController:QuicCongestionController

the congestion controller

Method Detail

appLimitedback to summary
public void appLimited()

called to indicate that the flow is app-limited. Alters the behavior of the following updateQuota call.

canSendback to summary
public boolean canSend()

Returns true if pacer quota not hit yet, false otherwise.

Returns:boolean

true if pacer quota not hit yet, false otherwise

packetSentback to summary
public void packetSent(int packetBytes)

called to indicate that a packet was sent

Parameters
packetBytes:int

packet size in bytes

twoPacketDeadlineback to summary
public Deadline twoPacketDeadline()

Returns the deadline when quota will increase to two packets.

Returns:Deadline

the deadline when quota will increase to two packets

updateQuotaback to summary
public void updateQuota(Deadline now)

Update quota based on time since the last call to this method and whether appLimited() was called or not.

Parameters
now:Deadline

current time