westwood拥塞控制仿真

本文深入解析了西木TCP拥塞控制算法的工作原理,包括其拥塞窗口调整规则、带宽估计逻辑及在ns3平台上的实现细节。通过对比不同场景下西木与其他协议的性能表现,揭示了西木算法在不同网络条件下的优势。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 The congestion window adjust rule of westwood is[1]:
w ← { w + 1 w When an ack is received w − ( w − B ⋅ r t t m i n ) When packet loss happens (1) w \leftarrow\begin{cases} w+\frac{1}{w} & \text{When an ack is received} \\ w-(w-B\cdot rtt_{min})& \text{When packet loss happens} \end{cases}\tag{1} w{w+w1w(wBrttmin)When an ack is receivedWhen packet loss happens(1)
 The expected increment of the congestion window cwnd per update step is then:
Δ w = 1 − p w − ( w − B ⋅ r t t m i n ) ⋅ p (2) \Delta w=\frac{1-p}{w}-(w-B\cdot rtt_{min})\cdot p \tag{2} Δw=w1p(wBrttmin)p(2)
 The time between update steps is Δ t = r t t w \Delta t=\frac{rtt}{w} Δt=wrtt.
 Accoding to [2], the diffential equation of TCP throughput ( x = w r t t x=\frac{w}{rtt} x=rttw) is :
x ˙ = x r t t { I ⋅ ( 1 − p ) − D ⋅ p } \dot x=\frac{x}{rtt}\{I\cdot(1-p)-D\cdot p\} x˙=rttx{I(1p)Dp}
 For westwood, I = 1 w I=\frac{1}{w} I=w1, D = w − B ⋅ r t t m i n D=w-B\cdot rtt_{min} D=wBrttmin.
x ˙ = 1 − p r t t 2 + p ⋅ x ⋅ B ⋅ r t t m i n r t t − p ⋅ x 2 (3) \dot x=\frac{1-p}{rtt^2}+p\cdot x\cdot\frac{B\cdot rtt_{min}}{rtt}-p\cdot x^2 \tag{3} x˙=rtt21p+pxrttBrttminpx2(3)
  Let x ˙ = 0 \dot x=0 x˙=0, x w e s t w o o d = B ⋅ r t t m i n 2 ⋅ r t t + ( B ⋅ r t t m i n 2 ⋅ r t t ) 2 + 1 − p p ⋅ r t t 2 x^{westwood}=\frac{B\cdot rtt_{min}}{2\cdot rtt}+\sqrt{(\frac{B\cdot rtt_{min}}{2\cdot rtt})^2+\frac{1-p}{p\cdot rtt^2}} xwestwood=2rttBrttmin+(2rttBrttmin)2+prtt21p .
  By assuming B ≈ x B\approx x Bx, with equation (3), we could:
x = 1 r t t × ( r t t − r t m i n ) × 1 − p p x=\frac{1}{\sqrt{rtt\times(rtt-rt_{min})}}\times\sqrt{\frac{1-p}{p}} x=rtt×(rttrtmin) 1×p1p
 The performance of westwood is tested on ns3 platform. But the implementation of westwood [3] in ns3 has some bug. The logic to estimate bandwidth for each received ack is not right,since the current implmentation will get m _ a c k e d S e g m e n t s r t t \frac{m\_ackedSegments}{rtt} rttm_ackedSegments.
Some interval is needed to trigger bandwidth estimation. It is easy to correct such error, please refer to the code in linux [4].

void
TcpWestwood::PktsAcked (Ptr<TcpSocketState> tcb, uint32_t packetsAcked,
                        const Time& rtt)
{
  NS_LOG_FUNCTION (this << tcb << packetsAcked << rtt);

  if (rtt.IsZero ())
    {
      NS_LOG_WARN ("RTT measured is zero!");
      return;
    }

  m_ackedSegments += packetsAcked;

  if (m_pType == TcpWestwood::WESTWOOD)
    {
      EstimateBW (rtt, tcb);
    }
  else if (m_pType == TcpWestwood::WESTWOODPLUS)
    {
      if (!(rtt.IsZero () || m_IsCount))
        {
          m_IsCount = true;
          m_bwEstimateEvent.Cancel ();
          m_bwEstimateEvent = Simulator::Schedule (rtt, &TcpWestwood::EstimateBW,
                                                   this, rtt, tcb);
        }
    }
}

void
TcpWestwood::EstimateBW (const Time &rtt, Ptr<TcpSocketState> tcb)
{
  NS_LOG_FUNCTION (this);

  NS_ASSERT (!rtt.IsZero ());

  m_currentBW = m_ackedSegments * tcb->m_segmentSize / rtt.GetSeconds ();

  if (m_pType == TcpWestwood::WESTWOODPLUS)
    {
      m_IsCount = false;
    }

  m_ackedSegments = 0;
  NS_LOG_LOGIC ("Estimated BW: " << m_currentBW);

  // Filter the BW sample

  double alpha = 0.9;

  if (m_fType == TcpWestwood::NONE)
    {
    }
  else if (m_fType == TcpWestwood::TUSTIN)
    {
      double sample_bwe = m_currentBW;
      m_currentBW = (alpha * m_lastBW) + ((1 - alpha) * ((sample_bwe + m_lastSampleBW) / 2));
      m_lastSampleBW = sample_bwe;
      m_lastBW = m_currentBW;
    }

  NS_LOG_LOGIC ("Estimated BW after filtering: " << m_currentBW);
}

 And I implement my own version on ns3, the code is public available [4].
 A point to point channel (3Mbps, 100ms one way delay, 300ms queue delay) is built. Three flows are involved in experiment.

When all flows takes westwood for rate control

 All flows enter the netowork at the same time.
 sending rate dynamic:
在这里插入图片描述
 Received rate dynamic (calculated every 5 seconds):
在这里插入图片描述
  One way transmission delay:
在这里插入图片描述
 All flows enter the netowork at different time.
 Received rate dynamic:
在这里插入图片描述

Sharing link with other protocols

 When flow1 takes westwood for rate control while flow2 and flow3 take reno as rate control.
 Received rate dynamic:
在这里插入图片描述
 Due to the fat buffer in link, Reno flow gain higher throughput.
 Another test, flow3 take cubic as rate control.
 Received rate dynamic:
在这里插入图片描述
 Reduce the link buffer to be 3Mbps*200ms. flow3 take cubic as rate control.
 Received rate dynamic:
在这里插入图片描述
[1] Mathematical analysis of Westwood+ TCP congestion control
[2] AIMD吞吐量公式的推导
[3] westwood in ns3
[4] westwood in linux
[5] 更加精确的TCP Westwood拥塞控制算法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值