@ManagedObject public class BufferingFlowControlStrategy extends AbstractFlowControlStrategy
A flow control strategy that accumulates updates and emits window control frames when the accumulated value reaches a threshold.
The sender flow control window is represented in the receiver as two buckets: a bigger bucket, initially full, that is drained when data is received, and a smaller bucket, initially empty, that is filled when data is consumed. Only the smaller bucket can refill the bigger bucket.
The smaller bucket is defined as a fraction of the bigger bucket.
For a more visual representation, see the rocking bamboo fountain, where the bamboo is the smaller bucket and the pool is the bigger bucket.
The algorithm works in this way.
The initial bigger bucket (BB) capacity is 100, and let's imagine the smaller bucket (SB) being 40% of the bigger bucket: 40.
The receiver receives a data frame of 60, so now BB=40; the data frame is passed to the application that consumes 25, so now SB=25. Since SB is not full, no window control frames are emitted.
The application consumes other 20, so now SB=45. Since SB is full, its 45 are transferred to BB, which is now BB=85, and a window control frame is sent with delta=45.
The application consumes the remaining 15, so now SB=15, and no window control frame is emitted.
bufferRatiocontrols how often the window control frame is emitted.
bufferRatio=0.0means that a window control frame is emitted every time the application consumes a data frame. This may result in too many window control frames be emitted, but may allow the sender to avoid stalling.
bufferRatio=1.0means that a window control frame is emitted only when the application has consumed a whole window. This minimizes the number of window control frames emitted, but may cause the sender to stall, waiting for the window control frame.
The default value is
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
onDataConsumed(ISession session, IStream stream, int length)
sendWindowUpdate(IStream stream, ISession session, WindowUpdateFrame frame)
windowUpdate(ISession session, IStream stream, WindowUpdateFrame frame)
Methods inherited from class org.eclipse.jetty.http2.AbstractFlowControlStrategy
dump, dump, getInitialStreamRecvWindow, getInitialStreamSendWindow, getSessionStallTime, getStreamsStallTime, onDataReceived, onDataSending, onDataSent, onSessionStalled, onSessionUnstalled, onStreamStalled, onStreamUnstalled, onWindowUpdate, reset, updateInitialStreamWindow
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
@ManagedAttribute("The ratio between the receive buffer and the consume buffer") public float getBufferRatio()
public void setBufferRatio(float bufferRatio)
public void onStreamCreated(IStream stream)
public void onStreamDestroyed(IStream stream)
protected void sendWindowUpdate(IStream stream, ISession session, WindowUpdateFrame frame)
public void windowUpdate(ISession session, IStream stream, WindowUpdateFrame frame)
public java.lang.String toString()