Subject: Re: [RFC][PATCH] iproute: Faster ip link add, set and delete

From: [email-masked] (Eric W. Biederman)
Date: Wed, 27 Mar 2013 17:46:05 -0700

Stephen Hemminger <[email-masked]> writes:

> If you need to do lots of operations the --batch mode will be significantly faster.
> One command start and one link map.

The problem in this case as I understand it is lots of independent
operations. Now maybe lxc should not shell out to ip and perform the
work itself.

> I have an updated version of link map hash (index and name). Could you test this patch
> which applies to latest version in git.

This still dumps all of the interfaces in ll_init_map causing things to
slow down noticably.

# with your patch
# time ~/projects/iproute/iproute2/ip/ip link add a4511 type veth peer name b4511

real	0m0.049s
user	0m0.000s
sys	0m0.048s

# With a hack to make ll_map_init a nop.
# time ~/projects/iproute/iproute2/ip/ip link add a4512 type veth peer name b4512

real	0m0.003s
user	0m0.000s
sys	0m0.000s
eric-ThinkPad-X220 6bed4 # 

# Without any patches.
# time ~/projects/iproute/iproute2/ip/ip link add a5002 type veth peer name b5002

real	0m0.052s
user	0m0.004s
sys	0m0.044s

So it looks like dumping all of the interfaces is taking 46 miliseconds,
longer than otherwise.  Causing ip to take nearly an order of magnitude
longer to run when there are a lot of interfaces, and causing ip to slow
down with each command.

So the ideal situation is probably just to fill in the ll_map on demand
instead of up front.

Eric