From owner-freebsd-net@FreeBSD.ORG Wed Aug 22 23:22:42 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 787A916A418 for ; Wed, 22 Aug 2007 23:22:42 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id DDB8613C49D for ; Wed, 22 Aug 2007 23:22:41 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 52052 invoked from network); 22 Aug 2007 23:12:46 -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 ; 22 Aug 2007 23:12:46 -0000 Message-ID: <46CCC548.4060108@freebsd.org> Date: Thu, 23 Aug 2007 01:22:48 +0200 From: Andre Oppermann User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: "Bruce M. Simpson" References: <46CC475F.8030505@FreeBSD.org> <46CC5698.7090200@FreeBSD.org> In-Reply-To: <46CC5698.7090200@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net , Ivo Vachkov Subject: Re: Route caching ? 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: Wed, 22 Aug 2007 23:22:42 -0000 Bruce M. Simpson wrote: > Ivo Vachkov wrote: >> Actually there is: >> >> struct route_in6 ip6_forward_rt; >> >> that "caches" the last route used (thanks blue !!!) but i think this >> technique is pointless in a multiflow traffic. >> > > Yes, this is why OpenBSD got rid of this form of 'route caching'. If you have a single flow a radix trie doesn't perform less good than a cache as all nodes are in the CPU cache anyway. >> Is it reasonable to believe that route caches can improve networking >> performance or we should leave it up to the routing table itself ? >> > > I believe that if one goes beyond a single radix trie, as is needed for > multi-pathing with multicast and source policy routing, route caching is > *required* to achieve good performance. No, most likely not. Caching only adds a lot of complexity. All useful caching is already done by the CPU caches. You almost can't do better than that. > Also, if FreeBSD moves ARP and NDP out of the radix trie, a route cache > would be highly preferable as it amortizes the lock acquisition which > would other be required for ARP/NDP/other layer 2 next-hop resolution. Route caching has some side evilness other than being ineffective. For every route change you either have to invalidate the entire cache or you have to do a cache lookup on all CPUs (if you have one per CPU as you seem to suggest) to prevent it from using stale data. If you don't use BGP DFZ sized routing tables caching is pointless anyway. If you do, you get some 1k updates per minute. Lots of cache invalidations. Multi-CPU cache invalidation has big locking implications which makes it inefficient again. There is not really much to win with route caching other than a huge amount of unnecessary complexity. -- Andre