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

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Wed Jul 14 08:33:30 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.

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 ceeabe6f3..46280e22e 100644
--- a/northd/ovn_northd.dl
+++ b/northd/ovn_northd.dl
@@ -1659,17 +1659,17 @@ AggregatedFlow(.logical_datapaths = g.to_set(),
                .__match = __match,
                .actions = actions,
                .external_ids = external_ids) :-
+    UseLogicalDatapathGroups[true],
     Flow(logical_datapath, stage, priority, __match, actions, external_ids),
-    var g = logical_datapath.group_by((stage, priority, __match, actions, external_ids)),
-    UseLogicalDatapathGroups[true].
+    var g = logical_datapath.group_by((stage, priority, __match, actions, external_ids)).
 AggregatedFlow(.logical_datapaths = set_singleton(logical_datapath),
                .stage = stage,
                .priority = priority,
                .__match = __match,
                .actions = actions,
                .external_ids = external_ids) :-
-    Flow(logical_datapath, stage, priority, __match, actions, external_ids),
-    UseLogicalDatapathGroups[false].
+    UseLogicalDatapathGroups[false],
+    Flow(logical_datapath, stage, priority, __match, actions, 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