Here's a quick summary of how to set the max and default buffers for some common OS's: 

Linux 2.2.x add the following to /etc/rc.d/rc.local

  echo 8388608 > /proc/sys/net/core/wmem_max
  echo 8388608 > /proc/sys/net/core/rmem_max
  echo 65536 > /proc/sys/net/core/rmem_default
  echo 65536 > /proc/sys/net/core/wmem_default

 

Linux 2.4.x Add the following to /etc/sysctl.conf, and then run "sysctl -p"
# increase Linux TCP buffer limits
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
net.core.rmem_default = 65536
net.core.wmem_default = 65536

# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
net.ipv4.tcp_rmem = 4096 87380 8388608 
net.ipv4.tcp_wmem = 4096 65536 8388608 
# number of pages, not bytes
net.ipv4.tcp_mem = 4096 4096 4096

Note: Linux 2.4 has a pretty good sender-side autotuning mechanism, so that setting the opitimal buffer size on the sender is not needed, assuming you have set large buffers on the recieve side. This is very nice! The 3 values are min, default, and max. Make sure you set the max large enough. See the IP Sysctl tutorial or here for more information.

However, Linux 2.4 has some other strange behavior that one needs to be aware of. For example: The value for ssthresh for a given path is cached in the routing table. This means that if a connection has has a retransmit and reduces its window, then all connections to that host for the next 10 minutes will use a reduced window size, and not even try to increase its window. The only way to disable this behavior is to do the following before all new connections (you must be root):

	         sysctl -w net.ipv4.route.flush=1
		

Another thing you can try to increase TCP throughput on Linux is to increase the size of the interface queue. To do this, to the following:

		    ifconfig eth0 txqueuelen 1000 
		
I've seen increases in bandwidth of up to 8x by doing this on some long, fast paths. This is only a good idea for Gigabit Ethernet connected hosts, and may have other side effects such as uneven sharing between multiple streams.

A similar setting for the receive host is to increase netdev_max_backlog. For example:

	         sysctl -w net.core.netdev_max_backlog=2500
		

For more information on how Linux 2.4 TCP works, see Tom Dunigan's page on TCP autotuning.

 

Solaris create a boot script similar to this (e.g.: /etc/rc2.d/S99ndd)


 
#!/bin/sh
  # increase max tcp window
  # Rule-of-thumb: max_buf = 2 x cwnd_max (congestion window)
  ndd -set /dev/tcp tcp_max_buf 4194304
  ndd -set /dev/tcp tcp_cwnd_max 2097152
 
  # increase DEFAULT tcp window size
  ndd -set /dev/tcp tcp_xmit_hiwat 65536
  ndd -set /dev/tcp tcp_recv_hiwat 65536
 
  osver=`uname -r`
  # SACK is on by default in version > 5.7
  if [ $osver = "5.7" ]; then
      echo "setting tcp_sack_permitted to 2"
      ndd -set /dev/tcp tcp_sack_permitted 2
  fi
 
  if [ $osver = "5.9" ]; then
  # if you want to play with ECN, you can in version 5.9
      echo "Enabling ECN "
      ndd -set /dev/tcp tcp_ecn_permitted 2
  fi

For solaris 2.6, also install the SACK patch.

IRIX edit the file: /var/sysgen/master.d/bsd, and set:

tcp_sendspace
tcp_recvspace

The maximum buffer size under Irix 6.5 is 1MB, and is not changeable.

FreeBSD add this to /etc/rc.local (or some other boot script):

sysctl -w kern.ipc.maxsockbuf=8388608
sysctl -w net.inet.tcp.rfc1323=1
sysctl -w net.inet.tcp.sendspace=1048576
sysctl -w net.inet.tcp.recvspace=1048576

For more info see: FreeBSD Network Tuning Info
Others Operating Systems See the PSC TCP performance tuning guide.

Please send information on Windows and other operating systems to BLTierney@lbl.gov