2018-05-22 18:00:47

by William Kucharski

[permalink] [raw]
Subject: Regression: Approximate 34% performance hit in receive throughput over ixgbe seen due to build_skb patch

A performance hit of approximately 34% in receive numbers for some packet sizes is
seen when testing traffic over ixgbe links using the network test netperf.

Starting with the top of tree commit 7addb3e4ad3db6a95a953c59884921b5883dcdec,
a git bisect narrowed the issue down to:

commit 6f429223b31c550b835b4f066ac034d0cf0cc71e

ixgbe: Add support for build_skb

This patch adds build_skb support to the Rx path. There are several
advantages to this change.

1. It avoids the memcpy and skb->head allocation for small packets which
improves performance by about 5% in my tests.
2. It avoids the memcpy, skb->head allocation, and eth_get_headlen
for larger packets improving performance by about 10% in my tests.
3. For VXLAN packets it allows the full header to be in skb->data which
improves the performance by as much as 30% in some of my tests.

Netperf was sourced from:

https://hewlettpackard.github.io/netperf/

Two machines were directly connected via ixgbe links.

The process "netserver" was started on 10.196.11.8, and running this test:

# netperf -l 60 -H 10.196.11.8 -i 10,2 -I 99,10 -t UDP_STREAM -- -m 64 -s 32768 -S 32768

showed that on machines without the patch, we typically see performance
like:

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 35435847 0 302.38 <-- SEND
65536 60.00 35391087 302.00 <-- RECEIVE

or

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 33708816 0 287.65
65536 60.00 33706010 287.62


However, on machines with the patch, receive performance is seen to fall by an
average of 34%, e.g.:

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 35179881 0 300.20
65536 60.00 21418471 182.77

or

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 36937716 0 315.20
65536 60.00 16838656 143.69

William Kucharski
[email protected]





2018-05-22 18:24:24

by Alexander Duyck

[permalink] [raw]
Subject: Re: Regression: Approximate 34% performance hit in receive throughput over ixgbe seen due to build_skb patch

On Tue, May 22, 2018 at 11:00 AM, William Kucharski
<[email protected]> wrote:
> A performance hit of approximately 34% in receive numbers for some packet sizes is
> seen when testing traffic over ixgbe links using the network test netperf.
>
> Starting with the top of tree commit 7addb3e4ad3db6a95a953c59884921b5883dcdec,
> a git bisect narrowed the issue down to:
>
> commit 6f429223b31c550b835b4f066ac034d0cf0cc71e
>
> ixgbe: Add support for build_skb
>
> This patch adds build_skb support to the Rx path. There are several
> advantages to this change.
>
> 1. It avoids the memcpy and skb->head allocation for small packets which
> improves performance by about 5% in my tests.
> 2. It avoids the memcpy, skb->head allocation, and eth_get_headlen
> for larger packets improving performance by about 10% in my tests.
> 3. For VXLAN packets it allows the full header to be in skb->data which
> improves the performance by as much as 30% in some of my tests.
>
> Netperf was sourced from:
>
> https://hewlettpackard.github.io/netperf/
>
> Two machines were directly connected via ixgbe links.
>
> The process "netserver" was started on 10.196.11.8, and running this test:
>
> # netperf -l 60 -H 10.196.11.8 -i 10,2 -I 99,10 -t UDP_STREAM -- -m 64 -s 32768 -S 32768

Okay, so I can already see what the most likely issue is. The
build_skb code is more CPU efficient, but it will consume more memory
in the process since it is avoiding the memcpy and is instead using a
full 2K block of memory for a small frame. I'm suspecting any
performance issue you are seeing may be due to a slow interrupt rate
causing us to either exhaust available Tx memory, or overrun the
available Rx memory.

There end up being multiple ways to address this.
1. Use a larger value for your "-s/-S" values to allow for more memory
to be handled in the queues.
2. Update the interrupt moderation code for the driver. You can either
manually decrease the per-interrupt delay via "ethtool -C" or just
update the adaptive ITR code, see commit b4ded8327fea ("ixgbe: Update
adaptive ITR algorithm").
3. There should be a private flag that can be updated via "ethtool
--set-priv-flags" called "legacy-rx" that you can enable that will
roll back to the original that did the copy-break type approach for
small packets and the headers of the frame.

Thanks.

- Alex

2018-05-22 19:30:42

by William Kucharski

[permalink] [raw]
Subject: Re: Regression: Approximate 34% performance hit in receive throughput over ixgbe seen due to build_skb patch



> On May 22, 2018, at 12:23 PM, Alexander Duyck <[email protected]> wrote:
>
> 3. There should be a private flag that can be updated via "ethtool
> --set-priv-flags" called "legacy-rx" that you can enable that will
> roll back to the original that did the copy-break type approach for
> small packets and the headers of the frame.

With legacy-rx enabled, most of the regression goes away, but it's still present
as compared to the code without the patch; the regression then drops to about 6%:

# ethtool --show-priv-flags eno1
Private flags for eno1:
legacy-rx: on

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 35934709 0 306.64
65536 60.00 33791739 288.35

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec

65536 64 60.00 39254351 0 334.97
65536 60.00 36761069 313.69

Is this variance to be expected, or do you think modification of the
interrupt delay would achieve better results?


William Kucharski


2018-05-22 20:09:02

by Alexander Duyck

[permalink] [raw]
Subject: Re: Regression: Approximate 34% performance hit in receive throughput over ixgbe seen due to build_skb patch

On Tue, May 22, 2018 at 12:29 PM, William Kucharski
<[email protected]> wrote:
>
>
>> On May 22, 2018, at 12:23 PM, Alexander Duyck <[email protected]> wrote:
>>
>> 3. There should be a private flag that can be updated via "ethtool
>> --set-priv-flags" called "legacy-rx" that you can enable that will
>> roll back to the original that did the copy-break type approach for
>> small packets and the headers of the frame.
>
> With legacy-rx enabled, most of the regression goes away, but it's still present
> as compared to the code without the patch; the regression then drops to about 6%:
>
> # ethtool --show-priv-flags eno1
> Private flags for eno1:
> legacy-rx: on
>
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 65536 64 60.00 35934709 0 306.64
> 65536 60.00 33791739 288.35
>
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 65536 64 60.00 39254351 0 334.97
> 65536 60.00 36761069 313.69
>
> Is this variance to be expected, or do you think modification of the
> interrupt delay would achieve better results?
>
>
> William Kucharski
>

I would think with modification of interrupt delay you could probably
do much better if my assumption is correct and the issue is us sitting
on packets for too long so we overrun the socket buffer and start
dropping packets or stalling the Tx.

Thanks.

- Alex