Re: [hybi] frame length encoding

John Tamplin <jat@google.com> Sat, 21 August 2010 16:15 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 C0BCD3A67F4 for <hybi@core3.amsl.com>; Sat, 21 Aug 2010 09:15:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.097
X-Spam-Level:
X-Spam-Status: No, score=-105.097 tagged_above=-999 required=5 tests=[AWL=0.879, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, 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 7TcS7u8j4Tr7 for <hybi@core3.amsl.com>; Sat, 21 Aug 2010 09:15:31 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.35]) by core3.amsl.com (Postfix) with ESMTP id 4A0E93A687F for <hybi@ietf.org>; Sat, 21 Aug 2010 09:15:31 -0700 (PDT)
Received: from hpaq5.eem.corp.google.com (hpaq5.eem.corp.google.com [172.25.149.5]) by smtp-out.google.com with ESMTP id o7LGG4Oi023211 for <hybi@ietf.org>; Sat, 21 Aug 2010 09:16:04 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1282407364; bh=V0n4fI2UzvDr1n8DAqrtbqlx2ow=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qPIrIZaViJ+qwHdvODXnU3qWPn0GdXrzOoLxFSr4DFV+B2Hk8gkIPb7OZVLaZtodQ wzZaABBHrQok9mdG0yvQQ==
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=yAJ3Jid7mcCrAIrgEqz+JV/ib/nIlFY7a9LpObKtAaMPkI8Q8ILwMpXLRLNxMz4CP 03zgwF++5pgpICojyf0EA==
Received: from gxk25 (gxk25.prod.google.com [10.202.11.25]) by hpaq5.eem.corp.google.com with ESMTP id o7LGG29c010088 for <hybi@ietf.org>; Sat, 21 Aug 2010 09:16:03 -0700
Received: by gxk25 with SMTP id 25so2000329gxk.1 for <hybi@ietf.org>; Sat, 21 Aug 2010 09:16:02 -0700 (PDT)
Received: by 10.151.101.19 with SMTP id d19mr3146634ybm.330.1282407362179; Sat, 21 Aug 2010 09:16:02 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.60.3 with HTTP; Sat, 21 Aug 2010 09:15:42 -0700 (PDT)
In-Reply-To: <8586ffdbc1c035a949df3965da5f489a.squirrel@sm.webmail.pair.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com> <20100820192927.GA32620@1wt.eu> <4C6EEA55.2050205@hs-weingarten.de> <AANLkTinHqxUOZaVANFpC52t8FfgNw2L5_A-s9Az3Fm7p@mail.gmail.com> <9038007a07cb2e7f2659663b8bc6af82.squirrel@sm.webmail.pair.com> <8586ffdbc1c035a949df3965da5f489a.squirrel@sm.webmail.pair.com>
From: John Tamplin <jat@google.com>
Date: Sat, 21 Aug 2010 12:15:42 -0400
Message-ID: <AANLkTinkYMN8LyU7432v2PZjrQ0Z7cN7mcwwzYwCwhON@mail.gmail.com>
To: shelby@coolpage.com
Content-Type: multipart/alternative; boundary="00151750ef0247b40e048e57bb03"
X-System-Of-Record: true
Cc: Hybi <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: Sat, 21 Aug 2010 16:15:32 -0000

On Sat, Aug 21, 2010 at 11:14 AM, Shelby Moore <shelby@coolpage.com> wrote:

> Correction:
>
> long long len = readByte();
> if (len >= 128)
>     len = ((len & 0x7f) << 8) + readByte();
> else if (len == 127)
>    len = readLongLong();
>

Ok, so you are suggesting using RSV2 to differentiate 7/63-bit from 15-bit
lengths, and then within the 7/63-bit option using a value of 127 to do so,
right?

I still dislike using up one of the reserved bits, as it reduced our
expansion options.  Also, as posted previously, I think once compression is
supported, an overwhelming majority of real-world WebSocket messages will
fit in ~126 bytes.  That is why I am mostly indifferent between option 1 and
2 -- I don't think the 2-byte length value will get used very often (I
expect mostly small frames with some very large frames where an entire file
is sent in one message), but the cost of adding it over option 1 is
relatively small (packets of exactly 126 bytes now take 2 bytes longer,
everything else is the same).

I do prefer your proposal over Option #3, which also uses one reserved bit,
but otherwise I still prefer either #1 or #2 because I think removing 1/3 of
our expansion capability is excessive for what is gained.

The reason I feel strongly about keeping reserved bits available for
expansion, is that we have not yet agreed on how extensions should work.  If
we decide to go the nested opcode approach (an extension opcode uses the
first part of the payload data for its extension data, then the next opcode
etc, until you get to a "data" opcode that uses what is left), then I think
we are going to need to assign both RSV1 bits to the opcode to be able
to accommodate extensions there (remember that we don't want to have to
change the base framing protocol at all and this protocol will hopefully be
used for a long time).  If we decide to have per-frame compression
(certainly still up for debate), then we will likely need a single bit per
frame to indicate compression efficiently (there are certainly other ways to
do it as well).  If we decide to have separate extension metadata, we will
need a bit to indicate an extension length and extension data is present.
 And those are just the extensions we have been talking about the past few
months -- who knows what things we may come up with in the future that might
be more efficiently implemented if we assign one of the reserved bits rather
than an extension data block or an opcode?

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