diff options
author | Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com> | 2020-05-22 10:50:05 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2020-06-22 13:11:51 +0200 |
commit | 9df65060cf4c27553ee5e29f74ef6807dd5af992 (patch) | |
tree | 45cd3f9870c75d5330a9a73ceb7da87c8779e971 /vswitchd/vswitch.xml | |
parent | 1fe42975639854bc6cf4784b2554b438301c0b92 (diff) | |
download | openvswitch-9df65060cf4c27553ee5e29f74ef6807dd5af992.tar.gz |
userspace: Avoid dp_hash recirculation for balance-tcp bond mode.
Problem:
In OVS, flows with output over a bond interface of type “balance-tcp”
gets translated by the ofproto layer into "HASH" and "RECIRC" datapath
actions. After recirculation, the packet is forwarded to the bond
member port based on 8-bits of the datapath hash value computed through
dp_hash. This causes performance degradation in the following ways:
1. The recirculation of the packet implies another lookup of the
packet’s flow key in the exact match cache (EMC) and potentially
Megaflow classifier (DPCLS). This is the biggest cost factor.
2. The recirculated packets have a new “RSS” hash and compete with the
original packets for the scarce number of EMC slots. This implies more
EMC misses and potentially EMC thrashing causing costly DPCLS lookups.
3. The 256 extra megaflow entries per bond for dp_hash bond selection
put additional load on the revalidation threads.
Owing to this performance degradation, deployments stick to “balance-slb”
bond mode even though it does not do active-active load balancing for
VXLAN- and GRE-tunnelled traffic because all tunnel packet have the
same source MAC address.
Proposed optimization:
This proposal introduces a new load-balancing output action instead of
recirculation.
Maintain one table per-bond (could just be an array of uint16's) and
program it the same way internal flows are created today for each
possible hash value (256 entries) from ofproto layer. Use this table to
load-balance flows as part of output action processing.
Currently xlate_normal() -> output_normal() ->
bond_update_post_recirc_rules() -> bond_may_recirc() and
compose_output_action__() generate 'dp_hash(hash_l4(0))' and
'recirc(<RecircID>)' actions. In this case the RecircID identifies the
bond. For the recirculated packets the ofproto layer installs megaflow
entries that match on RecircID and masked dp_hash and send them to the
corresponding output port.
Instead, we will now generate action as
'lb_output(<bond id>)'
This combines hash computation (only if needed, else re-use RSS hash)
and inline load-balancing over the bond. This action is used *only* for
balance-tcp bonds in userspace datapath (the OVS kernel datapath
remains unchanged).
Example:
Current scheme:
With 8 UDP flows (with random UDP src port):
flow-dump from pmd on cpu core: 2
recirc_id(0),in_port(7),<...> actions:hash(hash_l4(0)),recirc(0x1)
recirc_id(0x1),dp_hash(0xf8e02b7e/0xff),<...> actions:2
recirc_id(0x1),dp_hash(0xb236c260/0xff),<...> actions:1
recirc_id(0x1),dp_hash(0x7d89eb18/0xff),<...> actions:1
recirc_id(0x1),dp_hash(0xa78d75df/0xff),<...> actions:2
recirc_id(0x1),dp_hash(0xb58d846f/0xff),<...> actions:2
recirc_id(0x1),dp_hash(0x24534406/0xff),<...> actions:1
recirc_id(0x1),dp_hash(0x3cf32550/0xff),<...> actions:1
New scheme:
We can do with a single flow entry (for any number of new flows):
in_port(7),<...> actions:lb_output(1)
A new CLI has been added to dump datapath bond cache as given below.
# ovs-appctl dpif-netdev/bond-show [dp]
Bond cache:
bond-id 1 :
bucket 0 - slave 2
bucket 1 - slave 1
bucket 2 - slave 2
bucket 3 - slave 1
Co-authored-by: Manohar Krishnappa Chidambaraswamy <manukc@gmail.com>
Signed-off-by: Manohar Krishnappa Chidambaraswamy <manukc@gmail.com>
Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Tested-by: Matteo Croce <mcroce@redhat.com>
Tested-by: Adrian Moreno <amorenoz@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'vswitchd/vswitch.xml')
-rw-r--r-- | vswitchd/vswitch.xml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 6d334370d..b6acb34ca 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1994,6 +1994,15 @@ <code>active-backup</code>. </column> + <column name="other_config" key="lb-output-action" + type='{"type": "boolean"}'> + Enable/disable usage of optimized <code>lb_output</code> action for + balancing flows among output slaves in load balanced bonds in + <code>balance-tcp</code>. When enabled, it uses optimized path for + balance-tcp mode by using rss hash and avoids recirculation. + This knob does not affect other balancing modes. + </column> + <group title="Link Failure Detection"> <p> An important part of link bonding is detecting that links are down so @@ -5812,6 +5821,19 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \ higher performance for MPLS and active-active load balancing bonding modes. </column> + <column name="capabilities" key="lb_output_action" + type='{"type": "boolean"}'> + If this is true, then the datapath supports optimized balance-tcp + bond mode. This capability replaces existing <code>hash</code> and + <code>recirc</code> actions with new action <code>lb_output</code> + and avoids recirculation of packet in datapath. It is supported + only for balance-tcp bond mode in netdev datapath. The new action + gives higer performance by using bond buckets instead of post + recirculation flows for selection of slave port from bond. By default + this new action is disabled, however it can be enabled by setting + <ref column="other-config" key="lb-output-action"/> in + <ref table="Port"/> table. + </column> <group title="Connection-Tracking Capabilities"> <p> These capabilities are granular because Open vSwitch and its |