{"id":1864,"date":"2013-10-14T20:01:49","date_gmt":"2013-10-14T19:01:49","guid":{"rendered":"http:\/\/mccltd.net\/blog\/?p=1864"},"modified":"2013-10-14T20:03:54","modified_gmt":"2013-10-14T19:03:54","slug":"long-fat-pipes-tcp-wscale-tcp-sack-and-time-stamp-options","status":"publish","type":"post","link":"http:\/\/darenmatthews.com\/blog\/?p=1864","title":{"rendered":"Long Fat Pipes: TCP WSCALE, TCP SACK and Time Stamp Options"},"content":{"rendered":"<p><strong>Long Fat Pipes<\/strong><br \/>\nHigh-capacity packet satellite channels are LFN&#8217;s\u00a0 (Delay 4 x 35\u2018800 km = 470ms RTT) and modern terrestrial long-haul fibre-optic paths will also fall into the LFN class. There are three fundamental performance problems with the current TCP\u00a0 over LFNs:<\/p>\n<p>\u2022 Window Size Limit (2^16 or max 65k bytes) &#8211; Remedy: TCP option &#8220;Window scale&#8221;<br \/>\n\u2022 Recovery from Segment Losses &#8211; Remedy: TCP option &#8220;selective acknowledgement&#8221;<br \/>\n\u2022 Round-Trip Measurement &#8211; Remedy: TCP option &#8220;Time stamp&#8221;<!--more--><br \/>\nWith today&#8217;s high-BDP transmission paths, the originally designed TCP window size, even at its maximum value, becomes a throughput bottleneck. The size of the Window field in the TCP header is 16 bits, allowing a TCP peer to advertise a maximum receive window size of 65,536 bytes.<\/p>\n<p><span style=\"text-decoration: underline;\">Calculating Throughput<\/span>:<br \/>\nYou can calculate the approximate throughput for a given TCP window size from the following formula: <strong>Throughput = TCP maximum receive windowsize \/ RTT<\/strong><br \/>\nFor example, with a 65,536 byte receive window you can only achieve an approximate throughput of 5.24 megabits per second (Mbps) on a path with a 100ms RTT, regardless of the transmission path&#8217;s actual bandwidth.<\/p>\n<p><strong>WINDOW SCALING<\/strong> (mitigate window size limitation)<br \/>\n<span style=\"text-decoration: underline;\">Formula to determine the scaled window:<\/span><br \/>\nScaled Window Size = Window Bytes x 2S\u00a0 (where &#8220;S&#8221; is Scaling Factor)<\/p>\n<p>TCP Window Size of 65\u2018535 Bytes is too small.<br \/>\n\u2022 A multiplier Scaling Factor resolves this limitation.<br \/>\n\u2022 Scaling Factor S is negotiated at TCP setup.<br \/>\n\u2022 Each end can offer an individual Scaling Factor.<br \/>\n\u2022 The value for the Scaling Factors can vary from 0 to14.<br \/>\n\u2022 Calculation for the scaled Window Size is as follows: Scaled Window Size = Window Bytes x 2^S<br \/>\n\u2022 Example: Window Size 46 Bytes (Scaling Factor S=7) would be scaled as 2^7 = 128. So 46 Bytes x 128 = 5\u2019888 Bytes<br \/>\n\u2022 The maximum Window Size can be 1\u2019073\u2019741\u2019824 Bytes = 1 Gigabyte<\/p>\n<p><strong>SECLECTIVE ACKNOWLEDGEMENTS<\/strong> (improve recovery from segment losses)<br \/>\nThe usage of the TCP SACK option is negotiated during the 3-way handshake.<br \/>\n\u2022 The SACK option can be activated from one or both sides.<br \/>\n\u2022 Without SACK option, only the last received segment of a contiguous series can be acknowledged.<br \/>\n\u2022 The SACK Option allows to acknowledge non-contiguous segments of a series and can request for specific segments.<br \/>\n\u2022 The SACK Option can improve the throughput of LFN\u2019s significantly<\/p>\n<p><strong>TIME STAMP<\/strong><br \/>\nTCP timestamps help TCP to determine in which order packets were sent. TCP timestamps are not normally aligned to the system clock and start at some random value. Many operating systems will increment the timestamp for every elapsed millisecond; however the RFC only states that the ticks should be proportional.<\/p>\n<p>There are two timestamp fields:<\/p>\n<ul>\n<li>a 4-byte sender timestamp value (my timestamp)<\/li>\n<li>a 4-byte echo reply timestamp value (the most recent timestamp received from you).<\/li>\n<\/ul>\n<p>TCP timestamps are used in an algorithm known as Protection Against Wrapped Sequence numbers, or PAWS (see RFC 1323 for details). PAWS is used when the TCP window size exceeds the possible numbers of sequence numbers (232). In the case where a packet was potentially retransmitted it answers the question: &#8220;Is this sequence number in the first 4 GB or the second?&#8221; And the timestamp is used to break the tie.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Long Fat Pipes High-capacity packet satellite channels are LFN&#8217;s\u00a0 (Delay 4 x 35\u2018800 km = 470ms RTT) and modern terrestrial long-haul fibre-optic paths will also fall into the LFN class. There are three fundamental performance problems with the current TCP\u00a0 over LFNs: \u2022 Window Size Limit (2^16 or max 65k bytes) &#8211; Remedy: TCP option [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[68,47,37],"_links":{"self":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1864"}],"collection":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1864"}],"version-history":[{"count":3,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1864\/revisions"}],"predecessor-version":[{"id":1866,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1864\/revisions\/1866"}],"wp:attachment":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1864"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}