Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
The FDP team is no longer accepting new bugs in Bugzilla. Please report your issues under FDP project in Jira. Thanks.

Bug 1962338

Summary: [scale] northd: precompute router load balancer IPs
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Tim Rozet <trozet>
Component: OVNAssignee: Dumitru Ceara <dceara>
Status: CLOSED ERRATA QA Contact: ying xu <yinxu>
Severity: high Docs Contact:
Priority: urgent    
Version: RHEL 8.0CC: anusaxen, astoycos, ctrautma, dcbw, dceara, jiji, kfida, mmichels, nusiddiq
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard: perfscale-ovn
Fixed In Version: ovn21.09-21.09.0-7.el8fdp Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1960042 Environment:
Last Closed: 2022-12-15 00:21:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1960042    

Description Tim Rozet 2021-05-19 19:01:14 UTC
+++ This bug was initially created as a clone of Bug #1960042 +++

Description of problem:
OCP4.8 w/ OVNKubernetes as the SDN. Scaled to 300 nodes, we are seeing ovn-northd consume an entire core:

      1 root      20   0 1521272   1.4g   7420 R  98.7   1.1 370:31.04 ovn-northd                                                                                                                                                                             

TimR also noted that it is taking 30+ seconds for northd to process changes.


Version-Release number of selected component (if applicable):
4.8

How reproducible:
100%

Steps to Reproduce:
1. Deploy OCP4.8
2. Scale to 300 nodes
3. Run clusterdensity 2k

Actual results:

--- Additional comment from Joe Talerico on 2021-05-12 21:12:57 UTC ---

full must-gather : http://dell-r510-01.perf.lab.eng.rdu2.redhat.com/rook/must-gather-bz1960042.tar.gz

--- Additional comment from Dumitru Ceara on 2021-05-18 21:50:54 UTC ---

(In reply to Joe Talerico from comment #1)
> full must-gather :
> http://dell-r510-01.perf.lab.eng.rdu2.redhat.com/rook/must-gather-bz1960042.
> tar.gz

I might have missed it but it seems to me that the must-gather doesn't
include the OVN NB database file, it only includes container logs.
Would it be possible to attach a NB DB from a scaled clusters from the
time when the issue is hit?  That would make investigation easier as
we don't need a complete cluster to profile northd.

Thanks,
Dumitru

--- Additional comment from Tim Rozet on 2021-05-19 13:25:28 UTC ---



--- Additional comment from Dumitru Ceara on 2021-05-19 15:33:03 UTC ---

After initial analysis, a decent time of the poll interval is spent in
building router load balancer logical flows.

1. get_router_load_balancer_ips() is called way too often, we can just
precompute those IPs once per iteration, instead of calling it for every
logical router port.  An initial test shows that this change reduces
the loop iteration time from ~22s to ~19s.

2. ovn_lflow_add_at() always builds a logical flow record even though
this will be discarded if the logical flow is aggregated on a datapath
group.  We can instead try to delay the creation of new flow records
until really necessary.  This saves a decent amount of allocations and
memory copying.  An initial test shows that this change reduces the
loop iteration time further to ~15s.

3. We can try to change the way load balancer flows are built.
Currently for X routers (or switches) with Y load balancers applied to
them we do:
- for every router:
  - for every load balancer:
    - parse and generate lots of common lb stuff (e.g., VIPs, backends)
    - generate one logical flow per VIP.

I think we can save quite a lot of CPU by changing this to:
- for every load balancer:
  - parse and generate lots of common lb stuff (e.g., VIPs, backends)
  - for every router:
    - generate one logical flow per VIP.

4. I also enabled northd parallelization and this further reduced the
loop iteration times to ~8s with the cost of northd consuming up to
900% CPU.  However, northd parallelization is a new feature and needs
further testing and needs to be enabled in CI.

I'll open OVN BZs for all items above so we can track the work
independently.

Comment 1 Tim Rozet 2021-05-19 19:02:24 UTC
oops sorry Dumitru I missed your comment about you opening up different bugs individually. Feel free to use this as one of them.

Comment 2 Mark Michelson 2021-05-20 16:04:21 UTC
Hi Tim, we'll use this as the report for item 1 in Dumitru's list above. I'll open individual issues for the other items.

Comment 3 Dumitru Ceara 2021-06-01 17:06:18 UTC
Fix sent upstream for review:
http://patchwork.ozlabs.org/project/ovn/patch/20210601170320.30490-1-dceara@redhat.com/

Comment 4 Dumitru Ceara 2021-06-10 12:49:48 UTC
v2 posted, reducing poll loops with an additional 1 second on top of v1:
http://patchwork.ozlabs.org/project/ovn/list/?series=248146&state=*

Comment 5 Numan Siddique 2021-06-22 20:13:42 UTC
Patches merged u/s main branch

Comment 9 ying xu 2021-08-24 09:15:39 UTC
I talked to numan, this bug just improve performance, does not effect the function,so we check that loadbalance works normal.
since we can't build a large scale in our env, just set sanity-only.

Comment 14 errata-xmlrpc 2022-12-15 00:21:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ovn2.13 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:9044