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 2006851

Summary: [RFE] ovsdb-server: Optimize the way diffs applied to database rows
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Ilya Maximets <i.maximets>
Component: ovsdb2.16Assignee: Ilya Maximets <i.maximets>
Status: CLOSED ERRATA QA Contact: Rick Alongi <ralongi>
Severity: high Docs Contact:
Priority: high    
Version: RHEL 8.0CC: ctrautma, jhsiao, kfida, ralongi
Target Milestone: ---Keywords: FutureFeature
Target Release: FDP 21.I   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openvswitch2.16-2.16.0-14.el8fdp Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-10 16:50:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ilya Maximets 2021-09-22 14:18:11 UTC
ovsdb_datum_apply_diff() is heavily used in ovsdb transactions, but
it's linear in terms of number of comparisons.  And it also clones
all the atoms along the way.  In most cases size of a diff is much
smaller than the size of the original datum, this allows to perform
the same operation in-place with only O(diff->n * log2(old->n))
comparisons and O(old->n + diff->n) memory copies with memcpy.  This
can be achieved by searching for atoms from 'diff' in the original
row and applying changes in a way similar to set optimizations in
BZ 2005483.

Preliminary implementation:
https://github.com/igsilya/ovs/commit/3431fb358cd031738802c51555ef4601e6a29309

Using this function while applying diffs read from the storage gives
a significant performance boost.

Comment 1 Ilya Maximets 2021-09-24 14:15:42 UTC
Patch accepted in upstream:
  https://github.com/openvswitch/ovs/commit/32b51326ef9c307b4acd0bacafb0218dd1372f3d

Comment 2 OvS team 2021-09-29 19:11:23 UTC
* Wed Sep 29 2021 Dumitru Ceara <dceara> - 2.16.0-14
- ovsdb-data: Add function to apply diff in-place. [RH git: df0e4bda98] (#2006851)
    commit 32b51326ef9c307b4acd0bacafb0218dd1372f3d
    Author: Ilya Maximets <i.maximets>
    Date:   Thu Sep 23 01:47:24 2021 +0200
    
        ovsdb_datum_apply_diff() is heavily used in ovsdb transactions, but
        it's linear in terms of number of comparisons.  And it also clones
        all the atoms along the way.  In most cases size of a diff is much
        smaller than the size of the original datum, this allows to perform
        the same operation in-place with only O(diff->n * log2(old->n))
        comparisons and O(old->n + diff->n) memory copies with memcpy.
        Using this function while applying diffs read from the storage gives
        a significant performance boost and allows to execute much more
        transactions per second.
    
        Signed-off-by: Ilya Maximets <i.maximets>
        Acked-by: Mark D. Gray <mark.d.gray>
    
    Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2006851
    Signed-off-by: Dumitru Ceara <dceara>

Comment 5 Rick Alongi 2022-01-05 18:29:45 UTC
Per email with Dev (i.maximets), no specific test case is feasible for this change; general testing performed during the release is sufficient for regression testing.  A full test suite was run for FDP 21.J using openvswitch2.16-2.16.0-32.el8fdp.

Marking as Verified.

Comment 6 Rick Alongi 2022-01-06 12:48:32 UTC
Adding SanityOnly info:

[ralongi@ralongi openvswitch2.16]$ git log --oneline --grep=2006851
df0e4bda98 (tag: openvswitch2.16-2.16.0-14.el8fdp) ovsdb-data: Add function to apply diff in-place.
[ralongi@ralongi openvswitch2.16]$ git show df0e4bda98
commit df0e4bda98848c777a5136641cfd0b2b01a1e2e8 (tag: openvswitch2.16-2.16.0-14.el8fdp)
Author: Dumitru Ceara <dceara>
Date:   Wed Sep 29 13:06:27 2021 +0200

    ovsdb-data: Add function to apply diff in-place.
    
    commit 32b51326ef9c307b4acd0bacafb0218dd1372f3d
    Author: Ilya Maximets <i.maximets>
    Date:   Thu Sep 23 01:47:24 2021 +0200
    
        ovsdb_datum_apply_diff() is heavily used in ovsdb transactions, but
        it's linear in terms of number of comparisons.  And it also clones
        all the atoms along the way.  In most cases size of a diff is much
        smaller than the size of the original datum, this allows to perform
        the same operation in-place with only O(diff->n * log2(old->n))
        comparisons and O(old->n + diff->n) memory copies with memcpy.
        Using this function while applying diffs read from the storage gives
        a significant performance boost and allows to execute much more
        transactions per second.
    
        Signed-off-by: Ilya Maximets <i.maximets>
        Acked-by: Mark D. Gray <mark.d.gray>

Comment 8 errata-xmlrpc 2022-01-10 16:50:58 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 (openvswitch2.16 bug fix 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:0053