Re: [hybi] frame length encoding

John Tamplin <jat@google.com> Sun, 22 August 2010 21:48 UTC

Return-Path: <jat@google.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 322DC3A6969 for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 14:48:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.88
X-Spam-Level:
X-Spam-Status: No, score=-104.88 tagged_above=-999 required=5 tests=[AWL=0.212, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_FONT_FACE_BAD=0.884, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t6aPSIeS5myn for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 14:48:12 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.35]) by core3.amsl.com (Postfix) with ESMTP id 18A6B3A6962 for <hybi@ietf.org>; Sun, 22 Aug 2010 14:48:06 -0700 (PDT)
Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id o7MLmeKh012292 for <hybi@ietf.org>; Sun, 22 Aug 2010 14:48:40 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1282513720; bh=003eEXLOghr5FiriPbmfLl4CVK4=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=tGUt2a4y5vgQ23JQl7f+KM7mBGkP/k7af787MtdG1QyC0ag10WCQhv976v+7d2G8P AwUehMn+Hgj5YJZQZjGwg==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:from:date:message-id: subject:to:cc:content-type:x-system-of-record; b=fQ9hD+SlomNhJGQ8vJlcaF7sn95WVx5gPLpjsXTsczYwPyLDfhpD8b4hjgafCpM+A +LXHTte02lA1D70SlFNwQ==
Received: from yxk8 (yxk8.prod.google.com [10.190.3.136]) by hpaq3.eem.corp.google.com with ESMTP id o7MLmcqc010504 for <hybi@ietf.org>; Sun, 22 Aug 2010 14:48:38 -0700
Received: by yxk8 with SMTP id 8so2259088yxk.17 for <hybi@ietf.org>; Sun, 22 Aug 2010 14:48:38 -0700 (PDT)
Received: by 10.150.202.9 with SMTP id z9mr4541431ybf.3.1282513718192; Sun, 22 Aug 2010 14:48:38 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.60.3 with HTTP; Sun, 22 Aug 2010 14:48:18 -0700 (PDT)
In-Reply-To: <4C719640.6070808@caucho.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com> <20100820192927.GA32620@1wt.eu> <4C6EEA55.2050205@hs-weingarten.de> <AANLkTinHqxUOZaVANFpC52t8FfgNw2L5_A-s9Az3Fm7p@mail.gmail.com> <AANLkTinvkxMP8FYz9xjDu_Kt9FfzYotgsqXUDB4MZMEo@mail.gmail.com> <AANLkTim3KRq1arso7wN_b+1TH3sWabYW6uFu7AbYw6-P@mail.gmail.com> <AANLkTikhhajho895WyEoJMwMk9GJ98kA0Mjy5qr4apC8@mail.gmail.com> <AANLkTi=kdk6BRvza_7bpoLNTFzUkjcRRijGLMe_NGXZV@mail.gmail.com> <AANLkTi=VE298Tg+qyfufhzMswE5pBxtPZhA0t2k=sf2A@mail.gmail.com> <4C717048.5020309@ericsson.com> <4C717B28.4070009@caucho.com> <4C717E1A.5000404@ericsson.com> <AANLkTimtNN1oW2TB30cS1Ew9pSxWNNsY9FH7Eu4EpQMb@mail.gmail.com> <4C719640.6070808@caucho.com>
From: John Tamplin <jat@google.com>
Date: Sun, 22 Aug 2010 17:48:18 -0400
Message-ID: <AANLkTiki7n2yu-6kATnntspEM1NYQ2uC0N3cDMWdKG+C@mail.gmail.com>
To: Scott Ferguson <ferg@caucho.com>
Content-Type: multipart/alternative; boundary="000e0cd4d25297ac63048e707ed4"
X-System-Of-Record: true
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] frame length encoding
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Aug 2010 21:48:15 -0000

On Sun, Aug 22, 2010 at 5:27 PM, Scott Ferguson <ferg@caucho.com> wrote:

> I still think it is a mistake to increase the size of the overwhelming
>> majority of frames to make things easier for the less-frequent (and larger,
>> so that the extra overhead is negligible) frames, but I am tired of arguing
>> about it.  If this is what people want then let's go with it.
>>
>
> I think the compact frame (LEN 00 = 0 byte length) would give you that
> efficiency because the compact frame only uses 2 bytes total for the header
> and length:
>
>
>  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
> +---+-+-+-------------+-+-------+
> |00 |T|F| length(7)   |R|OPCODE |
> |   |M|I|             |E|       |
> |   |L|N|             |S|       |
> +---+-+-+-------------+-+-------+
>
> Where length(7) is the payload length and the payload immediately follows
> the header.
>

The problem with this is we only have a single reserved bit, which is highly
unlikely to be sufficient when we get to extensions.  That means if those
extensions are commonly used, we will be paying the extra byte anyway and be
doing it in a more awkward way.


> If we were willing to trade some extra complexity for extension bits, we
> could even reuse the TML and FIN bits for the compact header, because those
> bits aren't needed for small frames. So the compact (2 byte) header might
> be:


If you are concerned about latency, you might well want to flush the buffer
with a small frame, with more fragments to follow when the dynamic content
is generated.


> 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
> +---+---------------+---+-------+
> |00 | length(8)     |RES|OPCODE |
> |   |               |   |       |
> |   |               |   |       |
> +---+---------------+---+-------+
>
> I'm not sure if it's a good idea because it does make the compact frame a
> special case, but it frees up some extra reserved bits.
>

I think it is a false economy, because you only have 3 reserved bits in this
form, while 8 in the others.  If you assign a 4th reserved bit, you now have
to come up with a new way of representing it in the short frame, so those
extra reserved bits are less useful than the others.  Also, given the
complaints about complexity for simpler things, I can't imagine having
MORE/CMLP bits be dependent on the length-length bits would go over well.

I still think option #2 is the best compromise, and a number of people
agreed (and a number disagreed).  If that option isn't deemed acceptable and
having 4 length steps is preferred, I would rather just eat the extra byte
for small frames and go with the suggestion above, having headers of 3, 4,
6, and 10 bytes with 8 reserved bits between the defined flags and the
opcode, as in:

   - More - 1 bit
   - CMLP - 1 bit
   - LenLen - 2 bits
   - Reserved - 8 bits
   - Opcode - 4 bits
   - Length - 2^LenLen bytes
   - CML - 8 bytes - present only if CMLP=1
   - Payload - Length bytes

Otherwise, as before.

-- 
John A. Tamplin
Software Engineer (GWT), Google