Jul 23, 2009

Bandwidth-Delay Product(BDP) 頻寬-延遲乘積

From Wikipedia, the free encyclopedia

In data communications, bandwidth-delay product refers to the product of a data link's capacity (in bits per second) and its end-to-end delay(in seconds). The result, an amount of data measured in bits (or bytes), is equivalent to the maximum amount of data on the network circuit at any given time, i.e. data that has been transmitted but not yet received. Sometimes it is calculated as the data link's capacity times its round trip time[1].

Obviously, the bandwidth-delay product is higher for faster circuits with long-delay links such as GEO satellite connections. The product is particularly important for protocols such as TCP that guarantee reliable delivery, as it describes the amount of yet-unacknowledged data that the sender has to duplicate in a buffer memory in case the client requires it to re-transmit a garbled or lost packet.[2]

A network with a large bandwidth-delay product is commonly known as a long fat network (shortened to LFN and often pronounced "elephant"). As defined in RFC 1072, a network is considered an LFN if its bandwidth-delay product is significantly larger than 105 bits (~12kB).

[edit]Examples

  • Customer on a DSL link, 1 Mbit/s, 200 ms one-way delay: 200 kbit = 25 kB
  • High-speed terrestrial network: 100 Mbit/s, 100 ms: 10 Mbit = 1.25 MB
  • Server on a long-distance 1 Gbit/s link, average one-way delay 300 ms = 300 Mbit = 37.5 MB total required for buffering

    TCP 的性能取決於幾個方面的因素。兩個最重要的因素是鏈接帶寬(link bandwidth)(報文在網絡上傳輸的速率)和 往返時間(round-trip time) 或 RTT(發送報文與接收到另一端的響應之間的延時)。這兩個值確定了稱為 Bandwidth Delay Product(BDP)的內容。

    給定鏈接帶寬和 RTT 之後,您就可以計算出 BDP 的值了,不過這代表什麼意義呢?BDP 給出了一種簡單的方法來計算理論上最優的 TCP socket 緩衝區大小(其中保存了排隊等待傳輸和等待應用程序接收的數據)。如果緩衝區太小,那麼 TCP 窗口就不能完全打開,這會對性能造成限制。如果緩衝區太大,那麼寶貴的內存資源就會造成浪費。如果您設置的緩衝區大小正好合適,那麼就可以完全利用可用的帶寬。

    下面我們來看一個例子:
      BDP = link_bandwidth * RTT
    如果應用程序是通過一個 100Mbps 的局域網進行通信,其 RRT 為 50 ms,那麼 BDP 就是:
      100MBps * 0.050 sec / 8 = 0.625MB = 625KB
    注意:此處除以 8 是將位轉換成通信使用的字節。因此,我們可以將 TCP 窗口設置為 BDP 或 1.25MB。但是在 Linux 2.6 上默認的 TCP 窗口大小是 110KB,這會將連接的帶寬限製為 2.2MBps,計算方法如下:
      throughput = window_size / RTT
      110KB / 0.050 = 2.2MBps
    如果使用上面計算的窗口大小,我們得到的帶寬就是 12.5MBps,計算方法如下:
      625KB / 0.050 = 12.5MBps
    差別的確很大,並且可以為 socket 提供更大的吞吐量。因此現在您就知道如何為您的 socket 計算最優的緩衝區大小了。
Post a Comment