# Enhanced Flow Control for Low Latency in QUIC
## 3 Proposed Scheme  
This section details the proposed fast autotuning allowance strategy. We first present the calculation of the buffer occupancy, based on which an increase factor is determined. At time \(t\), the buffer occupancy of a stream, \(B_{str}(t)\), is expressed as Equation (1). \(S_{upper}\) and \(S_{win}\) are the upper bound and the current maximum receive window of the stream, respectively. \[B_{str}(t)=\frac{S_{win}}{S_{upper}}\times 100 \tag{1}\]  
In the QUIC protocol, because a sender or a receiver can generate a stream if necessary, buffer occupancy calculations are required for both streams and connections. For a connection at time \(t\), the buffer occupancy of a connection, \(B_{con}(t)\), is calculated using Equation (2). \(\mathbb{C}_{upper}\) is the upper bound of the buffer for a connection. The increase factor is determined based on the buffer occupancy after a receive window update. \[B_{con}(t)=\frac{\sum S_{win}}{\mathbb{C}_{upper}}\times 100 \tag{2}\]  
The fast autotuning algorithm is described in Algorithm 1. By subtracting consumed bytes, \(C_{bytes}\), from maximum receive window offset, \(W_{maxoffset}\), the receiver calculates the available receive window, \(W_{avail}\). The receive window update is triggered if the available receive window is less than \(W_{max}/2\); the receiver then delivers the MAX_STREAM_DATA frame for a stream (or MAX_DATA frame for a connection). \(F_{inc}\), the increase factor, is determined based on the buffer occupancy, if \(T_{interval}\), the time since the last window update, is less than 2 RTT. The buffer occupancy is calculated using Equation (1) for the stream and Equation (2) for the connection. Because sufficient free buffer space is not available if the buffer occupancy is greater than 75%, the increase factor is set to 2. The increase factor is set to 4 if the buffer occupancy is between 50 and 75%, it is 8 if the occupancy is greater than 25% but less than 50%, and it is 16 if the free buffer space exceeds 75%. The maximum receive window is then determined by the smaller of (\(W_{max}*F_{inc}\)) and \(B_{upper}\), the upper bound of the buffer. The maximum offset of the receive window is increased by (\(W_{max}-W_{avail}\)), as depicted Figure 5. The fast autotuning seeks to reach the maximum receive window as quickly as possible. As a result, since the autotuning allowance doubles the maximum receive window, the increase factor in Algorithm 1 increases by the power of 2 based on the buffer occupancy. The autotuning, for example, requires two buffer updates to raise the maximum receive window by four times, but the fast autotuning only requires one. For example, a sender uses a QUIC connection with one stream to transfer data to a receiver. The upper bounds for the stream and the connection are 128 KB and 256 KB, respectively. The stream's and connection's initial maximum receive windows are 4 KB and 8 KB, respectively. Because the buffer occupancy is less than 25% of the stream upper bound when the first buffer update occurs, the increase factor is set to 16 and the maximum receive window is set to 64 KB. Because the buffer occupancy is 50%, the increase factor for the second buffer update is calculated to be 4. The maximum receive window, on the other hand, is set to 128 KB because the stream upper bound cannot be exceeded. We implemented three flow control algorithms: static, autotuning, and fast autotuning allowances. First, we analyzed the ns-3 simulator with QUIC [19], and then modified four classes: QuicL5 Protocol, QuicSocketBase, QuicStreamBase, and QuicStreamRxBuffer classes. For example, Algorithm 1 should determine the available amount of data for a stream or connection. We modified AvailableWindow function in the QuicSocketBase class to calculate the available amount of data by subtracting CalculateAllRecv() from the m_max_data variable.