Sending on behalf of David Wilder dwild...@linux.vnet.ibm.com, since his
email was stuck waiting for moderator approval.
Hi-
I have been conducting scaling tests with OVS and docker. My tests
revealed that the latency of ARP packets can become very large
resulting in many ARP re-transmissions and time-outs. I found the
source of the poor latency to be with the handling of arp packets in
ovs_vport_find_upcall_portid(). Each packet is hashed in
ovs_vport_find_upcall_portid() by calling skb_get_hash(). This hash
is used to select a netlink socket in which to send the packet to
userspace. However, skb_get_hash() is not supporting ARP packets
returning a 0 (invalid hash) for every ARP. This results in a single
ovs-vswitchd handler thread processing every arp packet thus severely
impacting the average latency of ARPs. I am purposing a change to
ovs_vport_find_upcall_portid() that spreads the ARP packets evenly
between all the handler threads (patch to follow). Please let me know
if you have suggestions/comments.
I conducted tests to measure the latency of packets taking the "slow
path". I measured latency by adding a unique identifier to packets in
the openvswitch kernel modules (ovs_dp_upcall() ). I tagged all
packets as they are sent to ovs-vswitchd. Using a kprobe I record the
value of jiffies when each packet is sent to userspace and again when
the packet is returned to the kernel (ovs_packet_cmd_execute() ). In
addition I placed a user-probe in ovs-vswitchd to record jiffies when
the packet is read by ovs-vswitchd (read_upcalls() ).
Versions Tested:
ovs_version: "2.4.90"
openvswitch module from a 3.19.6 kernel (ubuntu 15.4)
My benchmark creates 512 containers and runs a single iperf (TCP
bandwidth test) in each. Ovs-vswitchd created 60 handler threads. I
flushed the neighbor cache prior to each benchmark run to simulate the
worse case or a start-up environment.
These charts show 3 latencies: kernel to user, user to kernel and
kernel to kernel (RTT). Separate results are shown for all packet
types, IPv4 packets and ARP packets. Note: these are not port-to-port
switch performance measurements, only packets sent to user-space are
measured.
Before the patch
================
We observe the latency of arps is much greater than that of ipv4
packets (1058 vs. 5). The majority of the latency is from the kernel
to user portion of the path.
All Packets:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 2144 0 2001 945
K-2-OVS 2144 0 1995 904
OVS-2-K 2144 0 914 40
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 |@@@@@ 123
1 |@@@ 70
2 |@ 31
4 | 15
8 | 14
16 |@ 33
32 |@@ 52
64 |@@@ 87
128 |@@@@@@ 132
256 |@@@@@@@@ 184
512 |@@@@@@@@@@@@@@ 325
1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1078
2048 | 0
4096 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@@@@@@@ 169
1 |@@ 57
2 | 19
4 |@ 32
8 |@@ 60
16 |@ 25
32 |@@ 64
64 |@ 36
128 |@@@@@@ 132
256 |@@@@@@@@@ 212
512 |@@@@@@@@@@@@ 282
1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1056
2048 | 0
4096 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@ 204
1 |@@@@@@@@@@@@@@@@ 181
2 |@@@@@@@@@@@@@@@@@@@@@@@ 258
4 |@@@@@@@@@@@@@@@@@@@@@@@@ 273
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 550
16 |@@@@@@@@@@@@@@@@@@@@@@@ 258
32 |@@@@@@@@@@ 114
64 |@@@@@@@@@@@@@@@@ 180
128 |@@ 32
256 |@@@@@ 63
512 |@@ 31
1024 | 0
2048 | 0
ARP Packet:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 1914 0 2001 1058
K-2-OVS 1914 0 1995 1013
OVS-2-K 1914 0 914 45
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 | 21
1 | 17
2 | 11
4 | 1
8 | 4
16 | 15
32 |@ 39
64 |@@@ 87
128 |@@@@@@ 132
256 |@@@@@@@@ 184
512 |@@@@@@@@@@@@@@ 325
1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1078
2048 | 0
4096 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@ 38
1 | 11
2 | 7
4 | 19
8 |@@ 44
16 | 18
32 |@@ 59
64 |@ 36
128 |@@@@@@ 132
256 |@@@@@@@@@ 212
512 |@@@@@@@@@@@@ 282
1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1056
2048 | 0
4096 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@ 47
1 |@@@@@@@@@@@@@ 147
2 |@@@@@@@@@@@@@@@@@@@@@@ 252
4 |@@@@@@@@@@@@@@@@@@@@@@@ 261
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 538
16 |@@@@@@@@@@@@@@@@@@@@@@ 251
32 |@@@@@@@@@@ 112
64 |@@@@@@@@@@@@@@@@ 180
128 |@@ 32
256 |@@@@@ 63
512 |@@ 31
1024 | 0
2048 | 0
IPV4 Packets:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 230 0 53 5
K-2-OVS 230 0 44 2
OVS-2-K 230 0 50 2
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 102
1 |@@@@@@@@@@@@@@@@@ 53
2 |@@@@@@ 20
4 |@@@@ 14
8 |@@@ 10
16 |@@@@@@ 18
32 |@@@@ 13
64 | 0
128 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 131
1 |@@@@@@@@@@@@@@@ 46
2 |@@@@ 12
4 |@@@@ 12
8 |@@@@@ 17
16 |@@ 7
32 |@ 5
64 | 0
128 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 158
1 |@@@@@@@@ 33
2 |@ 7
4 |@@ 11
8 |@@@ 12
16 |@ 7
32 | 2
64 | 0
128 | 0
This last histogram shows the value of n_upcalls as returned by
recv_upcalls() for all packets. UPCALL_MAX_BATCH=64 therefor anytime
n_upcalls reaches 64 the number packets waiting to be processes is 64
or greater.
base-2 logarithmic histogram of queue size
n_upcalls stats: Number of samples=282 min=1 max=64 avg=7
value |-------------------------------------------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 223
2 |@@@@ 24
4 | 3
8 | 2
16 | 1
32 | 1
64 |@@@@@ 28
128 | 0
256 | 0
Additional debug (not shown here) showed that all arp packets were
handled by a single handler thread.
After the Patch
===============
The overall performance between IPv4 packet and ARP packets is now
balanced. Average round-trip latency for ARPs went from 1058 to 243.
Notice that the latency of the ipv4 packets suffer from this change,
this occurs because all packets are now competing for the same
resources. My benchmark generates more arp packets sent to
ovs-vswitchd than ipv4 packets contributing to the increase in ipv4
latency. Note that the number of arp packets (See COUNT) has
decreased from 1914 to 865, this is due the the significant reduction
of arp re-transmissions caused by the large latency.
All Packets:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 1495 0 1859 199
K-2-OVS 1495 0 1029 98
OVS-2-K 1495 0 1829 101
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 252
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 182
2 |@@@@@@@@@@@@@@ 88
4 |@@@@@@@@@@@@ 75
8 |@@@@@@@@@@@@@@@ 93
16 |@@@@@@@@@@@@@@@@ 98
32 |@@@@@@@@@@@@@@@@@@@ 114
64 |@@@@@@@@@@@@@@@@@@ 110
128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 166
256 |@@@@@@@@@@@@@@@@@@@@ 123
512 |@@@@@@@@@@@@@@@@@ 103
1024 |@@@@@@@@@@@@@@@ 91
2048 | 0
4096 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 384
1 |@@@@@@@@@@@@@@@@@@@@@@@@ 199
2 |@@@@@@@@ 67
4 |@@@@@@@@ 66
8 |@@@@@@@@@@@ 89
16 |@@@@@@@@@@@@ 100
32 |@@@@@@@@@@@@ 103
64 |@@@@@@@@@@@@ 100
128 |@@@@@@@@@@@@@@@@@@@@ 162
256 |@@@@@@@@@@@@@@@@@@@ 156
512 |@@@@@@@@ 68
1024 | 1
2048 | 0
4096 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 587
1 |@@@@@@@@@@ 122
2 |@@@@@@@ 88
4 |@@@@@@@@ 100
8 |@@@@@@@ 86
16 |@@@@@@@ 89
32 |@@@@@@@ 91
64 |@@@@@@@@ 107
128 |@@@@ 58
256 |@@@@@ 60
512 |@@@@@ 70
1024 |@@@ 37
2048 | 0
4096 | 0
ARP Packet:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 865 0 1859 243
K-2-OVS 865 0 877 111
OVS-2-K 865 0 1829 131
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 91
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 52
4 |@@@@@@@@@@@@@@@@@@@@@ 42
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 64
16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 60
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 76
64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 78
128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 100
256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 71
512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 76
1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 69
2048 | 0
4096 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 168
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 123
2 |@@@@@@@@@ 37
4 |@@@@@@@@ 34
8 |@@@@@@@@@@@@@ 54
16 |@@@@@@@@@@@@@@@@@ 70
32 |@@@@@@@@@@@@@@@@@ 70
64 |@@@@@@@@@@@@@@@@ 64
128 |@@@@@@@@@@@@@@@@@@@@@@@ 94
256 |@@@@@@@@@@@@@@@@@@@@@@@@@ 101
512 |@@@@@@@@@@@@ 50
1024 | 0
2048 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 247
1 |@@@@@@@@@@@@@@ 72
2 |@@@@@@@@@@@ 57
4 |@@@@@@@@@@@ 58
8 |@@@@@@@@@@@@@@ 70
16 |@@@@@@@@@@@ 56
32 |@@@@@@@@@@@@ 62
64 |@@@@@@@@@@@@@@@ 77
128 |@@@@@@@@ 42
256 |@@@@@@@ 38
512 |@@@@@@@@@@@ 58
1024 |@@@@@ 28
2048 | 0
4096 | 0
IPV4 Packets:
Time: COUNT MIN MAX AVERAGE
-----------------------------------------------------------------------------
RTT 630 0 1820 139
K-2-OVS 630 0 1029 80
OVS-2-K 630 0 1739 58
-----------------------------------------------------------------------------
base-2 logarithmic histogram of round trip times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 166
1 |@@@@@@@@@@@@@@@@@@@@@@ 91
2 |@@@@@@@@@ 36
4 |@@@@@@@@ 33
8 |@@@@@@@ 29
16 |@@@@@@@@@ 38
32 |@@@@@@@@@ 38
64 |@@@@@@@@ 32
128 |@@@@@@@@@@@@@@@@ 66
256 |@@@@@@@@@@@@@ 52
512 |@@@@@@ 27
1024 |@@@@@ 22
2048 | 0
4096 | 0
base-2 logarithmic histogram of kernel to ovs times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 214
1 |@@@@@@@@@@@@@@@ 78
2 |@@@@@@ 30
4 |@@@@@@ 32
8 |@@@@@@@ 35
16 |@@@@@@ 30
32 |@@@@@@ 33
64 |@@@@@@@ 36
128 |@@@@@@@@@@@@@ 68
256 |@@@@@@@@@@@ 55
512 |@@@ 18
1024 | 1
2048 | 0
4096 | 0
base-2 logarithmic histogram of ovs to kernel times
value |-------------------------------------------------- count
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 341
1 |@@@@@@@ 49
2 |@@@@ 31
4 |@@@@@@ 42
8 |@@ 16
16 |@@@@ 33
32 |@@@@ 29
64 |@@@@ 30
128 |@@ 16
256 |@@@ 22
512 |@ 12
1024 |@ 9
2048 | 0
4096 | 0
The backlog of packets is significantly reduced.
base-2 logarithmic histogram of queue size
n_upcalls stats: Number of samples=930 min=1 max=50 avg=1
value |-------------------------------------------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 770
2 |@@@@@@ 107
4 |@@ 34
8 | 14
16 | 3
32 | 2
64 | 0
128 | 0
_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss