From owner-freebsd-net@FreeBSD.ORG Mon Nov 28 06:29:32 2005 Return-Path: X-Original-To: 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 C2BDE16A41F; Mon, 28 Nov 2005 06:29:32 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8E8343D75; Mon, 28 Nov 2005 06:29:29 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jAS6TRv9015688; Mon, 28 Nov 2005 08:29:27 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 18813-03-2; Mon, 28 Nov 2005 08:29:25 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jAS6RabX015618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Nov 2005 08:27:37 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.4/8.13.4) id jAS6RbkM058802; Mon, 28 Nov 2005 08:27:37 +0200 (EET) (envelope-from ru) Date: Mon, 28 Nov 2005 08:27:32 +0200 From: Ruslan Ermilov To: Gleb Smirnoff Message-ID: <20051128062732.GA58778@ip.net.ua> References: <20051127005943.GR25711@cell.sick.ru> <20051127135529.GF25711@cell.sick.ru> <20051127194545.GA76200@ip.net.ua> <20051127195914.GI25711@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051127195914.GI25711@cell.sick.ru> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: Vsevolod Lobko , rwatson@freebsd.org, net@freebsd.org Subject: Re: parallelizing ipfw table 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: Mon, 28 Nov 2005 06:29:33 -0000 On Sun, Nov 27, 2005 at 10:59:14PM +0300, Gleb Smirnoff wrote: > Ruslan, > > On Sun, Nov 27, 2005 at 09:45:45PM +0200, Ruslan Ermilov wrote: > R> Nope, I need this caching. It's for looking up the same table > R> several times in a row but with various values. For example, > R> we use ipfw tables to route the traffic to the correct dummynet > R> pipe, where value is the bandwidth, and this caching helps a lot. > > Have you benchmarked that this caching is important? On a router > that serves a lot of parallel traffic flows the caching is not > a benefit, but additional processing. I think we should optimize > the code for more loaded environments, since we don't care about > CPU consumption in a less loaded setup - whether it is 0.1% or 0.11%. > I'm talking about the following case: the same packet is processed by a firewall ruleset that has N rules that look up the same ipfw table but with different "values", to select a correct dummynet pipe. > In general such kind of caching in network code is an old fashion, > that causes a problems when we attempt to make code more > parallelizable. We alreade removed rtcache in ip_output.c rev. 1.201 > and we will soon remove route caching in gif(4), because it causes > problems on SMP. > > Can you try my patch? Since it reduces the total number of mutex > operations it should be a win on UP, too. > We're currently based on 4.x. You can try it yourself: create a table with 10000 entries and with value 13. Then write a ruleset with 13 rules that look up this table so that the last rule looks it up with value 13, and do a benchmark. Let me know what are results with and without caching. Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer