netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	David Ahern <dsahern@kernel.org>,
	stephen@networkplumber.org
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] Improve batch times by caching link lookups
Date: Mon, 7 Jan 2019 13:58:31 -0700	[thread overview]
Message-ID: <89099221-ca87-3298-47bf-b8e68403c2b2@gmail.com> (raw)
In-Reply-To: <9f8a0935-2f4c-74e8-038d-61e3b5049f12@gmail.com>

On 1/7/19 1:57 PM, Eric Dumazet wrote:
> 
> 
> On 01/07/2019 12:41 PM, David Ahern wrote:
>> From: David Ahern <dsahern@gmail.com>
>>
>> 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).
>>
> 
> What time increase if we have 10,000 devices, and install one route ?
> 
> Caching 10,000 devices would be quite a waste.
> 

It only lookups up the device if ll_name_to_index is invoked for the
device.

This is NOT a link dump and cache; it only adds lookups to the cache.

  reply	other threads:[~2019-01-07 20:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 20:41 [PATCH iproute2-next] Improve batch times by caching link lookups David Ahern
2019-01-07 20:57 ` Eric Dumazet
2019-01-07 20:58   ` David Ahern [this message]
2019-01-07 21:06     ` Eric Dumazet
2019-01-07 21:16       ` David Ahern
2019-01-07 21:31 ` Stephen Hemminger
2019-01-07 21:52   ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89099221-ca87-3298-47bf-b8e68403c2b2@gmail.com \
    --to=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).