yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #27743
[Bug 1390356] Re: Improve performance of get_active_networks_info
** Changed in: neutron
Status: Fix Committed => Fix Released
** Changed in: neutron
Milestone: None => kilo-2
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1390356
Title:
Improve performance of get_active_networks_info
Status in OpenStack Neutron (virtual network service):
Fix Released
Bug description:
When dhcp agent starts, it invokes "get_active_networks_info" rpc to
get network info. In "get_active_networks_info" function, nested loop
is used to fill the network structure with subnet and port info, which
is O(MN) complexity, as showed below:
for network in networks:
network['subnets'] = [subnet for subnet in subnets if subnet['network_id'] == network['id']]
network['ports'] = [port for port in ports if port['network_id'] == network['id']]
In our all-in-one OpenStack evironment with 4026 networks, 4022
subnets and 5557 ports, this operation costs 10s!
I suggest using dictionary to speed up this operation. Building a
dictionary for networks using id as the key, so each subnet and port
can be added to the network they belong to without looping the whole
network list.
I have written a simple simulation test to compare these two
approaches(see the attachment). The time cost by the dictionary based
approach and the original approach are 0.00468s versus 2.95s.
Considering this function is used in the rpc, this is a significant
improvement.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1390356/+subscriptions