Re: Proposal: drop QPACK encoder stream framing

Martin Thomson <martin.thomson@gmail.com> Fri, 08 June 2018 10:12 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 D5B71130E58 for <quic@ietfa.amsl.com>; Fri, 8 Jun 2018 03:12:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 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_LOW=-0.7, SPF_PASS=-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 HDgZV9N4zMM4 for <quic@ietfa.amsl.com>; Fri, 8 Jun 2018 03:12:50 -0700 (PDT)
Received: from mail-oi0-x22b.google.com (mail-oi0-x22b.google.com [IPv6:2607:f8b0:4003:c06::22b]) (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 1505512F18C for <quic@ietf.org>; Fri, 8 Jun 2018 03:12:50 -0700 (PDT)
Received: by mail-oi0-x22b.google.com with SMTP id b130-v6so11314112oif.12 for <quic@ietf.org>; Fri, 08 Jun 2018 03:12:50 -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; bh=AiufiNHatJ2IKD9ND26xVJMlmJgLPxTP100FZD9rA4Q=; b=OIhaaNZ2ah1mnfv2Xne+0gn3rOkjow0D0oFjD66LPbxjYM7NnIv8q8dzu0p3+IUNwm CTnXu0KinCWoSvT1gZZdPpB05ss+fow4s9r7DhiAl1VI13u+UCovt5sob6D6FFjrVt6J D8GXYe3SjqoZbofxuAnIcWUXxa7sKBUnReQVMy3P1YMBYaoH1JdNbsx2N2A0jCDU10Qq XjotnQ3MaiohYGgaeXwr1w6Qj+DTtV7NlCdO1jVt6/gBrVDb3RhhoWjJZNSdPz3O5O6E 2iQARxPR5rPWOi6RtxAkNe22sfSmxuQcbZ8xaKJTYiONIzuBF9FHoLcdmG3qTh5ZBsHD UezA==
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; bh=AiufiNHatJ2IKD9ND26xVJMlmJgLPxTP100FZD9rA4Q=; b=j+rTDMTuWJs2jL0dd847itYP4ct4zpcRIavCc3JL6nKiXJa0fHozePml8tEkVskTb4 fXHPdjUomf0hYxLP0VYlqKsuiS5gqlPvNM4G7CTW60XcjvSo1sfNTqBmoKAx7uG3pYjF b2p+EvRAi4XZc9x8an7T9gF41HP4wcLK9MiBP7zCXx1DRdOXs1TeKWQ6a3gjK2KPlp4m OSKS5RBTiDVSIJedwxr+z1AMHY/RubaDGT3xO36/YAZkd9CDmPEd8Ewna/lxf5GqXx6Y YlacEYaVOgonTTi2pDLW+iRkEkwNe5mSWnAQlCs5BAHEDVfbVhcCh5QLeNYH7Ufo81+o bpnQ==
X-Gm-Message-State: APt69E3rEXYNKFgqpqZTgdrxVO026m0SbBobVYUjS1w4ig3ldJeLU1hJ VGEKNFSgxMgkfjphsR7m/0mV5+paNGw8wvXNFDfa8g==
X-Google-Smtp-Source: ADUXVKIDyNaKzoP0YY7UQ8ui0dAgTk8VgZBQPzU/VhcdjJF/HlXax0/s2INpp3XUKeQT6Gr3/vkxFHYwpV9M2Ckfv8Q=
X-Received: by 2002:aca:51cb:: with SMTP id f194-v6mr2996093oib.110.1528452769078; Fri, 08 Jun 2018 03:12:49 -0700 (PDT)
MIME-Version: 1.0
References: <20180607151112.GA28823@ubuntu-dmitri>
In-Reply-To: <20180607151112.GA28823@ubuntu-dmitri>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Fri, 8 Jun 2018 12:12:38 +0200
Message-ID: <CABkgnnXbfkVbq6vCvud100h6wr3+9ir3iO7dD6-qaykOmK3JBQ@mail.gmail.com>
Subject: Re: Proposal: drop QPACK encoder stream framing
To: QUIC WG <quic@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/eBc_O7w-W5sm--tvIPz3R6eOAKA>
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, 08 Jun 2018 10:12:52 -0000

I think that this is a reasonable request and I'd support this.  It
saves an encoder from having to buffer and it even saves a few octets.
The complexity increase (the increased need to delay acknowledgments)
is manageable and even encourages good practice - the current design
encourages a little bit of laziness because you can acknowledge at the
end of each block and have a reasonable expectation of it being
approximately correct... most of the time.
On Thu, Jun 7, 2018 at 5:11 PM Dmitri Tikhonov
<dtikhonov@litespeedtech.com> wrote:
>
> Abstract
> --------
>
> The encoder block specified in Section 3.3 of draft-ietf-quic-qpack-00
> is unnecessary.  For reasons of efficiency, I propose that the framing
> be removed: let the encoder instructions be written and interpreted as
> a stream instead.
>
> Background
> ----------
>
> I brought this up during the first day (June 6) of the Kista Interim.
> Alan explained that there are two reasons for framing the instructions
> in this way on the encoder stream:
>
>     1. Historically, some (or most) HPACK decoders have struggled with
>        input that breaks in the middle of an instruction, as they do
>        not maintain state.
>
>     2. The blocks can be used as a clue to send Table State Synchronize
>        instructions on the decoder stream (Section 3.4.1).
>
> The downside to having length-prefixed blocks is that it makes it
> difficult to optimize encoding by writing to the outgoing packets
> directly.  One has to buffer the block, write the block length first,
> and then copy the block.
>
> Additionally, there is a potential for a deadlock (issue #1420).  Recall
> that QPACK owes its current form to the fact that the WG decided to
> prevent deadlocks at the compression protocol level, and not via advisory
> notes to the implementers.
>
> Reasons Behind the Block
> ------------------------
>
> First, let's look at the historical HPACK chokers.
>
> The HPACK decoder only processes HEADER blocks.  There is only one stream
> and thus only one HEADER block can be processed at a time.
>
> The QPACK decoder has to process two inputs: a) the encoder stream
> and b) HEADER blocks.  There is only one encoder stream.  This stream
> modifies the decoder state: the dynamic table.  The HEADER blocks do not
> modify the state.
>
> The HEADER blocks already come with a prefix length (HQ framing), and so
> QPACK implementations can choose to wait until the whole HEADER block is
> available.  It is processing of the encoder stream that is under
> consideration.
>
> With regards to the Table Synch signaling, the draft states that
>
>  "                                                         A decoder MAY
>  " coalesce multiple synchronization updates into a single update.
>
> This effectively means that the encoder already should not expect to get
> a one-to-one mapping between its Encoder Blocks and Table Synchs.
>
> Working with the Encoder Stream
> -------------------------------
>
> The dynamic table instruction stream can be thought of as its own state.
> Already, the QPACK decoder must be able to pause reading from streams when
> a blocked HEADERS block arrives.  Similar techniques can be used to resume
> reading from the encoder stream.  It should not be difficult to resume
> decoding a single instruction!  While breaking with the HPACK precedent
> (the hold-my-hand-I-need-buffer-size chokers), it keeps in line with the
> Seattle hum that the new compression mechanism is free from its HPACK
> shackles.
>
> Conclusion
> ----------
>
> Prefixing arbitrary sets of encoder instructions with a length denies
> zero-copy optimization opportunities.  At the cost of some slight
> complexity increase at the decoder, this framing mechanism can be
> dropped.  The proposed change is limited to just this -- technically
> superfluous -- piece.
>
>   - Dmitri.
>
> P.S.  An added bonus is some saved framing bytes on the encoder stream.
>       I believe the "compression performance above everything else" is
>       also the Working Group's consensus (Melbourne).
>