StreamByteDistributor that is sensitive to stream priority and uses
Weighted Fair Queueing approach for distributing
bytes.
Inspiration for this distributor was taken from Linux's Completely Fair Scheduler to model the distribution of bytes to simulate an "ideal multi-tasking CPU", but in this case we are simulating an "ideal multi-tasking NIC".
Each write operation will use the allocationQuantum(int) to know how many more bytes should be allocated
relative to the next stream which wants to write. This is to balance fairness while also considering goodput.
| Modifier and Type | Class and Description |
|---|---|
| private static class | WeightedFairQueueByteDistributor.ParentChangedEvent
Allows a correlation to be made between a stream and its old parent before a parent change occurs. |
| private class | WeightedFairQueueByteDistributor.State
The remote flow control state for a single stream. |
| private static class | WeightedFairQueueByteDistributor.StateOnlyComparator
A comparator for |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private int | allocationQuantum
The minimum number of bytes that we will attempt to allocate to a stream. |
| private final Http2Connection | |
| private final WeightedFairQueueByteDistributor. | |
| private static final int | DEFAULT_MAX_STATE_ONLY_SIZE
FireFox currently uses 5 streams to establish QoS classes. |
| pack-priv static final int | INITIAL_CHILDREN_MAP_SIZE
The initial size of the children map is chosen to be conservative on initial memory allocations under the assumption that most streams will have a small number of children. |
| private final int | |
| private final Http2Connection. | |
| private final IntObjectMap | stateOnlyMap
If there is no Http2Stream object, but we still persist priority information then this is where the state will reside. |
| private final PriorityQueue | stateOnlyRemovalQueue
This queue will hold streams that are not active and provides the capability to retain priority for streams which
have no |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | allocationQuantum(int
the amount of bytes that will be allocated to each stream. Must be > 0. allocationQuantum)Sets the amount of bytes that will be allocated to each stream. |
| public boolean | distribute(int
the maximum number of bytes to write. maxBytes, StreamByteDistributor.Implements io. maxBytes to those streams containing streamable bytes and
iterates across those streams to write the appropriate bytes.
|
| private int | distribute(int maxBytes, StreamByteDistributor.
|
| private int | distributeToChildren(int maxBytes, StreamByteDistributor.
It is a pre-condition that |
| pack-priv boolean | |
| pack-priv void | notifyParentChanged(List<WeightedFairQueueByteDistributor.
The events (top down order) which have changed eventsNotify all listeners of the priority tree change events (in ascending order) |
| pack-priv int | |
| private WeightedFairQueueByteDistributor. | |
| private WeightedFairQueueByteDistributor. | |
| public void | updateDependencyTree(int
The stream identifier associated with the child stream. childStreamId, int The stream identifier associated with the parent stream. May be parentStreamId, short 0,
to make childStreamId and immediate child of the connection.The weight which is used relative to other child streams for weight, boolean parentStreamId. This value
must be between 1 and 256 (inclusive).If exclusive)childStreamId should be the exclusive dependency of parentStreamId.Implements io. |
| public void | updateStreamableBytes(StreamByteDistributor.
Implements io. |