Re: Alternative Header Compression Update..

James M Snell <jasnell@gmail.com> Wed, 10 July 2013 16:07 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1D67621F9D98 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 10 Jul 2013 09:07:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.533
X-Spam-Level:
X-Spam-Status: No, score=-10.533 tagged_above=-999 required=5 tests=[AWL=0.066, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aFV2jwpsyYIx for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 10 Jul 2013 09:07:06 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 970C821F86B1 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 10 Jul 2013 09:07:05 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1Uwwuo-0002St-89 for ietf-http-wg-dist@listhub.w3.org; Wed, 10 Jul 2013 16:06:50 +0000
Resent-Date: Wed, 10 Jul 2013 16:06:50 +0000
Resent-Message-Id: <E1Uwwuo-0002St-89@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <jasnell@gmail.com>) id 1Uwwuf-0002MI-Re for ietf-http-wg@listhub.w3.org; Wed, 10 Jul 2013 16:06:41 +0000
Received: from mail-oa0-f49.google.com ([209.85.219.49]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <jasnell@gmail.com>) id 1Uwwue-00021l-TQ for ietf-http-wg@w3.org; Wed, 10 Jul 2013 16:06:41 +0000
Received: by mail-oa0-f49.google.com with SMTP id n9so9815919oag.8 for <ietf-http-wg@w3.org>; Wed, 10 Jul 2013 09:06:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=ElTX4L0Sa6XTAqqI6C3iVdbeaYQvTNfB8bCu1B9m76Y=; b=Wwqrl+z5QZnu8+eZrgV8svqN24quxMSS2Gc5BmT6op51tjW4NZ4g42Gm1Ronfv+DEs C6svCbgFEIOikTARGCgVIZzbB11uilqK+hZvPCqAo543/3rX7yvDGa15gWtpLmJiygmq +2nn7/6Nj4zEfA8kCca5F36HUdHVBmv8pZ3ct08MDqWCkuEGO3tOiQpUbmQgF+Lk/mtl mpiLLei/2ku/STTJbVW7MfnCKapW/Nbkyee6eyCbKijyi04Noku+D0NghLi03y+QAuCQ xiUCajYAJlLr2cjA1To+VtBYJholDS52tWMDQcNo9BQ0aXMM78MRyTTNWqQZFoJxUlyu R8ag==
X-Received: by 10.182.33.103 with SMTP id q7mr28604933obi.77.1373472375009; Wed, 10 Jul 2013 09:06:15 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.60.55.8 with HTTP; Wed, 10 Jul 2013 09:05:53 -0700 (PDT)
In-Reply-To: <0E4C5C6B-205F-41EF-BE29-075678913F15@apple.com>
References: <CABP7RbcoTSGVbGKkzwtCjKL__mC_3m91tsu=V5U8wQAMGfG=Ag@mail.gmail.com> <0E4C5C6B-205F-41EF-BE29-075678913F15@apple.com>
From: James M Snell <jasnell@gmail.com>
Date: Wed, 10 Jul 2013 09:05:53 -0700
Message-ID: <CABP7Rbey4Y1QxqG3WAkMPVwkACwa0Oasr3SUynr_qJwoOWimvw@mail.gmail.com>
To: Michael Sweet <msweet@apple.com>
Cc: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=209.85.219.49; envelope-from=jasnell@gmail.com; helo=mail-oa0-f49.google.com
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.705, 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
X-W3C-Scan-Sig: maggie.w3.org 1Uwwue-00021l-TQ fb2282aec863b8ccdf2e45497d3603b7
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Alternative Header Compression Update..
Archived-At: <http://www.w3.org/mid/CABP7Rbey4Y1QxqG3WAkMPVwkACwa0Oasr3SUynr_qJwoOWimvw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/18675
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On Wed, Jul 10, 2013 at 6:09 AM, Michael Sweet <msweet@apple.com> wrote:
> James,
>
[snip]
>
> Actually, I think the typed encoding will probably yield enough savings to offset any increase in size, for example the date header going from 29 octets to ~6 in the variable integer encoding (or 8/11 for the RFC 2579 encoding - see below).
>

The type codecs definitely save quite a bit with highly variable
header fields that tend to get sent as literals often (date,
last-modified, content-length, etc). For fairly static header fields,
the difference is minimal for any individual header. Where you start
to see the gap widen is over long running connections, where the
average number of bits on the wire trends higher. It's worth it,
however, IMHO.

> I like the 256-entry single header table approach.  Of course, I have some feedback... :)
>
> 1. Would be nice if you could just include the Unsigned Variable Length Integer Syntax section from the other header compression draft wholesale so this draft stands on its own. Add a notice at the beginning "(This is copied from draft-ietf-httpbis-header-compression-NN)" so people know it is the same encoding.  Then the reference to it becomes informative.
>
> 2. Would also be nice to use the same figure format as the compression and http2 drafts... (see below)
>

Will do both in the next iteration.

> 3. Representing timestamps as milliseconds since the traditional UNIX epoch is problematic since it requires support for large integers (at least 42 bits to get us to the traditional 2038 end year, more if you want to keep going past then...) and AFAIK isn't widely used in standards for actual representation of a date/time. RFC 2579 defines a DateAndTime format that is 8 (UTC) or 11 (local time) octets long and is easy to map to/from typical OS APIs without the use of large integers. Granted, it doesn't give you more than 10ths of seconds, but I think that should be enough for HTTP. (We use this format in IPP - I'd rename "Timestamp" to "DateAndTime" if you decide to make this change...)
>

Millisecond precision has been on the HTTP wish-lists of many
application developers for a very long time, including mine and I
believe the additional requirements are worth it. That said, I've been
considering an alternative approach that is based on a single byte era
prefix. This would encode the timestamp into two parts, a 8-bit prefix
followed by a uvarint <= (2^32)-1. For now, I just picked a format
that would work, with the intent of revisiting it once typed codecs
come up for formal discussion after the august interop event.

> 4. I'm not super-keen on grouping the headers into 4 bins ahead of time, since that increases encoder storage requirements.  Also, there isn't a way to just replace the value for an existing indexed header in your current draft.  Perhaps a hybrid approach where the indexed representation can have 1-to-64 indexes and the others encode a single name/value?  Something like this:
>

A small amount of buffering is required with the grouping approach,
but the encoder controls how much. An encoder that chooses less
buffering would see a bit more encoding overhead. An encoder could
choose to encode each header individually, without grouping, at the
cost of one additional octet per header.

The Indexed Literal Replacement can be used to replace just the value
of an existing header... for instance, suppose I have an existing
entry at position #1 with name="foo", value=1. I want to keep the same
name but replace the value with 2, I would send:

  C0 01 20 01 02

The first octet identifies this as an Indexed Literal Replacement
group with one item.
The second octet identifies the Index position being replaced
The third specifies that the value is an Integer, with the five-least
significant bits set to zero, indicating that a name index reference
is provided by the fourth octet
The fourth octet is the name index reference. We're pointing the index
#01 (the same index that's being replaced)
The fifth octet provides the new value.

Because the name resolution is done before the replacement, the name
is reused and just the value is replaced.

- James