RE: UDP send costs in Linux

Praveen Balasubramanian <pravb@microsoft.com> Wed, 04 April 2018 17:57 UTC

Return-Path: <pravb@microsoft.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from ietfa.amsl.com (localhost [IPv6:::1]) by ietfa.amsl.com (Postfix) with ESMTP id 69B1C12D779 for <quic@ietfa.amsl.com>; Wed, 4 Apr 2018 10:57:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1; t=1522864649; bh=23+wXo1YEQpHG1QP2RyLEpec7LDRpIbcPoGHQpDJBmE=; h=From:To:Subject:Date:References:In-Reply-To:Cc:Cc:Cc; b=u5AC4sQtE9vV9lZlY7LSMaLeTIuzo7wF6XEvSwVYcs6tKgt74w+TvyE/9N/XT/0FT qVZncf4KSfkL750/3mRYw8AZbUW6v3VRS2Z9DHK8kuRe0MDJdDY5M3XCFFRgs8O5po otRPl6bAWOm4HmPIOBbR2U2U941hW8ZYcZWYP/oo=
X-Mailbox-Line: From pravb@microsoft.com Wed Apr 4 10:57:29 2018
Received: from ietfa.amsl.com (localhost [IPv6:::1]) by ietfa.amsl.com (Postfix) with ESMTP id 0750A129C6E; Wed, 4 Apr 2018 10:57:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1; t=1522864649; bh=23+wXo1YEQpHG1QP2RyLEpec7LDRpIbcPoGHQpDJBmE=; h=From:To:Subject:Date:References:In-Reply-To:Cc:Cc:Cc; b=u5AC4sQtE9vV9lZlY7LSMaLeTIuzo7wF6XEvSwVYcs6tKgt74w+TvyE/9N/XT/0FT qVZncf4KSfkL750/3mRYw8AZbUW6v3VRS2Z9DHK8kuRe0MDJdDY5M3XCFFRgs8O5po otRPl6bAWOm4HmPIOBbR2U2U941hW8ZYcZWYP/oo=
X-Original-To: dmarc-reverse@ietfa.amsl.com
Delivered-To: dmarc-reverse@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D2E1412AF84 for <dmarc-reverse@ietfa.amsl.com>; Wed, 4 Apr 2018 10:57:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.011
X-Spam-Level:
X-Spam-Status: No, score=-0.011 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=1.989, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=microsoft.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 bEgluOj11zl2 for <dmarc-reverse@ietfa.amsl.com>; Wed, 4 Apr 2018 10:57:25 -0700 (PDT)
Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on071d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::71d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5BF81129C6E for <ianswett=40google.com@dmarc.ietf.org>; Wed, 4 Apr 2018 10:57:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=23+wXo1YEQpHG1QP2RyLEpec7LDRpIbcPoGHQpDJBmE=; b=oBeeUWpYDQwOrnhagtTYdQFNXH4klW9bZ7HD2SdGyEiCnP4QpUT09DwiovQpHq7vlpebwjECsN4bWxnO93+4LslH/MOB+Zy1hUEdjxkGn1Y9xJN4LNkKQxuqyAhQ8YZLLGds8gza3+NkSxgwP+UgAuyFKxGbcxKBoDI1PxmbAJw=
Received: from CY4PR21MB0630.namprd21.prod.outlook.com (10.175.115.20) by CY4PR21MB0280.namprd21.prod.outlook.com (10.173.193.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.675.1; Wed, 4 Apr 2018 17:57:23 +0000
Received: from CY4PR21MB0630.namprd21.prod.outlook.com ([fe80::de:ba33:4748:51da]) by CY4PR21MB0630.namprd21.prod.outlook.com ([fe80::de:ba33:4748:51da%6]) with mapi id 15.20.0675.003; Wed, 4 Apr 2018 17:57:23 +0000
From: Praveen Balasubramanian <pravb@microsoft.com>
To: Phillip Hallam-Baker <phill@hallambaker.com>, =?utf-8?B?TWlra2VsIEZhaG7DuGUgSsO4cmdlbnNlbg==?= <mikkelfj@gmail.com>
Subject: RE: UDP send costs in Linux
Thread-Topic: UDP send costs in Linux
Thread-Index: AQHTy6q+3JsicRIxhkabCq/gojpid6Pv6A6AgACtVICAACezAIAAD5iAgAAXAKA=
Date: Wed, 4 Apr 2018 17:57:22 +0000
Message-ID: <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>
In-Reply-To: <CAMm+Lwi7XLWECXKhND7gK2JPZUTySu+ZFVXAChMWTgP2XN87BQ@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [2001:4898:80e8:a::712]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; CY4PR21MB0280; 7:B6jF4JioNq6WAfpbfQJqTF4j4p4BppF+kMctuwp8WKbhUM6j5zG/jUkuktTIkhHJyCAdiQDcWqWcZOA6diq5xY0cSNz2brtpxwfv8lbLmYBxcFYP+ky+Db9L4CQrsGmqHhZZWLK0uTsky4HBZ63WSJSlWPUXa4ePJKxjeqnbL7tAfo4uvPHPeITAOpn8YZUwyOLN3rSpDybFGLM0iwcSyDZIUMW9fwElBJQv0D1DyArR7n2p7H2rVCzWuzOWI3cF; 20:jPAldTD8BG80LgDn/2QRPZLxqKvMEiu3Z9gMKULcdflTPZgGaoZ2cfCy9LYm6OUkz/ehovJFk+KKi1F/tIpXYNw3N35tQA0/IU3F2i+vwOvSMEscFPJpdAUTaDL7tmQIhRXhEZMSq/3IfY+HiIU/o+2Si9J2ZX/utBTOkGAdc6U=
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 8e9258f4-1e1e-4618-5105-08d59a55849a
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:CY4PR21MB0280;
x-ms-traffictypediagnostic: CY4PR21MB0280:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=pravb@microsoft.com;
x-microsoft-antispam-prvs: <CY4PR21MB0280B86CADF6A3C399BB9BA8B6A40@CY4PR21MB0280.namprd21.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(28532068793085)(158342451672863)(9452136761055)(189930954265078)(85827821059158)(67672495146484)(219752817060721)(21748063052155);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231221)(944501327)(52105095)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR21MB0280; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0280;
x-forefront-prvs: 0632519F33
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(376002)(39860400002)(346002)(39380400002)(199004)(189003)(2900100001)(39060400002)(6246003)(53936002)(186003)(46003)(97736004)(11346002)(446003)(476003)(99286004)(86362001)(86612001)(25786009)(19609705001)(10290500003)(966005)(478600001)(606006)(3660700001)(10090500001)(4326008)(2906002)(8990500004)(3280700002)(68736007)(8936002)(8676002)(106356001)(105586002)(9686003)(55016002)(14454004)(54896002)(6306002)(81156014)(5250100002)(81166006)(6436002)(93886005)(7736002)(236005)(316002)(33656002)(22452003)(7696005)(76176011)(229853002)(6116002)(486006)(59450400001)(102836004)(6506007)(53546011)(74316002)(5660300001)(110136005)(54906003)(790700001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0280; H:CY4PR21MB0630.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: pv4Lv0ARfLZqnPepQvN/DcsLoMk/G8qOMuibTCbAW/G1U9J5s87JXrJz1kH/AgJp6ttBQ3xD0E/6fHte1dRHOlCW18/NKfb8nc09w0xktwSkwxk6A0JwA5x6BIyq1Tkj5ACcnXzVSYaBiGyNOMKQwUNJe3Ex3wlqjYLJ4caDoSKwbJKesKAkBB6mncxnTjjUnDUcDoyL9rRNZLsvth03lejfJ+8MTpXemvLwF6HIhwnjR3TyFAohaydQ7jP8v3pyWFd/kb2rJG9Z1SDhco+AyHrLhQtpMYQ6k8aKf28LQzKY2ax/QeUWwfgxta5wRJIG0/UpM6OfVDvRAb71J1/632XLs4vmbn58pxvL516/ssYz5EEGq9EAxoMp0z/rmGDv7A67XDNTiE+Qyx00sLGGYOMFLMkmH7B9F2E5vzPh5yA=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_CY4PR21MB06302D6BC1865A5889759548B6A40CY4PR21MB0630namp_"
MIME-Version: 1.0
X-OriginatorOrg: microsoft.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 8e9258f4-1e1e-4618-5105-08d59a55849a
X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2018 17:57:22.9535 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0280
Cc: Subodh Iyengar <subodh@fb.com>
Cc: IETF QUIC WG <quic@ietf.org>
Cc: Ian Swett <ianswett@google.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/BpuVNgAcngnGF4b4oWjIBSrb7Ic>
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 17:57:29 -0000

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<mailto: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<mailto: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<mailto: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<mailto:quic-bounces@ietf.org>> on behalf of Ian Swett <ianswett=40google.com@dmarc.ietf..org<mailto: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