← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1959750] [NEW] potential performance issue when scheduling network segments

 

Public bug reported:

During some investigations regarding segments we may have noticed
performance issues related to the current algorithm that schedules
network segments on hosts.

When an agent is reporting a change in segment, the process goes to the
function `auto_schedule_new_network_segments` with the list of the
segments that this host handles.

This function is retrieving from the segments the related networks, then
we can notice that the algorithm is running a double for loop. That one
iterates through network and per segments to schedule network segments
on all hosts.

        for network_id in network_ids:
            for segment in segments:
                self._schedule_network(
                    payload.context, network_id, dhcp_notifier,
                        candidate_hosts=segment['hosts'])

Depending on the design chosen, in a setup that has hundred segments per
host with hundred networks and potentially segments that share the same
list of hosts, we will endup by calling _schedule_network 10000 times
with duplication.

To avoid such duplication and unnecessary calls of _schedule_network for
the same hosts we may want to provide a datastructure that is storing
for each network the hosts already scheduled.

     for network_id in network_ids:
         for segment in segments:
             if not _already_scheduled(network_id, segment['hosts']):
                 self._schedule_network(
                     payload.context, network_id, dhcp_notifier,
                     candidate_hosts=segment['hosts'])

With this same scenario, and by using such algorithm we may reduce the
number of call per the number of networks, 100.

Thanks,
s.

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1959750

Title:
  potential performance issue when scheduling network segments

Status in neutron:
  New

Bug description:
  During some investigations regarding segments we may have noticed
  performance issues related to the current algorithm that schedules
  network segments on hosts.

  When an agent is reporting a change in segment, the process goes to
  the function `auto_schedule_new_network_segments` with the list of the
  segments that this host handles.

  This function is retrieving from the segments the related networks,
  then we can notice that the algorithm is running a double for loop.
  That one iterates through network and per segments to schedule network
  segments on all hosts.

          for network_id in network_ids:
              for segment in segments:
                  self._schedule_network(
                      payload.context, network_id, dhcp_notifier,
                          candidate_hosts=segment['hosts'])

  Depending on the design chosen, in a setup that has hundred segments
  per host with hundred networks and potentially segments that share the
  same list of hosts, we will endup by calling _schedule_network 10000
  times with duplication.

  To avoid such duplication and unnecessary calls of _schedule_network
  for the same hosts we may want to provide a datastructure that is
  storing for each network the hosts already scheduled.

       for network_id in network_ids:
           for segment in segments:
               if not _already_scheduled(network_id, segment['hosts']):
                   self._schedule_network(
                       payload.context, network_id, dhcp_notifier,
                       candidate_hosts=segment['hosts'])

  With this same scenario, and by using such algorithm we may reduce the
  number of call per the number of networks, 100.

  Thanks,
  s.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1959750/+subscriptions



Follow ups