New configuration knob: ovn-nbctl set NB_Global . options:use_logical_dp_groups=true
Feature disabled by default, because it could cause performance issues on ovn-controller side, specifically, if you have a lot of logical switches or routers local to the same node, i.e. handled by the same ovn-controller process. Added a unit test for northd. Signed-off-by: Ilya Maximets <i.maxim...@ovn.org> --- NEWS | 5 +++ northd/ovn-northd.c | 2 ++ ovn-nb.xml | 20 ++++++++++++ tests/ovn-northd.at | 74 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) diff --git a/NEWS b/NEWS index 28d50b5ec..08639401f 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,11 @@ Post-v20.09.0 ovn-controller will not process any DB changes. - Add "fair" column in Meter table to allow multiple ACL logs to use the same Meter while being rate-limited independently. + - New configuration option for northd 'options:use_logical_dp_groups=true' + to enable combining of logical flows by logical datapath. This should + significantly decrease size of a Southbound DB. However, in some cases, + it could have performance penalty for ovn-controller. Disabled by + default. OVN v20.09.0 - 28 Sep 2020 -------------------------- diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index be6cb4201..c0eab429d 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -12301,6 +12301,8 @@ ovnnb_db_run(struct northd_context *ctx, northd_probe_interval_nb = get_probe_interval(ovnnb_db, nb); northd_probe_interval_sb = get_probe_interval(ovnsb_db, nb); + use_logical_dp_groups = smap_get_bool(&nb->options, + "use_logical_dp_groups", false); controller_event_en = smap_get_bool(&nb->options, "controller_event", false); check_lsp_is_up = !smap_get_bool(&nb->options, diff --git a/ovn-nb.xml b/ovn-nb.xml index a457b9cee..efad1afa6 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -193,6 +193,26 @@ </p> </column> + <column name="options" key="use_logical_dp_groups"> + <p> + If set to <code>true</code>, <code>ovn-northd</code> will combine + logical flows that differs only by logical datapath into a single + logical flow with logical datapath group attached. + </p> + <p> + While this should significantly reduce number of logical flows stored + in Southbound database this could also increase processing complexity + on the <code>ovn-controller</code> side, e.g., + <code>ovn-controller</code> will re-consider logical flow for all + logical datapaths in a group. If the option set to + <code>false</code>, there will be separate logical flow per logical + datapath and only this flow will be re-considered. + </p> + <p> + The default value is <code>false</code>. + </p> + </column> + <column name="options" key="ignore_lsp_down"> <p> If set to false, ARP/ND reply flows for logical switch ports will be diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index f244801e1..25c0f027e 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -2099,3 +2099,77 @@ ovn-nbctl --wait=sb lb-del lb1 check_column "$lb0_uuid" sb:datapath_binding load_balancers external_ids:name=sw1 AT_CLEANUP + +AT_SETUP([ovn -- logical gatapath groups]) +AT_KEYWORDS([use_logical_dp_groups]) +ovn_start + +dnl Disabling datapath groups. +ovn-nbctl --wait=sb set NB_Global . options:use_logical_dp_groups=false + +ovn-nbctl ls-add sw1 +ovn-nbctl ls-add sw2 +ovn-nbctl lsp-add sw1 swp1 +ovn-nbctl lsp-add sw2 swp2 +ovn-nbctl --wait=sb sync + +sw1_sb_uuid=$(fetch_column datapath_binding _uuid external_ids:name=sw1) +sw2_sb_uuid=$(fetch_column datapath_binding _uuid external_ids:name=sw2) + +dnl Check that we have no datapath groups. +check_row_count Logical_DP_Group 0 + +dnl Number of logical flows that depends on logical switch or multicast group. +dnl These will not be combined. +n_flows_specific=$(ovn-sbctl --bare find Logical_Flow | grep -cE 'swp|_MC_') +echo "Number of specific flows: "${n_flows_specific} + +dnl Both logical switches configured identically, so there should be same +dnl number of logical flows per logical switch/logical datapath. +n_flows=$(count_rows Logical_Flow) +echo "Total number of flows with datapath groups disabled: "${n_flows} +n_flows_half=$((${n_flows} / 2)) +check_row_count Logical_Flow ${n_flows_half} logical_datapath=${sw1_sb_uuid} +check_row_count Logical_Flow ${n_flows_half} logical_datapath=${sw2_sb_uuid} + +dnl Enabling datapath groups. +ovn-nbctl --wait=sb set NB_Global . options:use_logical_dp_groups=true + +dnl Check that one datapath group created. +check_row_count Logical_DP_Group 1 +dp_group_uuid=$(fetch_column logical_dp_group _uuid) + +dnl Check that doatapath group contains both datapaths. +check_column "${sw1_sb_uuid} ${sw2_sb_uuid}" Logical_DP_Group datapaths + +dnl Calculating number of flows that should be combined for a datapath group. +n_flows=$(count_rows Logical_Flow) +echo "Total number of flows with datapath groups enabled: "${n_flows} +n_flows_common=$((${n_flows} - ${n_flows_specific})) + +check_row_count Logical_Flow ${n_flows_common} logical_dp_group=${dp_group_uuid} +check_row_count Logical_Flow ${n_flows_common} logical_datapath=[[]] +check_row_count Logical_Flow ${n_flows_common} \ + logical_dp_group=${dp_group_uuid} logical_datapath=[[]] + +dnl Adding 8 more logical switches and ports. +for i in $(seq 3 10); do + ovn-nbctl ls-add sw${i} + ovn-nbctl lsp-add sw${i} swp${i} +done +ovn-nbctl --wait=sb sync + +dnl Number of logical flows should be increased only due to specific flows. +expected_n_flows=$((${n_flows_common} + 5 * ${n_flows_specific})) +echo "Total number of flows with 10 logical switches should be: " \ + ${expected_n_flows} +check_row_count Logical_Flow ${expected_n_flows} + +dnl Should be still only one datapath group. +check_row_count Logical_DP_Group 1 +dp_group_uuid=$(fetch_column logical_dp_group _uuid) + +dnl Number of common flows should be the same. +check_row_count Logical_Flow ${n_flows_common} logical_dp_group=${dp_group_uuid} + +AT_CLEANUP -- 2.25.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev