Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
RTT – unethost無限空間虛擬主機 技術分享部落格

如何選購外國的虛擬主機?

一般而言,選購外國的虛擬主機,台灣人的首選,是以美國、日本為主。日本的話,由於日文還是比較不比英文普遍,大多數人還是先考慮美國。

我看了許多網站評比美國的虛擬主機,說了一堆服務幾分?有沒有送google adword?身為主機商的我,我覺得,這些都不是客戶要的。客戶要的東西,對客戶而言,最重要的東西:(1)線路品質 (2)價格。其它的什麼google adword?客服如何?機器的軟体是不是最新的?這些常常都不是客戶最在意的事。

讓我來解釋一下,什麼是線路品質的觀念吧:
我們用ping這個command去連遠端的主機的話,可以得到一個數字,叫做RTT。這個數字,對於傳輸有莫大的影響。怎麼說呢? 以unethost的美國西岸主機來講,RTT約是150ms多。雖然主機本身的頻寬是100Mbps,但是,對於單一的TCP連線,考慮TCP的slow start effect & congestion control效應之後,理論上的最高速是4.3Mbps 或是500 kbyte/sec。當然,現代的瀏覽器已經有做平行的連線,一般而言最多是十條。但是平行的連線是對多個小檔,可以加速,如果是一個單一的大檔,或是說一個PHP生成的動態頁面,就一定會被這個速度所限制。

這個RTT如何影響單一連線的最高速,其實是有計算公式的。大家要是記不住,概念上是RTT愈小,單一連線的最高速限愈大。詳細推導的流程是:TCP在傳輸的時候,電腦會對每一條TCP連線生成一個Slilding window(滑動窗戶)。這個window的大小,必須等於BDP = bandwidth delay product 。也就是說,這個滑動窗戶的大小 = 頻寬 乘上 RTT。由於一般來講,大部分的人用的電腦OS是windows,內建的TCP演算法也不是最新的,所以Slilding window size是固定的:64kbytes。這種時候,頻寬就可以由 ( Slilding window size/ RTT)來算出。

而上頭,本文所講的理論上限也就是這樣子算出來的。unethost的主機測速資料在這邊

參考資料可以看下方的英文。

Sometimes, we are feeling slow Internet connection, but don’t know how we can measure the speed and what is right speed, download speed, TCP throughput, I can expect. Measuring and calculating TCP throughput is not that hard. See below famous TCP throughput formula.

RCV buffer size / RTT = Max TCP throughput = ? bps
** Buffer size is normally 65Kbps

ex) (64Kbyte x 8bit) / 0.17 = 3011764 bps = 3Mbps, (RTT=170ms)

To learn more about Internet Speed Issue, please check our article series within www.ipBalance.com

RCV Buffer size / TCP receive window size

– RCV buffer size is denoted as TCP receive window size. Window systems have 64Kbyte of window size as default (Window NT and Millennium have 8Kbytes of window size).  The TCP/IP standard allows for a receive window up to 65,535 bytes in size, which is the maximum value that can be specified in the 16-bit TCP window size field. Why 65Kbytes? Well, more accurate expression will be  65,535 = (2^16)-1. To improve TCP throughput, speed, performance whatever you called, in high speed connection or high delay network, you can increase TCP window size(reference RFC 1323). However, if transport link is not stable, it might give you worse performance. Packet loss or bottleneck in the network is the most likelyfactors that are leading to the TCP throughput reductions.

Optimal TCP window size

– Optimal RCV buffer size is considered to be 2 x BDP, where BDP is the Bandwidth * Delay Product

ex) RTT is 20 ms, and connection speed is 10 Mbps.
2 x (10Mbps/8 * .020s) = 50Kbytes

Well, default window size 65kbytes is not adequate for today’s network. In these days, most of network is 100Mbps or higher.

Round Trip Time(RTT)

– If you are not using TCP window scaling option (RFC 1323), TCP window size will be used as 64Kbytes. If then, Round Trip Time(RTT) is the main factor to decide TCP throughput between locations. 

RTT 10 ms => TCP throughput = 52428000 bps = 52Mbps
RTT 20 ms => TCP throughput = 26214000 bps = 26Mbps
RTT 50 ms => TCP throughput = 10485600 bps = 10Mbps
RTT 100 ms => TCP throughput = 5242800 bps = 5.2Mbps
RTT 150 ms => TCP throughput = 3495200 bps = 4.3Mbps
RTT 200 ms => TCP throughput = 2621400 bps = 2.5Mbps
RTT 300 ms => TCP throughput = 1747600 bps = 1.7Mbps
RTT 500 ms => TCP throughput = 1048560 bps = 1Mbps

** Used maximum TCP window size  = 65Kbytes = 65535

You can see the deficiency with the greater RTT.