<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stephen Kingston &#187; TCP</title>
	<atom:link href="http://stephen.kingston.name/category/tcp/feed/" rel="self" type="application/rss+xml" />
	<link>http://stephen.kingston.name</link>
	<description>Technical Weblog</description>
	<lastBuildDate>Wed, 02 May 2007 20:13:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Tuning TCP</title>
		<link>http://stephen.kingston.name/2006/11/16/tuning-tcp/</link>
		<comments>http://stephen.kingston.name/2006/11/16/tuning-tcp/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 21:22:23 +0000</pubDate>
		<dc:creator>Stephen Kingston</dc:creator>
				<category><![CDATA[CS35110]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://stephen.kingston.name/?p=20</guid>
		<description><![CDATA[After our discussion of the sliding windows protocol today, and of what makes a good window size for a TCP connection, I was asked what the default window size is in Microsoft Windows XP, and how to change this. The answer is that the default window size is just 16KB. The value can be adjusted [...]]]></description>
			<content:encoded><![CDATA[<p>After our discussion of the sliding windows protocol today, and of what makes a good window size for a TCP connection, I was asked what the default window size is in Microsoft Windows XP, and how to change this.</p>
<p>The answer is that the default window size is just 16KB. The value can be adjusted in the registry, and the details are listed below. The TCP1323 key will turn on the window scaling option. The second key raises the default window size from 16KB to 128KB, and the third option sets the maximum window size for all connections to 1MB (if you don&#8217;t set this, the default in Windows is 64K, and this will take precedence over your other parameters).<br />
<code style="font-size: 1em"><br />
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Tcp1323=1<br />
HKLM\SYSTEM\CurrentControlSet\<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Services\Tcpip\Parameters\TcpWindowSize=131400<br />
HKLM\SYSTEM\CurrentControlSet\<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Services\Tcpip\Parameters\GlobalMaxTcpWindowSize=1048576<br />
</code></p>
<p>The global max tcp window size parameter illustrates something I did not mention in the lecture &#8211; that during the lifecycle of a connection, TCP implementations can adjust their buffer sizes on the fly. Adjusting downwards can be problematic (leading to shrinking windows), but adjusting upwards allows the operating system to allocate more memory only to those TCP connections that require large buffers.</p>
<p>On Linux you can achieve the same thing. To change TCP settingson 2.4 kernels and later, you add the entries below to the file /etc/sysctl.conf, and run &#8220;sysctl -p&#8221;.</p>
<p><code><br />
# increase TCP maximum buffer size<br />
net.core.rmem_max = 1048576<br />
net.core.wmem_max = 1048576<br />
# increase Linux autotuning TCP buffer limits (min, default max)<br />
net.ipv4.tcp_rmem = 4096 131400 1048576<br />
net.ipv4.tcp_wmem = 4096 131400 1048576<br />
</code></p>
<p>On a Mac, the same effect is obtained with these commands:</p>
<p><code><br />
sysctl -w kern.ipc.maxsockbuf=1048576<br />
sysctl -w net.inet.tcp.sendspace=131400<br />
sysctl -w net.inet.tcp.recvspace=131400<br />
</code></p>
<p>Apple also provides a <a href="http://www.apple.com/support/downloads/broadbandtuner10.html">Broadband Tuner patch</a> that does some similar tuning for you on  Mac OS X 10.4 and above.</p>
<p>The Mac is based on BSD, and the method for tuning BSD is similar. Add the following lines to /etc/sysctl.conf and reboot.</p>
<p><code><br />
kern.ipc.maxsockbuf=1048576<br />
net.inet.tcp.rfc1323=1<br />
net.inet.tcp.sendspace=131400<br />
net.inet.tcp.recvspace=131400<br />
</code></p>
<p>Obviously the actual values you use for buffer sizes will depend on the bandwidth and latency of your networks, but these values above should be a good starting point.</p>
]]></content:encoded>
			<wfw:commentRss>http://stephen.kingston.name/2006/11/16/tuning-tcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

