From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next] net: bridge: use rhashtable for fdbs Date: Wed, 13 Dec 2017 15:10:16 -0500 (EST) Message-ID: <20171213.151016.1106433741027557327.davem@davemloft.net> References: <1513087370-4791-1-git-send-email-nikolay@cumulusnetworks.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org, roopa@cumulusnetworks.com, stephen@networkplumber.org, srn@prgmr.com To: nikolay@cumulusnetworks.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:44214 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbdLMUKR (ORCPT ); Wed, 13 Dec 2017 15:10:17 -0500 In-Reply-To: <1513087370-4791-1-git-send-email-nikolay@cumulusnetworks.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Nikolay Aleksandrov Date: Tue, 12 Dec 2017 16:02:50 +0200 > Before this patch the bridge used a fixed 256 element hash table which > was fine for small use cases (in my tests it starts to degrade > above 1000 entries), but it wasn't enough for medium or large > scale deployments. Modern setups have thousands of participants in a > single bridge, even only enabling vlans and adding a few thousand vlan > entries will cause a few thousand fdbs to be automatically inserted per > participating port. So we need to scale the fdb table considerably to > cope with modern workloads, and this patch converts it to use a > rhashtable for its operations thus improving the bridge scalability. > Tests show the following results (10 runs each), at up to 1000 entries > rhashtable is ~3% slower, at 2000 rhashtable is 30% faster, at 3000 it > is 2 times faster and at 30000 it is 50 times faster. > Obviously this happens because of the properties of the two constructs > and is expected, rhashtable keeps pretty much a constant time even with > 10000000 entries (tested), while the fixed hash table struggles > considerably even above 10000. > As a side effect this also reduces the net_bridge struct size from 3248 > bytes to 1344 bytes. Also note that the key struct is 8 bytes. > > Signed-off-by: Nikolay Aleksandrov > --- > After this I'll post patches for the per-port fdb limit option. Later we > can get rid of hash_lock altogether though that requires much more > careful changes. Nice work Nikolay, applied, thanks!