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 903583A0A8F
 for <quic@ietfa.amsl.com>; Thu, 18 Jun 2020 10:35:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.096
X-Spam-Level: 
X-Spam-Status: No, score=-1.096 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001]
 autolearn=no 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 xVFlK4PrCpD0 for <quic@ietfa.amsl.com>;
 Thu, 18 Jun 2020 10:35:54 -0700 (PDT)
Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com
 [IPv6:2607:f8b0:4864:20::b29])
 (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 B09F63A09F2
 for <quic@ietf.org>; Thu, 18 Jun 2020 10:35:54 -0700 (PDT)
Received: by mail-yb1-xb29.google.com with SMTP id o4so3538069ybp.0
 for <quic@ietf.org>; Thu, 18 Jun 2020 10:35:54 -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=mBNuN5B/fuaeZ6XT8QH1cy2XvzA+QdVSUay5dUf79II=;
 b=Ad9SgUOoTqQ6dkhRkx4DbXM9Y5ALAU0wRsT1POx1hcgvyB+0BkXclJmrxChN4o+RVV
 3NvhkNgAIiW0w4kpKFwO7E3YDHKaFoPnAnOJ0b0zLd7v6ynhfqEQcDTbRt7HBtjj2hWe
 eRkaycrClVbjeh13kR3NrZlC1mu6D+RVBJsYLJZJBwuwaUkV3P/TGU0UHGJFm+mzsGFn
 Yld1Q31QWml0voLiCyoi+tavRViuq3CMIvxOzDvYjiDCP6ml4F7K+OE1NESclQhn5hFP
 54Bk+cPdSuUfJD8LkWxPseku2Oa0EwaXWW7rAFYJp4m07BS8LuNqAqVyL3q8cEKTOpkz
 3Eiw==
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=mBNuN5B/fuaeZ6XT8QH1cy2XvzA+QdVSUay5dUf79II=;
 b=exAOZAVGRvKXWFzr8VfOAXsCUFHRwmEhAw9Y21/QjuPgSvAQ7mlfqqQW9hqmjFMM9v
 ZNMVWibhoGtsxr/A186Pz8cHtQ9MufipeTsMmWfROcvNBQ7FX7SN5+1iGDMpocMebkT9
 42i65+RFLhoBcZX5wtkkUFxaRB1GO4ZddfJRFn+yoriO4f/fOstz6aNcu+3evLFt7HJH
 iLrh2sX6438oOMJzTIBJY2xXTMZC9i1/V2/p7B8TY1YbaOTcfEzLvfjURxgdjQjpZ3u+
 oeu8++2uga9qpQco1Mn2r3vYpeEP+H6mhydmbLd8Vp2s18EEIDU0BcxTg9BiMmDyQ+6l
 fo+w==
X-Gm-Message-State: AOAM532UksWcbgoOEbh/MYbOMQr/t4fBHi0hBxNIrF88ugtxtDIdVTPB
 ZiO2Zwvf6l9/AwkDZyMnah+hHWaRx2NBSSJiCb8=
X-Google-Smtp-Source: ABdhPJx9oQFflTCqO6QSqpMEkZ+bzQ4cJKXRExidKtSVKOfBOD70950DIUYkp58pMT+ajNBvHTOK9D76X6TngQ9Ikcs=
X-Received: by 2002:a25:31c6:: with SMTP id x189mr8506966ybx.264.1592501753793; 
 Thu, 18 Jun 2020 10:35:53 -0700 (PDT)
Received: from 1058052472880 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 18 Jun 2020 10:35:53 -0700
From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= <mikkelfj@gmail.com>
In-Reply-To: <CADdTf+i+LZ98GgNhFNVcuoVczC=jCQE-TqWbCqhrpR7=Z2knWg@mail.gmail.com>
References: <CANatvzz8F1H=DXMkBEhmKHnYM-HVG48TS9KwY=OP881Txkcodw@mail.gmail.com>
 <CADdTf+i+LZ98GgNhFNVcuoVczC=jCQE-TqWbCqhrpR7=Z2knWg@mail.gmail.com>
MIME-Version: 1.0
Date: Thu, 18 Jun 2020 10:35:53 -0700
Message-ID: <CAN1APdft3UU1dfKY_UxRaLy2xeCYSXQT3=k53=96OO_Gu1X_cw@mail.gmail.com>
Subject: Re: AEAD and header encryption overhead in QUIC
To: Kazuho Oku <kazuhooku@gmail.com>, Matt Joras <matt.joras@gmail.com>
Cc: IETF QUIC WG <quic@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000056d08905a85f35d7"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/lj5R74oIrQHnbuzLMjJ-XFAuoUA>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 18 Jun 2020 17:35:57 -0000

--00000000000056d08905a85f35d7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I agree, thanks for sharing. I am not too surprised by the results though.

I am a bit surprised that it is possible to use bulk encrypt headers as
Nick suggests as I would have thought the key / nonce was associated with
the packet, but I haven=E2=80=99t looked closely recently.

Kind Regards,
Mikkel Fahn=C3=B8e J=C3=B8rgensen


On 18 June 2020 at 19.21.44, Matt Joras (matt.joras@gmail.com) wrote:

Wow, really interesting results, thanks for sharing!

I was curious, since it's not mentioned on the PRs that I saw, were these
tests done with any adjustments to the ACK frequency on the client? Or is
this with the default ACK policy of ACKing every other?

Matt Joras

On Thu, Jun 18, 2020 at 1:24 AM Kazuho Oku <kazuhooku@gmail.com> wrote:

> Hello folks,
>
> TL;DR: When existing crypto libraries are used, the AEAD cost of QUIC can
> become somewhat greater than that of TLS over TCP, due to those crypto
> libraries not optimized for handling short AEAD blocks. Crypto libraries
> optimized for short AEAD blocks can tighten the gap. Also, crypto librari=
es
> optimized for QUIC can combine AEAD operation and header protection vecto=
r
> generation, effectively eliminating the cost of header protection.
>
> A bit longer story:
>
> Recently, when testing quicly [1] using a NIC with *hardware support* for
> UDP GSO offload, we noticed that it uses +30% CPU cycles compared to TLS
> over TCP. This was due to our underlying crypto not being optimized for
> short AEAD blocks, and due to the call overhead of doing header protectio=
n
> one packet at a time. [2]
>
> We went on to implement our own AES-GCM library optimized for short AEAD
> blocks (i.e. packet-sized), that also generates the header protection
> vector while doing AEAD computation. By switching to the new crypto
> library, the performance drawback of the crypto itself compared to large
> AEAD blocks when down from 30% to 10% [3].
>
> The overhead of header protection (relative to all the crypto cost) on th=
e
> send side is now between 0.3% to 1% when using packets sized around 1400
> bytes to 1500 bytes. The ratio against the total transport cost is going =
to
> be less than that, and in practice, I think that they are negligible. The
> story might be a bit different on the receive-side due to the dependency
> between header protection and AEAD, though I am sure there would also be
> ways to optimize.
>
> In terms of CPU cycles spent by the QUIC stack, the overhead compared to
> TLS-over-TCP came down to 5%. quicly can now sustain the send rate of 5Gb=
ps
> while spending about 30% of CPU cycles of one modern Intel CPU core [2].
>
> These numbers are observations from one TLS / QUIC stack doing
> micro-benchmarks, though I tend to think that sharing performance numbers
> lead to people having better expectations regarding the CPU cost of QUIC.
> Some of us were also concerned about the cost of header protection (a.k.a=
.
> packet number encryption) [4]. Hence posting here.
>
> [1] https://github.com/h2o/quicly
> [2] https://github.com/h2o/quicly/pull/359
> [3] https://github.com/h2o/picotls/pull/310
> [4]
> https://mailarchive.ietf.org/arch/msg/quic/Wy8JXwKyeYgWgRWizWDbyOLg0xc/
>
> --
> Kazuho Oku
>

--00000000000056d08905a85f35d7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style>=
</head><body><div style=3D"font-family:Helvetica,Arial;font-size:13px">I ag=
ree, thanks for sharing. I am not too surprised by the results though.</div=
><div style=3D"font-family:Helvetica,Arial;font-size:13px"><br></div><div s=
tyle=3D"font-family:Helvetica,Arial;font-size:13px">I am a bit surprised th=
at it is possible to use bulk encrypt headers as Nick suggests as I would h=
ave thought the key / nonce was associated with the packet, but I haven=E2=
=80=99t looked closely recently.</div> <br> <div class=3D"gmail_signature">=
<div style=3D"font-family:helvetica,arial;font-size:13px">Kind Regards,</di=
v><div style=3D"font-family:helvetica,arial;font-size:13px">Mikkel Fahn=C3=
=B8e J=C3=B8rgensen<br><br></div></div> <br><p class=3D"airmail_on">On 18 J=
une 2020 at 19.21.44, Matt Joras (<a href=3D"mailto:matt.joras@gmail.com">m=
att.joras@gmail.com</a>) wrote:</p> <blockquote type=3D"cite" class=3D"clea=
n_bq"><span><div><div></div><div><div dir=3D"ltr"><div><div><div>Wow, reall=
y interesting results, thanks for sharing!<br><br></div>I was curious, sinc=
e it&#39;s not mentioned on the PRs that I saw, were these tests done with =
any adjustments to the ACK frequency on the client? Or is this with the def=
ault ACK policy of ACKing every other?<br><br></div></div>Matt Joras<br></d=
iv><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On =
Thu, Jun 18, 2020 at 1:24 AM Kazuho Oku &lt;<a href=3D"mailto:kazuhooku@gma=
il.com">kazuhooku@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"lt=
r"><div dir=3D"ltr"><div dir=3D"ltr">Hello folks,<div><br></div><div>TL;DR:=
 When existing crypto libraries are used, the AEAD cost of QUIC can become =
somewhat greater than that of TLS over TCP, due to those crypto libraries n=
ot optimized for handling short AEAD blocks. Crypto libraries optimized for=
=C2=A0short AEAD blocks can tighten the gap. Also, crypto libraries optimiz=
ed for QUIC can combine AEAD operation and header protection vector generat=
ion, effectively eliminating the cost of header protection.</div><div><br><=
/div><div>A bit longer story:</div><div><br></div><div>Recently, when testi=
ng quicly=C2=A0[1] using a NIC with *hardware support* for UDP GSO offload,=
 we noticed that it uses +30% CPU cycles compared to TLS over TCP. This was=
 due to our underlying crypto not being optimized for short AEAD blocks, an=
d due to the call overhead of doing header protection one packet=C2=A0at a =
time. [2]</div><div><br></div><div>We went on to implement our own AES-GCM =
library optimized for short AEAD blocks (i.e. packet-sized), that also gene=
rates the header protection vector while doing AEAD computation. By switchi=
ng to the new crypto library, the performance drawback of the crypto itself=
 compared to large AEAD blocks when down from 30% to 10% [3].=C2=A0</div><d=
iv><br></div><div>The overhead of header protection (relative to all the cr=
ypto cost) on the send side is now between 0.3% to 1% when using packets si=
zed around 1400 bytes to 1500 bytes. The ratio against the total transport =
cost is going to be less than that, and in practice, I think that they are =
negligible. The story might be a bit different on the receive-side due to t=
he dependency between header protection and AEAD, though I am sure there wo=
uld also be ways to optimize.</div><div><br></div><div>In terms of CPU cycl=
es spent by the QUIC stack, the overhead compared to TLS-over-TCP came down=
 to 5%. quicly can now sustain the send rate of 5Gbps while spending about =
30% of CPU cycles of one modern Intel CPU core [2].</div><div><br></div><di=
v>These numbers are observations from one TLS / QUIC stack doing micro-benc=
hmarks, though I tend to think that sharing performance numbers lead to peo=
ple having better expectations regarding the CPU cost of QUIC. Some of us w=
ere also concerned about the cost of header protection (a.k.a. packet numbe=
r encryption) [4]. Hence posting here.<br clear=3D"all"><div><br></div><div=
>[1] <a href=3D"https://github.com/h2o/quicly" target=3D"_blank">https://gi=
thub.com/h2o/quicly</a></div><div><span style=3D"color:rgb(0,0,0)">[2]=C2=
=A0<a href=3D"https://github.com/h2o/quicly/pull/359" target=3D"_blank">htt=
ps://github.com/h2o/quicly/pull/359</a></span></div><div><span style=3D"col=
or:rgb(0,0,0)"></span>[3]=C2=A0<a href=3D"https://github.com/h2o/picotls/pu=
ll/310" target=3D"_blank">https://github.com/h2o/picotls/pull/310</a></div>=
<div>[4]=C2=A0<a href=3D"https://mailarchive.ietf.org/arch/msg/quic/Wy8JXwK=
yeYgWgRWizWDbyOLg0xc/" target=3D"_blank">https://mailarchive.ietf.org/arch/=
msg/quic/Wy8JXwKyeYgWgRWizWDbyOLg0xc/</a></div><div><br></div>-- <br><div d=
ir=3D"ltr">Kazuho Oku</div></div></div></div></div></div></div>
</blockquote></div>
</div></div></span></blockquote></body></html>

--00000000000056d08905a85f35d7--

