Re: UDP send costs in Linux

Frederick Kautz <fkautz@alumni.cmu.edu> Wed, 04 April 2018 18:25 UTC

Return-Path: <ffk@alumni.cmu.edu>
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 58211126C3D for <quic@ietfa.amsl.com>; Wed, 4 Apr 2018 11:25:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.09
X-Spam-Level:
X-Spam-Status: No, score=0.09 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=1.989, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=alumni-cmu-edu.20150623.gappssmtp.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 YMCBtIykzCOq for <quic@ietfa.amsl.com>; Wed, 4 Apr 2018 11:25:07 -0700 (PDT)
Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (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 90A8F1200C1 for <quic@ietf.org>; Wed, 4 Apr 2018 11:25:07 -0700 (PDT)
Received: by mail-it0-x243.google.com with SMTP id v194-v6so28799293itb.0 for <quic@ietf.org>; Wed, 04 Apr 2018 11:25:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aOl+PIWCiPbgc8IyOhA2yBHfMm+iGXYulFm3D3/C/TA=; b=mNUccYjZJ8wpsF9Z1tL+u3IjDKd9/7rKdrAKGzGZ/LlZCbqyMq+h3jUlxNj0zuq16v ExxM/hLnvirTLFDZpVx698vuRBOeirL5JN2gAgXyOyZXWDLnsb9q2VG6R6n28J3xq6ys WPGsF0cNXb/IhV+IzhRs51mmOrcyKAwCa3Ot8q1hmpKy095xNnOs//1ZEkY9SSjRNWim dGIbCSzZVojPHGarNserSQwIgK4f0a3eVRI0vNKrdNJpax1zbAH/bpdWW2xIXQyk4UIN DPuUvMSjSBnZcHdi7ZdBpU/g1edATNaTBexwE9z1yLep1OjjfID5tNEFMuNOvTwCA46Q 42Qg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aOl+PIWCiPbgc8IyOhA2yBHfMm+iGXYulFm3D3/C/TA=; b=NkrjobkBqtqs4u98HuKVM5a0ggRJ7yvOS0tzzafZq7DZrXg2D1MImIlBMG2ClbfUE4 2tcqBk+o46Qimba/QzuKybLLLOi1yfw34NW8VO9yZhgdwW4pRCXgqJG0aff0lpzc4J29 /r2QU3p7Wp9sYOBBDolhZ9u8GSpZnwsqfhE4U7q+HSTO08qnalc5JwMJ1oBjRNWS552d Me+u+gUYAJIQSTDYwIwMHfx9mUGk9jCYjVYyQibapsUyxnTvbD1JxFU9r0lLlzOAlJ3E D28oulB9Pj2XinBKiHYtVUq1rzoWl1XppHnR8RYYp5jsoqIu+41++lBj447F6RRx0pbm +Aeg==
X-Gm-Message-State: ALQs6tDrO4mXb7deUrN2tHUM+UhAJb/vrIN5NoMUVk68JS9a/qurVMbU QIOoKWY0bjsPUnjwsmoUb+SkbA9z4UQHHgmDTkmBLA==
X-Google-Smtp-Source: AIpwx4+LmUN0jTyyLMLDGrwtIio4XdfbNAjfS2W5e9yxYnYPoAunaLxiuxtTgdXJATPB67fcOG1QpC9Sdiwe5OH8D9w=
X-Received: by 2002:a24:ec8:: with SMTP id 191-v6mr11374994ite.42.1522866306836; Wed, 04 Apr 2018 11:25:06 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.107.38.11 with HTTP; Wed, 4 Apr 2018 11:25:06 -0700 (PDT)
In-Reply-To: <CY4PR21MB06302D6BC1865A5889759548B6A40@CY4PR21MB0630.namprd21.prod.outlook.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>
From: Frederick Kautz <fkautz@alumni.cmu.edu>
Date: Wed, 04 Apr 2018 11:25:06 -0700
Message-ID: <CAJGwveDrW=hg+8ayxu2jSsO3cL4de_fpPeOq27AQNfr2aqBM5Q@mail.gmail.com>
Subject: Re: UDP send costs in Linux
To: Praveen Balasubramanian <pravb=40microsoft.com@dmarc.ietf.org>
Cc: Phillip Hallam-Baker <phill@hallambaker.com>, Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>, Ian Swett <ianswett@google.com>, Subodh Iyengar <subodh@fb.com>, IETF QUIC WG <quic@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000004280cc056909f1d4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/zrpIJlaXhqmK4ogSdzA0ao64TH4>
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:25:11 -0000

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
>
>
>