From owner-freebsd-net@FreeBSD.ORG Wed Apr 8 13:14:02 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 558B2E60 for ; Wed, 8 Apr 2015 13:14:02 +0000 (UTC) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5233B641 for ; Wed, 8 Apr 2015 13:14:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id t38DDoE9004446; Wed, 8 Apr 2015 23:13:50 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Wed, 8 Apr 2015 23:13:50 +1000 (EST) From: Ian Smith To: Marek Salwerowicz Subject: Re: RTT and TCP Window size doubts, bandwidth issues In-Reply-To: <552455EB.7080609@wp.pl> Message-ID: <20150408225751.D22893@sola.nimnet.asn.au> References: <552455EB.7080609@wp.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 13:14:02 -0000 On Wed, 8 Apr 2015 00:10:51 +0200, Marek Salwerowicz wrote: > Hi list, > > I am trying to find correct setup of sysctl's for following machines (VMs > under Vmware Workstation 8) to test large TCP window size: > > > There are 2 boxes, each of them has following setup: > - % uname -a > FreeBSD freeA 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 > UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC > amd64 > > - 4GB of RAM > - 1 NIC > > without any modifications, iperf reports bandwidth speed ~1Gbit/s between > hosts: > > server-side: > # iperf -s > ------------------------------------------------------------ > Server listening on TCP port 5001 > TCP window size: 64.0 KByte (default) > ------------------------------------------------------------ > > client-side: > > # iperf -c 192.168.108.140 > ------------------------------------------------------------ > Client connecting to 192.168.108.140, TCP port 5001 > TCP window size: 32.5 KByte (default) > ------------------------------------------------------------ > [ 3] local 192.168.108.141 port 35282 connected with 192.168.108.140 port > 5001 > [ ID] Interval Transfer Bandwidth > [ 3] 0.0-10.0 sec 1.46 GBytes 1.25 Gbits/sec > > > > I want to simulate (using dummynet) link between hosts with bandwidth > 400mbit/s and latency ~20ms. > In order to do that, I create the ipfw pipe on one box: > IPFW="ipfw -q" > > > $IPFW pipe 1 config bw 400Mbit/s delay 10ms > > $IPFW add 1500 pipe 1 ip from any to any > > > after running ipfw, bandwidth with default kernel sysctl becomes lower: > > client-side: > ------------------------------------------------------------ > Client connecting to 192.168.108.140, TCP port 5001 > TCP window size: 32.5 KByte (default) > ------------------------------------------------------------ > [ 3] local 192.168.108.141 port 35340 connected with 192.168.108.140 port > 5001 > [ ID] Interval Transfer Bandwidth > [ 3] 0.0-10.1 sec 12.5 MBytes 10.4 Mbits/sec > > > > I'd like to achieve bandwidth ~400Mbit/s. > > I've modified following sysctl's (both on client- and server-side): > > kern.ipc.maxsockbuf=33554432 # (default 2097152) > > net.inet.tcp.sendbuf_max=33554432 # (default 2097152) > net.inet.tcp.recvbuf_max=33554432 # (default 2097152) > > net.inet.tcp.cc.algorithm=htcp # (default newreno) #enabled in > /boot/loader.conf also > net.inet.tcp.cc.htcp.adaptive_backoff=1 # (default 0 ; disabled) > > net.inet.tcp.cc.htcp.rtt_scaling=1 # (default 0 ; disabled) > > net.inet.tcp.mssdflt=1460 # (default 536) > > net.inet.tcp.minmss=1300 # (default 216) > > net.inet.tcp.rfc1323=1 # (default 1) > net.inet.tcp.rfc3390=1 # (default 1) > > > net.inet.tcp.sendspace=8388608 # (default 32768) > net.inet.tcp.recvspace=8388608 # (default 65536) > > net.inet.tcp.sendbuf_inc=32768 # (default 8192 ) > net.inet.tcp.recvbuf_inc=65536 # (default 16384) > > > > But the results are not really good as I expected: > > server-side: > # iperf -s > ------------------------------------------------------------ > Server listening on TCP port 5001 > TCP window size: 8.00 MByte (default) > ------------------------------------------------------------ > > client-side: > # iperf -c 192.168.108.140 > ------------------------------------------------------------ > Client connecting to 192.168.108.140, TCP port 5001 > TCP window size: 8.00 MByte (default) > ------------------------------------------------------------ > [ 3] local 192.168.108.141 port 21894 connected with 192.168.108.140 port > 5001 > [ ID] Interval Transfer Bandwidth > [ 3] 0.0-10.1 sec 24.2 MBytes 20.2 Mbits/sec > > > I was trying to follow the articles: > - http://www.psc.edu/index.php/networking/641-tcp-tune > - https://fasterdata.es.net/host-tuning/freebsd/ > > But can't really figure out what / how should be tuned in order to achieve > good results. > > If anyone could find some time and give me some hints, I'd be pleased! Many of your tunings are over my head, but I can see that you've nicely emulated a half-duplex link; you want one pipe for each direction for a fast bidirectional link. See ipfw(8) /TRAFFIC SHAPING Also be sure of your setting of sysctl net.inet.ip.fw.one_pass, here and also re your later post re ipfw / dummynet, which also wants 2 pipes. cheers, Ian