<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>mysite blog</title>
		<link>http://www.daemonsolutions.com/blog/</link>
		<atom:link href="http://www.daemonsolutions.com/blog/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title>Mobile Internet: TCP networking considerations</title>
			<link>http://www.daemonsolutions.com/mobile-internet-tcp-networking-considerations/</link>
			<description>&lt;p&gt;After several false sunrises the era of the mobile internet appears to be finally upon us. With large coverage in the press, the rise of the iPhone with Apple App store &amp;amp; Google Android with Android Market, increased talk with clients and important conferences, such as Velocity, planning talks on the subject it seemed an appropriate time to examine the considerations that need to be taken, with respects to the mobile internet, in terms of performance.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;This post is going to take a brief look at the networking considerations of using the TCP protocol over mobile networks, in particular 2.5G &amp;amp; 3G technologies that are used in the UK.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;1. UK Mobile Technologies&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;2.5G&amp;nbsp;&amp;nbsp;&amp;nbsp;GPRS&lt;br /&gt;3G&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;W-CMDA&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;2. Latency&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Typical Round Trip Times (RTTs - Latency)&lt;/strong&gt;&lt;br /&gt;2.5G   &amp;nbsp;&amp;nbsp;&amp;nbsp;300-1000 milliseconds &lt;br /&gt;3G&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;300-1000 milliseconds &lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;Mobile connections, as well as having large initial latency considerations, are susceptible to sudden increases in latency during the lifetime of a connection.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;Things that can cause sudden increases in latency in data transmission, delay spikes, exceeding the typical RTTs for such data transmission are:&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;1. Temporary degradation of mobile network signal (going through a tunnel, riding in a lift).&lt;br /&gt;2. The handover process when moving between network cells of the same technology (3G - 3G).&lt;br /&gt;3. The handover process when moving between network cells of differing technologies (3G - 2.5G).&lt;br /&gt;4. Internal rerouting of packets by the network to ensure seamless mobility when moving between network cells.&lt;br /&gt;5. Blocking on the mobile network by high-priority traffic. Data traffic for browsing is not considered high-priority.&lt;br /&gt;6. The network scheduler suspending low-priority data traffic in deference to high-priority users.&lt;br /&gt; &lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;These delay spikes can cause unexpected TCP timeouts, reduced throughput by causing the TCP congestion window size to be decreased and unnecessary retransmission of data.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;3. Bandwidth&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Bandwidth Delay Product (BDP - inflight data that has not been acknowledged)&lt;/strong&gt;&lt;br /&gt;1-5KB&amp;nbsp;&amp;nbsp;&amp;nbsp;GPRS&lt;br /&gt;8-50KB&amp;nbsp;&amp;nbsp;&amp;nbsp;W-CDMA&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;Due to the differing BDPs the 2.5G &amp;amp; 3G technologies fall into 2 different categorisation of networks: GPRS (2.5G) can be considered a long thin network (LTN); W-CDMA (3G) can be considered a long fat network (LFN) similar to internet connections delivered by satellite.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;TCP window size is important for bandwidth in both LFNs and LTNs but for differing reasons:&lt;br /&gt;1. LFNs require a large TCP window size to utilise the available bandwidth.&lt;br /&gt;2. LTNs require a TCP window size that is big enough to hold at least 4 segments for efficient loss recovery. &lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;With respects to efficient loss recovery, the use of selective acknowledgements (SACK) with the TCP connection means that the TCP window size must be scoped bigger than the size necessary for just efficient bandwidth utilisation to include the overhead for SACK.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;The bandwidth for a mobile connection is considered to be dynamic due to other connections on the mobile network and the fact that it is by nature mobile.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;Things that affect mobile connection bandwidth:&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;1. Arriving and departing connections to the mobile network cell decrease and increase the available bandwidth of the cell respectively.&lt;br /&gt;2. Distance from the mobile network cell base station affects the link quality with increasing distance decreasing the amount of bandwidth.&lt;br /&gt;3. Moving between network cells.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;i. Going from Low bandwidth cell - HIgh bandwidth cell the TCP congestion control mechanism can cause under-utilisation of available bandwidth due to slow ramp up.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ii. Going from High bandwidth cell - Low bandwidth cell if the TCP window size has been set to a large size congestion can occur resulting in overbuffering.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;The network scheduler plays a very important part in determining the amount of bandwidth available to a mobile connection. There is a limited amount of radio frequency (RF) spectrum available to a network that has to be shared out to dynamic numbers of concurrent connections. To handle this sharing out of resource the network scheduler allocates and deallocates resource (bandwidth) to the individual connections on a periodic basis. This allocation/deallocation process is termed bandwidth oscillation. The achievable throughput for a mobile TCP connection (assuming that TCP parameters for the connection are fixed) is determined by the frequency of the network bandwidth oscillation. At a high frequency of the bandwidth oscillation there is no throughput degradation. A slower frequencies bandwidth oscillation can be the single most important factor in limiting the throughput of the mobile connection.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;4. TCP options that can help improve performance&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;1. &lt;strong&gt;Max TCP Window Size:&lt;/strong&gt; set to be greater than the BDP. Not so much an issue for 2.5G networks. More of an issue for 3G networks as the receivers (eg. phones) most probably have a setting of 16-32KB for the TCP Window. Setting this to 64 KB would be best for 3G networks. Requires sender and receiver TCP stack support.&lt;br /&gt;2. &lt;strong&gt;Initial TCP Window Size:&lt;/strong&gt; Set this to be 4 times the maximum segment size (MSS), with a maximum size of 4KB. This is a good setting for frequent small data transfers. Does not impact large data transfers. Requires sender TCP stack support.&lt;br /&gt;3. &lt;strong&gt;Enable Limited Transmit:&lt;/strong&gt; This cuts down on data retransmission. Applicable to both 2.5G and 3G connections. Requires sender TCP stack support.&lt;br /&gt;4. &lt;strong&gt;MTU size:&lt;/strong&gt; With 3G connections setting a larger MTU allows for the TCP congestion window to be increased at a faster rate. Not as applicable for 2.5G connections.&lt;br /&gt;5. &lt;strong&gt;Enable Path MTU Discovery&lt;/strong&gt;. This allows the sender to determine what the maximum MTU can be. Applicable to both 2.5G and 3G connections. Requires sender and mobile network provider TCP stack support.&lt;br /&gt;6. &lt;strong&gt;Enable SACK:&lt;/strong&gt; This allows for efficient loss recovery in the case of packet loss. Applicable to both 2.5G and 3G connections. Requires sender and receiver TCP stack support.&lt;br /&gt;7. &lt;strong&gt;Enable ECN&lt;/strong&gt; &lt;em&gt;(should SACK not be available)&lt;/em&gt;: This allows for efficient loss recovery in the case of packet loss. Requires sender, receiver &amp;amp; mobile network provider TCP stack support.&lt;br /&gt;8. &lt;strong&gt;Enable TCP Timestamps:&lt;/strong&gt; Allows for better estimation of RTTs and therefore less timeouts due to better timeout settings. Applicable to 2.5G &amp;amp; 3G. Requires sender and receiver TCP stack support.&lt;br /&gt;9. &lt;strong&gt;Disable TCP header compression:&lt;/strong&gt; In environments with potentially high packet loss this mechanism prevents efficient loss recovery. This has to be done at the wireless host (mobile network provider) level unfortunately.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;5. Discussion&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;To provide an optimised TCP experience for a mobile end user looks to be a tricky affair. There are a number of factors that need to be taken into consideration in for each connection. These include, in no particular order:&lt;br /&gt;1. TCP feature set of receiver&lt;br /&gt;2. TCP feature set of mobile network provider&lt;br /&gt;3. TCP feature set of sender&lt;br /&gt;4. Mobile technology of initial connection (2.5G or 3G)&lt;br /&gt;5. Bandwidth oscillation frequency of the mobile network provider network scheduler&lt;br /&gt;6. Current load of mobile network cell.&lt;br /&gt;7. Mobile technology of surrounding mobile network cells (2.5G or 3G). Assuming mobility what is the likelihood of intersystem (eg. 2.5G to 3G) handover?&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Given that there are a number of TCP options open to tuning, to improve performance,  and a number of complications a sensible next step would be to collect data regarding the capabilities and default settings of the TCP stacks that are implemented on the receivers (eg. mobile phones), the routers of the mobile network providers (eg. Vodafone), and the sender (eg. webserver). &lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;6. Finally a note of caution&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;There is an argument for not applying any optimisation to the TCP connection between a webserver and a mobile phone.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;The features of a TCP connection can only be negotiated when the initial connection is established. If you move from an area with 3G reception to an area only offering 2.5G, or vice versa, the optimisations you may have done for the 3G connection may cause terrible performance on the 2.5G connection, due to the differences in the network characteristics.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;Assuming that a connection will always be on the same type of network technology means that you could fall into the pitfall of premature optimisation.&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;7. Some light reading&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:white&quot;&gt;br&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;http://community.roxen.com/developers/idocs/rfc/rfc2018.html&quot;&gt;RFC2018&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://community.roxen.com/developers/idocs/rfc/rfc2488.html&quot;&gt;RFC2488&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://community.roxen.com/developers/idocs/rfc/rfc3042.html&quot;&gt;RFC3042&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://community.roxen.com/developers/idocs/rfc/rfc3481.html&quot;&gt;RFC3481&lt;/a&gt;&lt;/p&gt;</description>
			<pubDate>Thu, 02 Dec 2010 14:27:00 +0000</pubDate>
			
			
			<guid>http://www.daemonsolutions.com/mobile-internet-tcp-networking-considerations/</guid>
		</item>
		

	</channel>
</rss>
