Public bug reported:

In the OVN Agent (e.g., metadata agent) within the Neutron project, event 
handling for RowEvent instances assumes parallel execution of their run 
methods. However, due to the design of the ovsdbapp library's RowEventHandler 
class, these methods are executed sequentially [0]. This sequential execution 
creates a performance bottleneck, especially in high-traffic environments.
For example, consider the PortBindingEvent class in the OVN Agent, where the 
run method uses locks to safely handle concurrent execution [1]:

def run(self, event, row, old):
    resync = False

    with _SYNC_STATE_LOCK.read_lock():
        self.log_row(row)
        try:
            self.agent.provision_datapath(row)
        except ConfigException:
            # We're now in the reader lock mode, we need to exit the context 
and then use writer lock
            resync = True
    if resync:
        self.agent.resync()


This method relies on _SYNC_STATE_LOCK.read_lock() for thread-safe execution, 
which is only meaningful if run methods can execute concurrently. However, 
since RowEventHandler in ovsdbapp processes these events sequentially, the 
expected concurrency does not occur, resulting in underutilized resources and 
increased latency.

Suggested Solution:
Parallelize run Method Execution: Modify RowEventHandler to use concurrency 
mechanisms, such as a thread pool, to execute the run methods for different 
events in parallel instead of sequentially.


[0] 
https://github.com/openstack/ovsdbapp/blob/stable/2024.2/ovsdbapp/event.py#L177

[1]
https://github.com/openstack/neutron/blob/stable/2024.2/neutron/agent/ovn/metadata/agent.py#L135

** Affects: neutron
     Importance: Undecided
     Assignee: Amir Nikpour (amniik)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Amir Nikpour (amniik)

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

Title:
  Sequential Execution of run Methods in OVN Agent

Status in neutron:
  New

Bug description:
  In the OVN Agent (e.g., metadata agent) within the Neutron project, event 
handling for RowEvent instances assumes parallel execution of their run 
methods. However, due to the design of the ovsdbapp library's RowEventHandler 
class, these methods are executed sequentially [0]. This sequential execution 
creates a performance bottleneck, especially in high-traffic environments.
  For example, consider the PortBindingEvent class in the OVN Agent, where the 
run method uses locks to safely handle concurrent execution [1]:

  def run(self, event, row, old):
      resync = False

      with _SYNC_STATE_LOCK.read_lock():
          self.log_row(row)
          try:
              self.agent.provision_datapath(row)
          except ConfigException:
              # We're now in the reader lock mode, we need to exit the context 
and then use writer lock
              resync = True
      if resync:
          self.agent.resync()

  
  This method relies on _SYNC_STATE_LOCK.read_lock() for thread-safe execution, 
which is only meaningful if run methods can execute concurrently. However, 
since RowEventHandler in ovsdbapp processes these events sequentially, the 
expected concurrency does not occur, resulting in underutilized resources and 
increased latency.

  Suggested Solution:
  Parallelize run Method Execution: Modify RowEventHandler to use concurrency 
mechanisms, such as a thread pool, to execute the run methods for different 
events in parallel instead of sequentially.

  
  [0] 
https://github.com/openstack/ovsdbapp/blob/stable/2024.2/ovsdbapp/event.py#L177

  [1]
  
https://github.com/openstack/neutron/blob/stable/2024.2/neutron/agent/ovn/metadata/agent.py#L135

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


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to