From 4313e61a52ebf6edfebd2fef6ab7b5f595650557 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 31 Jul 2007 22:51:29 +0000 Subject: =?UTF-8?q?Increase=20timeouts=20when=20using=20a=201000=20hz.=0D?= =?UTF-8?q?=0DFrom=20the=20FreeBSD=20commit=20message:=0D=0D=CAChange=20TC?= =?UTF-8?q?PTV=5FMIN=20to=20be=20independent=20of=20HZ.=20=CAWhile=20it=20?= =?UTF-8?q?was=20documented=20to=20=CAbe=20in=20ticks=20"for=20algorithm?= =?UTF-8?q?=20stability"=20when=20originally=20committed,=20it=20turns=20?= =?UTF-8?q?=CAout=20that=20it=20has=20a=20significant=20impact=20in=20timi?= =?UTF-8?q?ng=20out=20connections.=20=CAWhen=20we=20=CAchanged=20HZ=20from?= =?UTF-8?q?=20100=20to=201000,=20this=20had=20a=20big=20effect=20on=20redu?= =?UTF-8?q?cing=20the=20time=20=CAbefore=20dropping=20connections.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ÊTo demonstrate, boot with kern.hz=100. Êssh to a box on local ethernet Êand establish a reliable round-trip-time (ie: type a few commands). ÊThen unplug the ethernet and press a key. ÊTime how long it takes to Êdrop the connection. ÊThe old behavior (with hz=100) caused the connection to typically drop Êbetween 90 and 110 seconds of getting no response. ÊNow boot with kern.hz=1000 (default). ÊThe same test causes the ssh session Êto drop after just 9-10 seconds. ÊThis is a big deal on a wifi connection. ÊWith kern.hz=1000, change sysctl net.inet.tcp.rexmit_min from 3 to 30. ÊNote how it behaves the same as when HZ was 100. ÊAlso, note that when Êbooting with hz=100, net.inet.tcp.rexmit_min *used* to be 30. ÊThis commit changes TCPTV_MIN to be scaled with hz. Êrexmit_min should Êalways be about 30. ÊIf you set hz to Really Slow(TM), there is a safety Êfeature to prevent a value of 0 being used. ÊThis may be revised in the future, but for the time being, it restores the Êold, pre-hz=1000 behavior, which is significantly less annoying. ÊAs a workaround, to avoid rebooting or rebuilding a kernel, you can run Ê"sysctl net.inet.tcp.rexmit_min=30" and add "net.inet.tcp.rexmit_min=30" Êto /etc/sysctl.conf. ÊThis is safe to run from 6.0 onwards. ÊApproved by: Êre (rwatson) ÊReviewed by: Êandre, silby --- etc/rc.bootup | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'etc') diff --git a/etc/rc.bootup b/etc/rc.bootup index 75e1590..07108d2 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -316,6 +316,15 @@ mwexec("sysctl net.inet.tcp.recvspace=4096"); mwexec("sysctl net.inet.tcp.sendspace=4096"); } + + /* if we are operating at 1000 then increase timeouts. + this was never accounted for after moving to 1000 hz */ + $kern_hz = `sysctl kern.clockrate | awk '{ print $5 }' | cut -d"," -f1`; + $kern_hz = trim($kern_hz, "\r\n"); + if($kern_hz == "1000") { + mwexec("sysctl net.inet.tcp.rexmit_min=30"); + mwexec("sysctl net.inet.tcp.rexmit_min=30"); + } upnp_start(); -- cgit v1.1