[ovs-dev] [PATCH ovn v8 1/5] ovn-northd-ddlog: Optimize AggregatedFlow rules.

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Fri Jul 23 15:10:25 UTC 2021


From: Ben Pfaff <blp at ovn.org>

This should avoid some work by doing the cheapest check (the one on
UseLogicalDatapathGroups) before any joins.  DDlog is probably
factoring out the reference to the Flow relation, which is identical
in both, but this ought to avoid the group_by aggregation (which is
relatively expensive) in the case where UseLogicalDatapathGroups is
not enabled.

Acked-by: Han Zhou <hzhou at ovn.org>
Acked-by: Dumitru Ceara <dceara at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
 northd/ovn_northd.dl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/northd/ovn_northd.dl b/northd/ovn_northd.dl
index ab33a139e..bfa15bf09 100644
--- a/northd/ovn_northd.dl
+++ b/northd/ovn_northd.dl
@@ -1689,9 +1689,9 @@ AggregatedFlow(.logical_datapaths = g.to_set(),
                .actions = actions,
                .tags = tags,
                .external_ids = external_ids) :-
+    UseLogicalDatapathGroups[true],
     TaggedFlow(logical_datapath, stage, priority, __match, actions, tags, external_ids),
-    var g = logical_datapath.group_by((stage, priority, __match, actions, tags, external_ids)),
-    UseLogicalDatapathGroups[true].
+    var g = logical_datapath.group_by((stage, priority, __match, actions, tags, external_ids)).
 AggregatedFlow(.logical_datapaths = set_singleton(logical_datapath),
                .stage = stage,
                .priority = priority,
@@ -1699,8 +1699,8 @@ AggregatedFlow(.logical_datapaths = set_singleton(logical_datapath),
                .actions = actions,
                .tags = tags,
                .external_ids = external_ids) :-
-    TaggedFlow(logical_datapath, stage, priority, __match, actions, tags, external_ids),
-    UseLogicalDatapathGroups[false].
+    UseLogicalDatapathGroups[false],
+    TaggedFlow(logical_datapath, stage, priority, __match, actions, tags, external_ids).
 
 for (f in AggregatedFlow()) {
     var pipeline = if (f.stage.pipeline == Ingress) "ingress" else "egress" in
-- 
2.31.1



More information about the dev mailing list