Re: QPACK proposal: wrap absolute index values

Ryan Hamilton <rch@google.com> Mon, 06 August 2018 03:14 UTC

Return-Path: <rch@google.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 E5610130E50 for <quic@ietfa.amsl.com>; Sun, 5 Aug 2018 20:14:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -12.51
X-Spam-Level:
X-Spam-Status: No, score=-12.51 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, GB_SUMOF=5, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.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 x3r5z-dUYi6E for <quic@ietfa.amsl.com>; Sun, 5 Aug 2018 20:14:57 -0700 (PDT)
Received: from mail-yw1-xc2b.google.com (mail-yw1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) (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 9DE74130E41 for <quic@ietf.org>; Sun, 5 Aug 2018 20:14:57 -0700 (PDT)
Received: by mail-yw1-xc2b.google.com with SMTP id 139-v6so3102150ywg.12 for <quic@ietf.org>; Sun, 05 Aug 2018 20:14:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=v6TR+YwSgS5EqVb/eueD5tjTbxPt+29x3tP8Ym6aI2g=; b=BMg/7nh1U2EaY7RuHE6Rszgh078x6GfvOOKUxprEr4K4b5eHzIHQYxRiM5/PeHfz5a VN1hf7F3qOZNUjLnpk7eFuKYchDPaSFCN48D2/RPzrwi0AITfHUuSK4yqb8y6dxiLp/2 P2avpC7pdW9zd+zsCH2D5GavScfuRVtzxzzTMvXiAapo6ru7KwniQCyewuN9DhX16Q4Y PKUMrbIukqSvd6NNtxaO9/ELcsnNc//z6mgZBuoEPyD6px74nJDBgX+5tQ9GxugoAtsm zOhc1hlXG5Gm9pkSIIK4Rod0BURDqYRvBFYAAVaT+7vzvuGT4nvyhCx7MZdU3IEcqvBL xR9g==
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=v6TR+YwSgS5EqVb/eueD5tjTbxPt+29x3tP8Ym6aI2g=; b=H5KWbZb8JSx72kuzzpTnT/lZWCebMyrCjLJsU7A1CXkWkayeb69jOpNnlSJ2gWnNXu 5hzAg8zQCkK9HEVvPS5Kb42sJbsL+mUfwWAGDmawpniycI0Wy0+qnf3zlzSFYna4q5hp CHGfYz1VKhiEOJA3TkLunktlEVLTrYqiZoXTpwsrvtW9BCsJbLsKPggv78BzjEP5FVyL 2JPE1xwfedi29s+AvUa9Wdr0RBDaWvLZB/Ooi45ujPz/DrOxI1ZjWE34GByRJraP81Pu 1QAmJJoekP1kNS1ItUI1JBf+vg0gmwaTvaXZgZVsmUasHcZ2NUAJIqEqOBwGYKkFpH43 fHTg==
X-Gm-Message-State: AOUpUlHn59xZegj9w7/6Yqzfki/tp0BnGMtfAOnK22kKwhVz4YYMU7OG pWVOqsWjo/hdZARUE0FT5HS8MsSMba43R6RdExj7PQ==
X-Google-Smtp-Source: AAOMgpd4nufdtkCg+zQns8DJOltu1+tnSnOPpUDUlPKBsFa68KRPCY7yFKuyVC94a6PHBCdrDrYr4AZ1SoPwAmP7k9A=
X-Received: by 2002:a81:d8b:: with SMTP id 133-v6mr6914531ywn.179.1533525296282; Sun, 05 Aug 2018 20:14:56 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a25:8b11:0:0:0:0:0 with HTTP; Sun, 5 Aug 2018 20:14:55 -0700 (PDT)
In-Reply-To: <CABkgnnV2Ugu6O_6Q8grjhQiqavUe6P8FVP_BNRuNqtzVXTbOgw@mail.gmail.com>
References: <20180805154649.GA14245@ubuntu-dmitri> <CABkgnnV2Ugu6O_6Q8grjhQiqavUe6P8FVP_BNRuNqtzVXTbOgw@mail.gmail.com>
From: Ryan Hamilton <rch@google.com>
Date: Sun, 05 Aug 2018 20:14:55 -0700
Message-ID: <CAJ_4DfTcc1X2WUHVoy9Xk75jV3qXu34gbcuuCr2TriN44X5LLg@mail.gmail.com>
Subject: Re: QPACK proposal: wrap absolute index values
To: Martin Thomson <martin.thomson@gmail.com>
Cc: QUIC WG <quic@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000008ab59e0572bbae1c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/SiKoIj8-JtN9BLS6Lkn4kwEBfx4>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.27
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, 06 Aug 2018 03:15:00 -0000

Do we have any sense on the overall impact on compression efficiency base
on typical HTTP workloads?

On Sun, Aug 5, 2018 at 5:29 PM, Martin Thomson <martin.thomson@gmail.com>
wrote:

> Table State Synchronize is relative, so it wouldn't benefit from a
> change here.  That's something I missed initially, so it's probably a
> candidate for clearer text.
>
> I've no real opinion on the wrapping proposal.  It seems like it might
> work for the Largest Reference.  The math is a tiny bit annoying to
> decode in the same way the packet number encoding is, but it is
> doable.  I imagine that you reconstruct the Largest Reference based on
> the smallest index in the table.  That is:
>
> rotation = floor(table_size / 32)
> base = minimum - (minimum % rotation)
> # equivalently: base = floor(minimum / rotation) * rotation
> largest = encoded + base
> if largest < minimum:
>   largest += rotation
> On Mon, Aug 6, 2018 at 1:47 AM Dmitri Tikhonov
> <dtikhonov@litespeedtech.com> wrote:
> >
> > Abstract
> > --------
> >
> > The practical and theoretical problems caused by the unbounded absolute
> > index values in the current QPACK Internet Draft are discussed.  The
> > proposal to impose a limit on the range of absolute index values by
> > wrapping them is presented.
> >
> > Background
> > ----------
> >
> > The current QPACK draft states that
> >
> >    [the] first entry inserted has an absolute index of "1"; indices
> >    increase sequentially with each insertion.
> >
> > No upper limit is specified.  This is reasonable, as it is impossible
> > to run out of numbers.
> >
> > Nevertheless, an absolute index whose value is ever-increasing creates
> > significant problems.
> >
> > Problem 1: Compression Impact
> > -----------------------------
> >
> > A large absolute index value has a negative effect on compression.
> > There are two places in QPACK that use the unadjusted value of the
> > absolute index:
> >
> >     - the Largest Reference field in the Header Data Prefix; and
> >     - the Table State Synchronize instruction.
> >
> > Larger values mean that more bytes are necessary to encode them.
> > For example, using 8-bit prefix integer encoding, values larger than
> > 254 encode to 2 bytes, larger than 382 to 3 bytes, and larger than
> > 16638 to 4 bytes.
> >
> > Relatively quickly, the overhead associated with communicating the
> > absolute index doubles and then triples.
> >
> > Problem 2: Theoretical Concerns
> > -------------------------------
> >
> > Why should compression at t(1) be worse than at t(0)?  An ability
> > to operate at the optimum level in perpetuity is a good property
> > for a protocol to have.
> >
> > Problem 3: Implementation Efficiency
> > ------------------------------------
> >
> > A QPACK implementation has to place some limits on the value of the
> > absolute index -- simply because it has to pick an integral type to
> > store it.  For example, uint64_t is likely large enough for all uses of
> > the protocol, but it is wider than uint32_t and may be more expensive
> > to process.  On other platforms, uint16_t may be the fastest integer;
> > the unbounded nature of the absolute index would rule out its use.
> >
> > Such limit also requires an extra check [1] to cease inserting entries
> > into the dynamic table once the maximum value for the integer is
> > reached.  (One can run out of numbers in practice...)
> >
> > Solution: Have the Absolute Index Wrap Around
> > ---------------------------------------------
> >
> > The main insight of the proposal is that the dynamic table has a bounded
> > number of entries, that both encoder and decoder know what this number
> is,
> > and that both can use this information to place an absolute index value
> > communicated to it by its peer at the correct place in the sequence.
> >
> > The dynamic table has a maximum size which is specified at the beginning
> > of the connection and which never changes afterwards.  The current size
> > of the table is the sum of all its entry sizes.  The entry size is the
> sum
> > of the fixed overhead plus the lengths of the name and the value strings.
> > It is this fixed entry overhead that places a hard limit on the number
> > of entries in the dynamic table:
> >
> >     MaxEntries = MaxTableSize / FixedEntryOverhead
> >
> > For example, using the current QPACK defaults, this number is
> >
> >     MaxEntries = 4096 / 32 = 128
> >
> > Imagine an encoder or decoder whose largest absolute index value
> (referred
> > to as the total number of insertions in the QPACK draft) is X.  The
> > smallest valid absolute index value its peer could possibly communicate
> > to it is X - MaxEntries + 1.  The largest value is X + MaxEntries.  (All
> > other values would indicate a bug at one or both sides.)  The maximum
> > size of the valid absolute index values window, then, is MaxEntries * 2.
> >
> > Therefore, we can wrap the absolute index value without loss of
> > information.  The proposal is to limit the absolute index values to
> > the range
> >
> >     [ 1, MaxEntries * 2 ]
> >
> > Continuing with the QPACK defaults example above, the sequence would
> > go
> >
> >     1, 2, 3, ... 254, 255, 256, 1, 2, ... (and so on).
> >
> > The compression overhead cost is now a function of the maximum table
> > size (and not a function of time as before).
> >
> > To continue with our example, out of 256 possible values, 254 encode
> > to 1 byte and 2 to two bytes.  A 64 KB table results in a maximum
> > encoding of 3 bytes, while a 1 MB table has a maximum encoding of 4
> > bytes.
> >
> > Changes to the Draft
> > --------------------
> >
> > The changes to the draft are small.  Only the definition of the
> > absolute index has to change; all instructions and encodings stay
> > the same.
> >
> > Conclusion
> > ----------
> >
> > Limiting the range of values the absolute index can have improves
> > compression and implementation efficiency and removes the time penalty
> > from the QPACK protocol.  A mechanism to do just that using existing
> > QPACK parameters and with minimal changes to the draft has been proposed.
> > I suggest that it be examined for flaws.  If none be found, I say let's
> > include it in the next version of the QPACK Internet Draft.
> >
> >
> >   - Dmitri.
> >
> > 1. https://github.com/litespeedtech/ls-qpack/blob/
> 122d1163eaca359f5d79cd608722b1b19acad15f/src/lsqpack.c#L1110
> >
>
>