Re: Using varints to encode the Transport Parameters

Martin Thomson <martin.thomson@gmail.com> Mon, 29 October 2018 22:33 UTC

Return-Path: <martin.thomson@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 04FF3131002 for <quic@ietfa.amsl.com>; Mon, 29 Oct 2018 15:33:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 7RmiRXbQonXa for <quic@ietfa.amsl.com>; Mon, 29 Oct 2018 15:33:51 -0700 (PDT)
Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::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 C6C82127133 for <quic@ietf.org>; Mon, 29 Oct 2018 15:33:51 -0700 (PDT)
Received: by mail-oi1-x231.google.com with SMTP id v198-v6so5889905oif.2 for <quic@ietf.org>; Mon, 29 Oct 2018 15:33:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=MizFxxtbOIwofN+HRCA4aALpZtwYL8iw8Iq9WhWs4sc=; b=DU0zuNeufdRELTTmqjxzfa8Y3jkqUyM8r6WgADSpTUxbSPI92GS2wvI/XIdYwTE4hZ zC+gY2Brqhnpcpw4l5FDihUO5Lm40CZSvd0IptL/EmsE42TLwZk/fHsdAB3/I6TVNtXw cjOjLXTJ5CFfyk9IOrYqsnS2aLsstzU/4etytk+paFE2kKUkTXoDH2AdeU4I/i1ZOsCB 9+8dlTh5Xrm7OvYu/UmtZj7zzfrPfsMvNHVoaG8tO38kuO6Jy7lE+mqHq2uo7QjQcrf+ MVXA1NdIxg3dgeFm6ua/WfqSlgmLGIklf7h/hRXkoVUgzSpYqy8b+c4nHhzC1V0Ff+rZ xNuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=MizFxxtbOIwofN+HRCA4aALpZtwYL8iw8Iq9WhWs4sc=; b=j8abQmIB7gaWc8erWojVWQGZh35wwCDKz0Lo2q/hhhys+R5xXz/uDsaNezTS13KhAv lyaan1IrDCO9GV9LQCUScY6XfKgXc/PYm61JkPCMIHrx7sn9vcPJscq6QAU6BarxhLzp tCXFU4ev5oKxr6CGjvsO2yuFW6lUc+0+CJ2CXHnyzkx2k3HR+2cfjnkaV7itgjwv3UQ9 L2GT984TKIQ8QtOgZnZ8qZ5sl6nEgvfh48h+1vgAtSHuQ5ZYaV9P1yiwzoKQAQSsTKDx EXwdQHBRegBL+xkPnoHIEbuoiYr+Dr1/nhfBEimeQJp0Vh8FsLASqdUNaiGprWd/cig+ i1xw==
X-Gm-Message-State: AGRZ1gK2LRfMhgrUEoA3e2wlvhI61/KnlwvMABFzx8g2aTG9B08+M7rZ LSJkbWNtRmiFBvPPDNnbsuDQOHqUrzGDI/o2qBI9XD/8
X-Google-Smtp-Source: AJdET5c6KLS5ky2XLIP8he3IDS7dLByxsr9dsl75ZuoijiYGM27btByNs8QdFVWrEpEPUh8AUJ6XcGEri0T5V1trDDU=
X-Received: by 2002:aca:3554:: with SMTP id c81-v6mr9107428oia.308.1540852430968; Mon, 29 Oct 2018 15:33:50 -0700 (PDT)
MIME-Version: 1.0
References: <CAOYVs2rKJMXO806Jp5CpCkH8T80zUHUAauUqdmwEQuTJUhPxnA@mail.gmail.com> <20181029124835.GA7258@ubuntu-dmitri> <CAKcm_gNkVFOverE9GxhGDwf8xH4tb0rDBt6LqKSXj-z6o4r6aw@mail.gmail.com>
In-Reply-To: <CAKcm_gNkVFOverE9GxhGDwf8xH4tb0rDBt6LqKSXj-z6o4r6aw@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Tue, 30 Oct 2018 09:33:41 +1100
Message-ID: <CABkgnnWm8TgRX_Oq2+CvjQq6sGK5b1g_BAwnkPxGkanDSBSNFw@mail.gmail.com>
Subject: Re: Using varints to encode the Transport Parameters
To: Ian Swett <ianswett=40google.com@dmarc.ietf.org>
Cc: Marten Seemann <martenseemann@gmail.com>, QUIC WG <quic@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/bTanCVDs_QZVaozgmyBmaZr3puA>
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: Mon, 29 Oct 2018 22:33:54 -0000

Marten has a week.  That's enough time.

FWIW, here's my grade regarding difficulty:

numeric values to varint - trivial
ID to varint - small change to the grammar
length to varint - major change to the grammar (I'm thinking that you
would signal it by dropping the top of the range like `opaque
x<0..>;`)

You might want to consider not touching the grammar.
On Tue, Oct 30, 2018 at 4:46 AM Ian Swett
<ianswett=40google.com@dmarc.ietf.org> wrote:
>
> I agree on both of Dmitri's points and if we're going to discuss this in London, a PR is necessary.
>
> If we were discussing this 6 months ago, I'd be in favor.  If it doesn't make -17 drafts, I'd say it's QUIC v2.
>
> On Mon, Oct 29, 2018 at 8:48 AM Dmitri Tikhonov <dtikhonov@litespeedtech.com> wrote:
>>
>> I see two problems with this proposal: timing and size.
>>
>> This is rather late in the game.  If the Working Group is to follow
>> the plan Martin Thomson outlined in a recent email, this change would
>> have to be included into -17.
>>
>> A hybrid of the TLS Presentation language and QUIC varints has to be
>> specified somewhere itself, thereby increasing the size of the already
>> hefty transport document.  This new specification, in turn, is likely
>> to engender some debate and further optimization proposals.  Allowed
>> to go unchecked, this work would slip our schedule further.
>>
>> One way to approach this proposal is to have a ready-to-merge PR and
>> hum it at the upcoming meeting.
>>
>>   - Dmitri.
>>
>> On Mon, Oct 29, 2018 at 06:13:50PM +0700, Marten Seemann wrote:
>> > This is based on issue https://github.com/quicwg/base-drafts/issues/1608.
>> >
>> > The proposal is to change the encoding of the QUIC Transport Parameters
>> > exchanged during the handshake, in order to achieve greater consistency
>> > with how QUIC encodes values, and also to save a few bytes.
>> >
>> > We have a few things that are called transport parameters. This proposal
>> > only applies to the TransportParameter struct as defined in section 18 as:
>> > *struct {*
>> > *      TransportParameterId parameter;*
>> > *      opaque value<0..2^16-1>;*
>> > *} TransportParameter;*
>> > According to the encoding defined by the TLS spec, every key-value pair
>> > will be serialized as:
>> > TransportParameterID (2 byte), length (2 byte), value (length byte)
>> > where the length of the value is specified for each TransportParameterID.
>> >
>> > We could switch to varint encoding, as follows:
>> >
>> > 1. for the TransportParameterID: Since we’re only using the code points 0
>> > to 13, we could save one byte per ID by using a varint.
>> > 2. for the length: We would save one more byte, as long as the length of
>> > the value is less than 16 byte (which will be the case for all values
>> > except the preferred_address).
>> > 3. For numeric values: This would apply to the flow control offsets, the
>> > maximum stream IDs, the ack delay exponent , the maximum packet size and
>> > the max_ack_delay.
>> >
>> > In addition to the byte-savings of 1. and 2., 3. has some more desirable
>> > properties:
>> >     1. It would allow us to encode the whole range of permitted values. For
>> > example, initial_max_data is a 62-bit value, but the current encoding just
>> > allows to send 4 bytes.
>> >     2. Depending on the value sent, this might or might not save a byte
>> > here and there.
>> >     3. We’d be consistent with the encoding we use everywhere else.
>>