← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1959750] Re: potential performance issue when scheduling network segments

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/829022
Committed: https://opendev.org/openstack/neutron/commit/b5b519a4faa52677d5b9d5553217ed40aac70483
Submitter: "Zuul (22348)"
Branch:    master

commit b5b519a4faa52677d5b9d5553217ed40aac70483
Author: Sahid Orentino Ferdjaoui <sahid-orentino.ferdjaoui-ext@xxxxxxxxxx>
Date:   Mon Feb 14 13:52:10 2022 +0100

    segments: fix scheduling duplicate segments
    
    It has been reported by bug #1959750 that for a given network the
    agent is scheduling all segments reported by agent.
    
    This commit is fixing the issue by ensuring scheduling segments per
    network that they belong to only.
    A test has been updated to demonstract the fact that for a given
    network we only schedule the related segments.
    
    Closes-bug: #1959750
    Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@xxxxxxxxxxxxxxxxxxxxxxxx>
    Change-Id: Icd57570004055903c6817a75d814ed65db3fa53c


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
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:
  Fix Released

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



References