From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2-next] Improve batch times by caching link lookups Date: Mon, 7 Jan 2019 13:31:55 -0800 Message-ID: <20190107133155.6da96d55@hermes.lan> References: <20190107204130.32144-1-dsahern@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, David Ahern To: David Ahern Return-path: Received: from mail-pf1-f171.google.com ([209.85.210.171]:37430 "EHLO mail-pf1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbfAGVb6 (ORCPT ); Mon, 7 Jan 2019 16:31:58 -0500 Received: by mail-pf1-f171.google.com with SMTP id y126so799418pfb.4 for ; Mon, 07 Jan 2019 13:31:58 -0800 (PST) In-Reply-To: <20190107204130.32144-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 7 Jan 2019 12:41:30 -0800 David Ahern wrote: > From: David Ahern > > ip route uses ll_name_to_index to convert the user given device name to an > index. At the moment ll_name_to_index uses if_nametoindex which is ioctl > based and does not cache the result. When using a batch file this means > the same device lookups can be done repeatedly adding unnecessary overhead > (socket + ioctl call for each device lookup). > > Add a new function, ll_link_get, to send a netlink based RTM_GETLINK. If > successful, cache the result in idx_head and name_head so future lookups > can re-use the entry. > > With this change the time to install routes via a batch file is reduced > from 30.7 seconds to 17.6 seconds (720,022 routes with 2 ecmp nexthops > where the nexthop device is given). > > Signed-off-by: David Ahern What if a ip command in the batch does a rename?