From owner-freebsd-net@FreeBSD.ORG Thu Sep 14 17:50:55 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16AD716A415; Thu, 14 Sep 2006 17:50:55 +0000 (UTC) (envelope-from marcelo@registro.br) Received: from clone.registro.br (clone.registro.br [200.160.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A22A43D7E; Thu, 14 Sep 2006 17:50:51 +0000 (GMT) (envelope-from marcelo@registro.br) Received: by clone.registro.br (Postfix, from userid 1014) id F35E62A576; Thu, 14 Sep 2006 14:50:49 -0300 (BRT) Date: Thu, 14 Sep 2006 14:50:49 -0300 From: Marcelo Gardini do Amaral To: Robert Watson Message-ID: <20060914175049.GH49126@registro.br> References: <2a41acea0608301145j7bbed961j33ce903a27d8963d@mail.gmail.com> <20060904130827.GE12975@registro.br> <20060911195521.GD63300@registro.br> <20060913182019.R50147@fledge.watson.org> <20060913182457.W50147@fledge.watson.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060913182457.W50147@fledge.watson.org> User-Agent: Mutt/1.4.2.1i Cc: freebsd-net@freebsd.org, freebsd-stable@freebsd.org Subject: Re: DNS query performance X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2006 17:50:55 -0000 > >Are you able to boot a 7.x kernel on this box? An as yet un-MFC'd > >optimization to the UDP send path is present in the 7.x kernel, suggested > >by ISC, which significantly improves threaded BIND9 performance. I've not > >benchmarked unthreaded BIND9 with the change. If you want to test > >specifically the before/after case for that change, you can find the > >reference to sosend_dgram in src/sys/netinet/udp_usrreq.c and swap it to > >sosend, which restores the old behavior. I booted 7.x kernel UP and SMP on my blade. When I swaped both of them to sosend I got a panic to any DNS query: # dig @localhost test1.foo.bar panic: sosend: protocol calls sosend KDB: enter: panic [thread pid 671 tid 100053 ] Stopped at kdb_enter+0x2b: nop db> db> bt Tracing pid 671 tid 100053 td 0xc4a52bd0 kdb_enter(c091d7b6) at kdb_enter+0x2b panic(c0925143,e502dc10,c06e6511,c4f9c14c,c4a66370,...) at panic+0xbb sosend(c4f9c14c,c4a66370,e502dbe4,0,0,0,c4a52bd0) at sosend+0x1f kern_sendit(c4a52bd0,15,e502dc5c,0,0,0) at kern_sendit+0x101 sendit(c4a52bd0,15,e502dc5c,0,c4a66150,...) at sendit+0x87 sendmsg(c4a52bd0,e502dd04) at sendmsg+0x53 syscall(3b,3b,3b,1,0,...) at syscall+0x256 Xint0x80_syscall() at Xint0x80_syscall+0x1f --- syscall (28, FreeBSD ELF32, sendmsg), eip = 0x28353d6f, esp = 0xbfbfe8ec, eb p = 0xbfbfea68 --- db> c Uptime: 1m44s Physical memory: 2039 MB Dumping 99 MB: 84 68 52 36 20 4 Dump complete Automatic reboot in 15 seconds - press a key on the console to abort > The other common optimization advice that you may already have received is > to check which time counter FreeBSD has selected. Right now, 6.x/7.x err > on the side of accurate over fast. There's been quite a bit of debate > about this approach, and it's useful to investigate the issue. You can > view and set the current choice by looking at the sysctl > kern.timecounter.hardware, and you can see the choices on your hardware by > looking at kern.timecounter.choice. Typically, TSC is the fastest, but may > suffer from drift as the CPU changes speed (as a result of temperature, > power saving, etc). Set it to TSC if it's not already TSC, and see what > the effect is. As many event libraries read time stamps frequently to set > up sleeping in user space, it can have a substantial performance impact. With the 7.x kernel and no changes in src/sys/netinet/udp_usrreq.c I tried different timecounters and I couldn't see any performance difference. Here we see the results for bind 9.3.2, same zone file and queries: Kernel UP Timecounter queries/s ----------- --------- ACPI-safe 16200 TSC 16584 i8254 16319 Kernel SMP Timecounter queries/s ----------- --------- ACPI-safe 15323 TSC 15930 i8254 14155 Any other tip? -- Att., Marcelo Gardini