Re: [hybi] frame length encoding

"Shelby Moore" <shelby@coolpage.com> Sun, 22 August 2010 10:15 UTC

Return-Path: <shelby@coolpage.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 7DE2B3A67C0 for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 03:15:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.162
X-Spam-Level:
X-Spam-Status: No, score=-2.162 tagged_above=-999 required=5 tests=[AWL=0.437, BAYES_00=-2.599]
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 QzCi0fTpJWpJ for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 03:15:49 -0700 (PDT)
Received: from www5.webmail.pair.com (www5.webmail.pair.com [66.39.3.83]) by core3.amsl.com (Postfix) with SMTP id 76AF73A63EC for <hybi@ietf.org>; Sun, 22 Aug 2010 03:15:49 -0700 (PDT)
Received: (qmail 4810 invoked by uid 65534); 22 Aug 2010 10:16:23 -0000
Received: from 121.97.54.174 ([121.97.54.174]) (SquirrelMail authenticated user shelby@coolpage.com) by sm.webmail.pair.com with HTTP; Sun, 22 Aug 2010 06:16:23 -0400
Message-ID: <77aecf89c6c8673f1b999f80fa04e005.squirrel@sm.webmail.pair.com>
In-Reply-To: <8cd6ecfebb4a073ecf94c8e1aa56e642.squirrel@sm.webmail.pair.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com> <alpine.DEB.2.00.1008212037190.27211@tvnag.unkk.fr> <AANLkTinrsT+wV48nHvVW_1ChGYffkq7jisU2-PZnMyKg@mail.gmail.com> <alpine.DEB.2.00.1008212123460.27211@tvnag.unkk.fr> <20ef7ed5e135c57c1ee5a741658b9d98.squirrel@sm.webmail.pair.com> <1282423311.2014.6.camel@tng> <224b9ed365bd78fd5e316b8cb5f3f837.squirrel@sm.webmail.pair.com> <1282435214.2014.14.camel@tng> <AANLkTimo0MwZEMn1t1vrASfwC1bx82Q9Z_Ls3wVb-zUS@mail.gmail.com> <b95f074b65875865802f532bb5668ff2.squirrel@sm.webmail.pair.com> <AANLkTi=AXLFPSASV2zkBiUU=1StO=YSrKq_9AZ2ZnVHy@mail.gmail.com> <8cd6ecfebb4a073ecf94c8e1aa56e642.squirrel@sm.webmail.pair.com>
Date: Sun, 22 Aug 2010 06:16:23 -0400
From: Shelby Moore <shelby@coolpage.com>
To: shelby@coolpage.com
User-Agent: SquirrelMail/1.4.20
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] frame length encoding
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: shelby@coolpage.com
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 10:15:50 -0000

>>  The only thing that truly matters are what kinds of messages we want to
>> handle with the protocol.  My point is that there's no reason for a
>> websocket client or server to handle a single message >4GB.
>
>
> You won't have to.  You will tell the other end your maximum frame size on
> the connection handshake, then the other end will re-fragment if
> necessary.
>
>
>>  For my chat
>> server that I'm building, any incoming message larger than 64KB is
>> likely
>> to
>> be ill-intended, and that's a very generous threshold.  Clearly the
>> threshold would be different for someone else's application.
>
> Apologies I forgot to make the above point in my prior reply. I could have
> been more concensus driven with that.

[snip]

>
> I do agree that I should not have made the point that you need to process
> 64-bit frames.  That would not be a free market. Rather we must have
> re-fragmentation, so that no WS server has to be forced into any maximum
> size.

Given the above point, those who are arguing against the CPU load to test
for value 126 and 127 to fork to 16-bit and 63-bit frame size of Option 2,
we instead could consider adding a byte to the header and give 1 to 32766
sizes without any test.  The end could set its maximum frame size to 32766
on connection handshake, and then it never needs to perform that logic in
CPU.  They just load 2 byte size field and use it.

That eliminates the 16-bit size field of Option 2.  It is extends the size
field of Option 1.

That would cost us an extra byte on every frame, but the minimum frame
size is 3 already, and those who were arguing that point, said that
network speed will increase faster than CPU because there is no way to
parallelize (use multi-cores) for a serial channel that has no rewind
feature (unless you buffer and use pipelining perhaps?).

Also what are we using the 0 size value for? Couldn't we add 1 to the size
field to get the size?

Also for the special case where the maximum frame size is set on
connection handshake to 32767 (instead of 32766), no need to escape that
into an 8 byte size field.