Re: UDP send costs in Linux

Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com> Wed, 04 April 2018 18:31 UTC

Return-Path: <mikkelfj@gmail.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 97B1E12D77D for <quic@ietfa.amsl.com>; Wed, 4 Apr 2018 11:31:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.709
X-Spam-Level:
X-Spam-Status: No, score=-0.709 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=1.989, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UN2CgWMCS7hr for <quic@ietfa.amsl.com>; Wed, 4 Apr 2018 11:31:55 -0700 (PDT)
Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1019E12D775 for <quic@ietf.org>; Wed, 4 Apr 2018 11:31:55 -0700 (PDT)
Received: by mail-it0-x231.google.com with SMTP id h143-v6so29436199ita.4 for <quic@ietf.org>; Wed, 04 Apr 2018 11:31:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=aDMQsQm1FTYWJqVQxbNTH9k0rA8RcHrNn5Geao/PYEI=; b=ZLEKsPundtdCC0HCr9T7oVn5purnZs/bhYOWNuURT1NFZ8huhhYIYb3kFXLzNd5Lzt VHqfv8VhE4j7LStwIfaFeide8lVDgyCgw/KDbXTkVsU9NHFADk40xP/MGd9eGXgSkBsN lN1QUV9RvH/ghoUum5rw0teiG9GELXoCE8AGqirSpM0OcW8E/lP/oG7qTouXsSAS50lL ZpwrarAY9H6r9QsrG22MSOeA8hYWo4hwO8wNFcZegRUL2I9RajBdOzjXqIgXBVgGdLD4 CWD7FVPS5F1NnSWIblswOTmI05VI74wkIPV0RrA+koQR1HJOuHyMpaLuVcsNlDWi8ZH7 /djw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=aDMQsQm1FTYWJqVQxbNTH9k0rA8RcHrNn5Geao/PYEI=; b=AMB4PGjqELW7sQ5T+cI36y2stwke35sRarNev0bhhyh0PuaBrRz+QoYpvI0zfAYsuf DpL1YNA+uw8AmqZOJ33QB/apc5XSjv4omMx9O61/VpPTcboJH38AFe+g9f26RuKqppIl X/qJmgPunef+1I8Lq3Qgy9ubu0r7zCtHn06pBkf17cU4zK5KU4oULwzRfjAusUO6YjB5 08kAXmT8dFIwkI4zoExcmjRGuhRBgnezLmwzxnUhixRwyQ40FO/t7qTjkTd1KKI2B1Tj 01uqn9CCfpJPXhBC3F5XTFGHtyUgnqmA6xzWml/CUTx7dxMWJfj4Llijwz/Pt/NE3vvS NGtg==
X-Gm-Message-State: ALQs6tAnaCyq1Rfd6tVAvYeGFy19haAU8+fHJaRNmKOG1FPc5uS6jGB6 xnidca++uOmV0ulg3PrIa7aHwxCkC0S+npnw6BrbEA==
X-Google-Smtp-Source: AIpwx49fPksLdd/o3PflnAnBvVZK3YGjP4PbjX6nxkDs2Kw9ZqSod9OYV9vuFExhKxdlDR9nQuUyu1SkMec2xMCiR/s=
X-Received: by 2002:a24:5085:: with SMTP id m127-v6mr11154872itb.118.1522866714373; Wed, 04 Apr 2018 11:31:54 -0700 (PDT)
Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Wed, 4 Apr 2018 20:31:53 +0200
From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= <mikkelfj@gmail.com>
In-Reply-To: <CAJGwveDrW=hg+8ayxu2jSsO3cL4de_fpPeOq27AQNfr2aqBM5Q@mail.gmail.com>
References: <CAKcm_gP4zz1bW5T-_N2Oxy6o5Sw2mEs3DFU9_HrmfkuaJyLz0A@mail.gmail.com> <MWHPR15MB18215781CA00A71CF1AD0137B6A40@MWHPR15MB1821.namprd15.prod.outlook.com> <CAKcm_gO1BdLJOfyQeURWU0jmJo7q9Zft4U9fu1o9py9Bys5NeA@mail.gmail.com> <CAN1APde+YNN0QT0=CDN30qYr6PUinv96zjd10jAYU9-onL5Q9Q@mail.gmail.com> <CAMm+Lwi7XLWECXKhND7gK2JPZUTySu+ZFVXAChMWTgP2XN87BQ@mail.gmail.com> <CY4PR21MB06302D6BC1865A5889759548B6A40@CY4PR21MB0630.namprd21.prod.outlook.com> <CAJGwveDrW=hg+8ayxu2jSsO3cL4de_fpPeOq27AQNfr2aqBM5Q@mail.gmail.com>
X-Mailer: Airmail (420)
MIME-Version: 1.0
Date: Wed, 4 Apr 2018 20:31:53 +0200
Message-ID: <CAN1APdfVyVkNz9PZjUDjL6qHwox1cSKxrXYnUxjpjuAzN3U8Gg@mail.gmail.com>
Subject: Re: UDP send costs in Linux
To: Frederick Kautz <fkautz@alumni.cmu.edu>, Praveen Balasubramanian <pravb=40microsoft.com@dmarc.ietf.org>
Cc: Phillip Hallam-Baker <phill@hallambaker.com>, IETF QUIC WG <quic@ietf.org>, Ian Swett <ianswett@google.com>, Subodh Iyengar <subodh@fb.com>
Content-Type: multipart/alternative; boundary="0000000000008cf2d805690a093e"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/OzM-wR03J0Enq8BU079fBRSLC9c>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Apr 2018 18:31:59 -0000

Got it before, but the reason why netmap and DPDK is important in contrast
to kernel support is the very rich application interfaces that a custom
user space QUIC implementation provides. Spending the next 10 years
discussing epoll vs poll for QUIC is not going to cut it.

OS support that makes it easier to use netmap and friends concurrently with
other network traffic would be welcome though.
Question is what hardware offload support can be given to a custom QUIC
implementation, but one thing that comes to mind is pre-decryption on
netmap where the OS first intercepts the packet and forwards the decrypted
and DoS filtered packet to the app which then handles all the detailed
framing, ACK, pacing etc.

Kind Regards,
Mikkel Fahnøe Jørgensen


On 4 April 2018 at 20.25.07, Frederick Kautz (fkautz@alumni.cmu.edu) wrote:

I apologize to anyone here who gets a repeat of this message, the mailing
list ate my earlier reply because my mail provider changed my default email
address during a transition. Here is the original message:

I agree with this sentiment. If we see traction, then we should see better
kernel support and offloading.

It should be trivial to get this working in something like VPP which can
use DPDK to hw offload, entirely skipping the kernel in the data path.

There are also techniques to bypass the initial memory allocation in the
kernel such as ebpf used by cilium and memif used by vpp.

My main concern at this point would be with cloud native environments with
limited hw offloading support. E.g. if we run in AWS or GCE, better kernel
support will probably be necessary.


On Wed, Apr 4, 2018 at 10:57 AM, Praveen Balasubramanian <
pravb=40microsoft.com@dmarc.ietf.org>; wrote:

> The need to worry is not on the client side – at least not immediately.
> 802.11ad, 802.11ax, and 5G LTE will bring Gigabit rates to client side so
> it is certainly going to become a problem longer term.
>
>
>
> The current worry is on the server side. A large part of the work we do is
> performance optimization of the network stack. Google’s Sigcomm QUIC paper
> shows a 2x CPU increase going from TCP to QUIC. Most web services will NOT
> be able to make that trade off to get latency improvements for 90th
> percentile.
>
>
>
> IMO *improving UDP performance and hardware offloads are absolutely a
> necessity for QUIC to become widely adopted* (not just by the
> biggest corporations with a large budget). We have work under way on both
> these fronts and I am very happy to see Linux also investing here in
> preparation for what’s coming. We need to do our best democratize this
> technology - multiple implementations and performance will both play a big
> role.
>
>
>
>
>
> *From:* QUIC [mailto:quic-bounces@ietf.org] *On Behalf Of* Phillip
> Hallam-Baker
> *Sent:* Wednesday, April 4, 2018 9:29 AM
> *To:* Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>;
> *Cc:* Subodh Iyengar <subodh@fb.com>;; IETF QUIC WG <quic@ietf.org>;; Ian
> Swett <ianswett=40google.com@dmarc.ietf.org>;
> *Subject:* Re: UDP send costs in Linux
>
>
>
> I would not worry too much at this point.
>
>
>
> The reason we want to be able to work at the application level is
> backwards compatibility. It has to be possible to deploy QUIC on any
> machine even without OS support or it won't be deployable.
>
>
>
> It does not have to be performant on every platform. If people are using
> QUIC, whatever needs to be moved into the kernel for performance reasons
> will move there.
>
>
>
>
>
>
>
>
>
> On Wed, Apr 4, 2018 at 11:32 AM, Mikkel Fahnøe Jørgensen <
> mikkelfj@gmail.com>; wrote:
>
> I have no data to add on the Linux UDP stack, but another issue is the
> lack of netmap support in cloud hosting environments.
>
> I have not yet been working with this, but have looked into the problem
> and asked around.
>
>
>
> netmap is default in FreeBSD and optional in Linux. But neither works
> efficiently without a hypervisor patch that is also available for netmap.
> With support for netmap, the user space application can send directly to
> the network adapter with very little overhead. There is also dpdk and some
> other interfaces that might be slightly faster but more vendor specific.
>
>
>
> Assuming an application has access to optimized netmap, the only hurdle is
> address lookup, but if the application also manages that, or at least does
> the caching, there shouldn’t be much in the way of OS interference.
>
>
>
> Of course, netmap blocks the entire network stack, so no PING or SSH.
> CloudFlare added a netmap patch so only some traffic would be routed fra
> the network interface to netmap, and netmap also supports efficient packet
> forwarding to the OS or other applications.
>
>
>
> None of this works well in general, but for a cloud host that can be
> bootet automatically and destroyed rather than serviced, there is some
> opportunity.
>
>
>
> but only if cloud service providers starts adding support their supported
> images and hypervisors. Not sure if any are working on this now.
>
>
>
>
>
> Mikkel
>
>
>
>
>
> On 4 April 2018 at 15.11.17, Ian Swett (ianswett=40google.com@dmarc.
> ietf.org) wrote:
>
> I hope some of these patches will be available soon, but I'm not sure if
> soon is a month or 6.
>
>
>
> On Tue, Apr 3, 2018 at 10:50 PM Subodh Iyengar <subodh@fb.com>; wrote:
>
> Thanks for sharing this Ian.
>
>
>
> This definitely matches some of the observations we've seen as well in the
> UDP write path. Some of the other paths that we saw that added overhead was
> the route table lookup in linux udp stack. Connected UDP sockets did
> amortize that.
>
>
>
> I'm looking forward to a smarter sendmmsg with GSO and zero copy. Is there
> any indication of the timeline for these patches to make it to linux? Would
> be happy to try any of these out to help iron out the API.
>
>
>
> Subodh
> ------------------------------
>
> *From:* QUIC <quic-bounces@ietf.org>; on behalf of Ian Swett <
> ianswett=40google.com@dmarc.ietf..org>
> *Sent:* Tuesday, April 3, 2018 5:20:08 PM
> *To:* IETF QUIC WG
> *Subject:* UDP send costs in Linux
>
>
>
> One challenge with QUIC at the moment is the increased CPU cost of sending
> UDP packets vs TCP payloads.  I've seen this across every platform Google
> has deployed QUIC on, so it's a widespread issue.
>
>
>
> Here's an excellent presentation on what's causing the increased CPU
> consumption on Linux from Willem de Bruijn(UDP starts on slide 9).
>
> http://vger.kernel.org/netconf2017_files/rx_hardening_and_udp_gso.pdf
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.kernel.org%2Fnetconf2017_files%2Frx_hardening_and_udp_gso.pdf&data=02%7C01%7Cpravb%40microsoft.com%7C103a6e81f3684c67382608d59a492c2e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636584561449872935&sdata=FPe0mS5aG%2B88%2FSXvIVSO3yWnXh9tOhQfKkH6XnQDxvE%3D&reserved=0>
>
>
>
> And while you're thinking of CPU usage, it's worth looking at the
> presentation on timing wheel based packet pacing(which is minimum release
> time based) and is ideal for QUIC(and TCP for that matter):
> https://conferences.sigcomm.org/sigcomm/2017/
> files/program/ts-9-4-carousel..pdf
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__conferences.sigcomm.org_sigcomm_2017_files_program_ts-2D9-2D4-2Dcarousel.pdf%26d%3DDwMFaQ%26c%3D5VD0RTtNlTh3ycd41b3MUw%26r%3Dh3Ju9EBS7mHtwg-wAyN7fQ%26m%3DtgghgvFkps7jYaFNdNyZBNFf0epVxFZbOGhhybFwPiE%26s%3D87gOGfz3S0lLbw8jy-lz3M9vPGChkmgtiJVzUxbMfvY%26e%3D&data=02%7C01%7Cpravb%40microsoft.com%7C103a6e81f3684c67382608d59a492c2e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636584561449872935&sdata=hSXXvTODvljI6niBLmMxGUFS9g%2FqOiHskUcNcgHtE6k%3D&reserved=0>
>
>
>
> -Ian
>
>
>