Class BufferingFlowControlStrategy
- All Implemented Interfaces:
FlowControlStrategy,org.eclipse.jetty.util.component.Dumpable
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.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.http2.FlowControlStrategy
FlowControlStrategy.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatprivate final AtomicIntegerprivate final AtomicIntegerprivate final Map<IStream, AtomicInteger> Fields inherited from class org.eclipse.jetty.http2.AbstractFlowControlStrategy
LOGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEYFields inherited from interface org.eclipse.jetty.http2.FlowControlStrategy
DEFAULT_WINDOW_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionBufferingFlowControlStrategy(float bufferRatio) BufferingFlowControlStrategy(int initialStreamSendWindow, float bufferRatio) -
Method Summary
Modifier and TypeMethodDescriptionfloatvoidonDataConsumed(ISession session, IStream stream, int length) voidonStreamCreated(IStream stream) voidonStreamDestroyed(IStream stream) protected voidsendWindowUpdate(IStream stream, ISession session, WindowUpdateFrame frame) voidsetBufferRatio(float bufferRatio) toString()voidwindowUpdate(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, updateInitialStreamWindowMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelf
-
Field Details
-
maxSessionRecvWindow
-
sessionLevel
-
streamLevels
-
bufferRatio
private float bufferRatio
-
-
Constructor Details
-
BufferingFlowControlStrategy
public BufferingFlowControlStrategy(float bufferRatio) -
BufferingFlowControlStrategy
public BufferingFlowControlStrategy(int initialStreamSendWindow, float bufferRatio)
-
-
Method Details
-
getBufferRatio
@ManagedAttribute("The ratio between the receive buffer and the consume buffer") public float getBufferRatio() -
setBufferRatio
public void setBufferRatio(float bufferRatio) -
onStreamCreated
- Specified by:
onStreamCreatedin interfaceFlowControlStrategy- Overrides:
onStreamCreatedin classAbstractFlowControlStrategy
-
onStreamDestroyed
- Specified by:
onStreamDestroyedin interfaceFlowControlStrategy- Overrides:
onStreamDestroyedin classAbstractFlowControlStrategy
-
onDataConsumed
-
sendWindowUpdate
-
windowUpdate
- Specified by:
windowUpdatein interfaceFlowControlStrategy- Overrides:
windowUpdatein classAbstractFlowControlStrategy
-
toString
-