BBR背景
bbr三大参数
- pacing rate:TCP发送方发送数据的速率
- send quantum:指允许传输发送方通过网络传输的包含聚合数据的数据包的最大大小。这种聚合有助于减少包包传输开销。
- cwnd:TCP发送方对飞行中最大未确认数据量的限制
bbr思想:
BBR旨在达到两种平衡:速率平衡:瓶颈处的数据包到达率等于瓶颈带宽
pipe full:总飞行数据等于带宽延迟积BDP
linux中有关BBR实现细节:
- void (*cong_control)(struct sock *sk, const struct rate_sample *rs):收到ack时调用,用于更新网络模型,控制参数,同时负责BBR状态转换
- void (*set_state)(struct sock *sk, u8 new_state):状态转换函数;bbr在状态转换时保存cwnd的值
- void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev):当cwnd事件发生时(例如,当延迟的ack被发送时),将调用此函数。BBR在没有数据飞行时,使用此方法更新第一次数据包传输时的起搏速率。
- u32 (*ssthresh)(struct sock *sk):此函数在需要时更新ssthresh的值并返回其值。在BBR中,它保存当前的cwnd并返回最大的整数值。BBR不使用ssthresh的值 因此,永远不要减少它。
-
bbr的pacing由下层FQ调度队列提供,或者由传输层的pacing提供。bbr的交付速率估计通过cong_control功能提供。
在ns3中实现BBR
在ns3中实现bbr需要4个关键点,pacing,cong_control,windowed min-max filter,delivery rate estimation
实现细节
- bool HasCongControl ( ) const: This method returns true if congestion control is using CongControl ( ) instead of IncreaseWindow ( ).
- void CongControl (Ptr tcb,const struct RateSample * rs): This method is similar to the cong_control method of Linux and is used to update the cwnd and pacing rate based on the estimation of delivery rate.
- pacing: BBR uses pacing to control the rate of sending data into the network. An attribute called “Pacing"has been added to the TcpSocketState
- Delivery rate estimation [4]: BBR uses this algorithm to measure the approximate value of the delivery rate of in-flight data. This involves changes at sender side by maintaining per-packet information. Taking [4] as reference, we implemented rate estimation algorithm in TcpTxBuffer class of ns-3.
- Windowed min-max filter: Another challenge faced during the implementation of BBR is that ns-3 does not have support for the windowed-min-max filter. We found that Linux’s and QUIC’s chromium implementation use Kathleen Nichols’ algorithm to track windowed minimum-maximum values.We used the chromium implementation of windowed filter that uses C++ and made it compatible to work with ns-3.
bbr有关cwnd的三个函数
- CongestionSetState
- CwndEvent
- void AdvanceCyclePhase ( ): This method implements the functionality of gain cycling with randomization algorithm which is required during the ProbeBW state.
bbr将cwnd_gain设为2是为了缓解聚合延迟ack的情况