Re: Packet Number Encryption Performance

Kazuho Oku <kazuhooku@gmail.com> Fri, 22 June 2018 02:21 UTC

Return-Path: <kazuhooku@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 3E2E9130DD6 for <quic@ietfa.amsl.com>; Thu, 21 Jun 2018 19:21:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DC_PNG_UNO_LARGO=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_IMAGE_RATIO_06=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-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 XsHza3w0II8G for <quic@ietfa.amsl.com>; Thu, 21 Jun 2018 19:21:19 -0700 (PDT)
Received: from mail-pl0-x233.google.com (mail-pl0-x233.google.com [IPv6:2607:f8b0:400e:c01::233]) (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 47724130DC6 for <quic@ietf.org>; Thu, 21 Jun 2018 19:21:19 -0700 (PDT)
Received: by mail-pl0-x233.google.com with SMTP id 30-v6so2658863pld.13 for <quic@ietf.org>; Thu, 21 Jun 2018 19:21:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AHyD6dUBLAisaavgqTkvsqUovifKau8kJecm/V1wuRA=; b=h9hjwsQTOHJcIYyStGOHed2h6N/euy/M04hkLDTndzwm02BH3v7hGNtxDGJrj8odFw WoV9cBp/PheYODVPGY/7PFMBgASNnuU2RttzvTbZP/3k7ZCfdTAP+VlxH/l7m05WoLJM gHKVHpQxedJBStp8u5ltDLiZNgQbIZKy5aW9xHntIKcPdjIjmTkZ5BCy3keTUuggtT9j hxka1ejbq0R1LAh7JUJR9t6NByXb8S4hSMjdHuCPvjDsDQnMb4o74Wgzv45M8BNXHfUf nFreoovi/zfJFmgZjLgJ3muH0+wW+gpRdAqccbRqBWLBL+LBJbvlwjDSA4WcH5sak9RT i7jA==
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=AHyD6dUBLAisaavgqTkvsqUovifKau8kJecm/V1wuRA=; b=kn3Xe0u/X8AEnvVv6Do38KD3kn8TdMKmBNVBwa99TgqIoKo1m/79hWI7yUD3SNaM9R pQLsnVuif2cHM11bhh1aC0JrioW3ha961w4yJjUG4n2iEcXTOs8Svdb2JX16VS4FZlnS v+2RH6LwFghmI/2TkHddoaNFwPKZlgNqxwSRVk7u7V0gTjBxL6Dy3zOM1oIwNgXWFHpN SZXdKPEtjJk92xb6D/V8ULs09bJLuNijJjTcs/2PaJyjLAAE3menlYoEBQEUPzCGkzFw LX0ORueHdgvFnjYVMT28BzCwS54MTXMKvo5u2vn6omgONl3WM9tJgfgnOlY7JvtEDsFK 8GwQ==
X-Gm-Message-State: APt69E1kdsMde0d6zpa0/ED3Pm/W0cIP5L2Qs4XV35HOn1UWdl6cSmrd aCBveV71LjkK6eT7zlH+RcSg9EPAzE2p0GJY+9YX2Q==
X-Google-Smtp-Source: ADUXVKI4YWPk+zAWyeHfvSft+M1USFNDCjFKVgUyAgbDwUB7JBUmeuubVO/e2Am0yEPdAGmR5BHifG3tSMIG2J/L/ek=
X-Received: by 2002:a17:902:7089:: with SMTP id z9-v6mr30849909plk.231.1529634078640; Thu, 21 Jun 2018 19:21:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a17:90a:1181:0:0:0:0 with HTTP; Thu, 21 Jun 2018 19:21:17 -0700 (PDT)
In-Reply-To: <DM5PR2101MB0901FCB1094A124818A0B1FEB3760@DM5PR2101MB0901.namprd21.prod.outlook.com>
References: <DM5PR2101MB0901FCB1094A124818A0B1FEB3760@DM5PR2101MB0901.namprd21.prod.outlook.com>
From: Kazuho Oku <kazuhooku@gmail.com>
Date: Fri, 22 Jun 2018 11:21:17 +0900
Message-ID: <CANatvzxVBq1-UKiuixWGFfFyWMh8SYpp=y2LqYwiF=tHT6oOOQ@mail.gmail.com>
Subject: Re: Packet Number Encryption Performance
To: Nick Banks <nibanks=40microsoft.com@dmarc.ietf.org>
Cc: "quic@ietf.org" <quic@ietf.org>
Content-Type: multipart/related; boundary="000000000000e4f1cf056f31afca"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/1qE0k3NG3P92R3mFXGUnVYBTxMw>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.26
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: Fri, 22 Jun 2018 02:21:22 -0000

Hi Nick,

Thank you for bringing the numbers to the list.

I have just run a small benchmark using Quicly, and I see comparable
numbers.

To be precise, I see 10.0% increase of CPU cycles when encrypting a Initial
packet of 1,280 octets. I expect that we will see similar numbers on other
QUIC stacks that also use picotls (with OpenSSL as a backend). Note that
the number is only comparing the cost of encryption, the overhead ratio
will be much smaller if we look at the total number of CPU cycles spent by
a QUIC stack as a whole.

Looking at the profile, the overhead consists of three operations that each
consumes comparable CPU cycles: core AES operation (using AES-NI), CTR
operation overhead, CTR initialization. Note that picotls at the moment
provides access to CTR crypto beneath the AEAD interface, which is to be
used by the QUIC stacks.

I would assume that we can cut down the overhead to somewhere between 2% to
4%, but it might be hard to go down to somewhere near 1%, because we cannot
parallelize the AES operation of PNE with that of AEAD (see
https://github.com/openssl/openssl/blob/OpenSSL_1_1_0h/crypto/aes/asm/aesni-x86_64.pl#L24-L39
about the impact of parallelization).

I do not think that 2% to 4% of additional overhead to the crypto is an
issue for QUIC/HTTP, but current overhead of 10% is something that we might
want to decrease. I am glad to be able to learn that now.


2018-06-22 5:48 GMT+09:00 Nick Banks <nibanks=40microsoft.com@dmarc.ietf.org
>:

> Hello QUIC WG,
>
>
>
> I recently implemented PNE for WinQuic (using bcrypt APIs) and I decided
> to get some performance numbers to see what the overhead of PNE was. I
> figured the rest of the WG might be interested.
>
>
>
> My test just encrypts the same buffer (size dependent on the test case)
> 10,000,000 times and measured the time it took. The test then did the same
> thing, but also encrypted the packet number as well. I ran all that 10
> times in total. I then collected the best times for each category to
> produce the following graphs and tables (full excel doc attached):
>
>
>
>
>
> *Time (ms)*
>
> *Rate (Mbps)*
>
> *Bytes*
>
> *NO PNE*
>
> *PNE*
>
> *PNE Overhead*
>
> *No PNE*
>
> *PNE*
>
> *4*
>
> 2284.671
>
> 3027.657
>
> 33%
>
> 140.064
>
> 105.692
>
> *16*
>
> 2102.402
>
> 2828.204
>
> 35%
>
> 608.827
>
> 452.584
>
> *64*
>
> 2198.883
>
> 2907.577
>
> 32%
>
> 2328.45
>
> 1760.92
>
> *256*
>
> 2758.3
>
> 3490.28
>
> 27%
>
> 7424.86
>
> 5867.72
>
> *600*
>
> 4669.283
>
> 5424.539
>
> 16%
>
> 10280
>
> 8848.68
>
> *1000*
>
> 6130.139
>
> 6907.805
>
> 13%
>
> 13050.3
>
> 11581.1
>
> *1200*
>
> 6458.679
>
> 7229.672
>
> 12%
>
> 14863.7
>
> 13278.6
>
> *1450*
>
> 7876.312
>
> 8670.16
>
> 10%
>
> 14727.7
>
> 13379.2
>
>
>
> I used a server grade lab machine I had at my disposal, running the latest
> Windows 10 Server DataCenter build. Again, these numbers are for crypto
> only. No QUIC or UDP is included.
>
>
>
> Thanks,
>
> - Nick
>
>
>



-- 
Kazuho Oku