From owner-freebsd-net@FreeBSD.ORG Thu Nov 8 10:18:04 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FB7DC31 for ; Thu, 8 Nov 2012 10:18:04 +0000 (UTC) (envelope-from oppermann@networx.ch) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 984768FC22 for ; Thu, 8 Nov 2012 10:18:02 +0000 (UTC) Received: (qmail 64186 invoked from network); 8 Nov 2012 11:53:10 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 8 Nov 2012 11:53:10 -0000 Message-ID: <509B86D5.6090401@networx.ch> Date: Thu, 08 Nov 2012 11:17:57 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: "Alexander V. Chernikov" Subject: Re: arp/ndp default hash size References: <509AE539.5050102@FreeBSD.org> In-Reply-To: <509AE539.5050102@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 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, 08 Nov 2012 10:18:04 -0000 On 07.11.2012 23:48, Alexander V. Chernikov wrote: > Hello list! > > Currently size of arp/ndp hash is the following: > #define LLTBL_HASHTBL_SIZE 32 /* default 32 ? */ > > This may be OK for end hosts, but this is definitely not enough for router howadays. Especially > given that IPv6 hosts generate 2 ndp records. > > Output from 2 random v4 / v6 routers from my $job: > 2:23 [0] m@matisse arp -an | wc -l > 1494 > 2:24 [0] m@singapore ndp -an | wc -l > 3999 > > Given that LIST_HEAD is just a pointer, and we currently have single global (actually per-VNET) > instance for every l3 proto, bumping hash to, say, at least 4096 should do no harm. A small list per hash bucket isn't bad. The hash should be about 1/4 of the expected table size. One problem here may be the memory consumption on smaller systems. A very large hash table size may hurt and isn't needed for a few entries. For a compromise I'd say the default hash table size should be 256 or 512. -- Andre