Re: [hybi] Frame size

Mike Belshe <mike@belshe.com> Mon, 19 April 2010 19:17 UTC

Return-Path: <mike@belshe.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 A1E4A3A6AA1 for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 12:17:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.707
X-Spam-Level:
X-Spam-Status: No, score=-0.707 tagged_above=-999 required=5 tests=[AWL=1.269, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001]
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 e4qSH4XKFiG5 for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 12:17:02 -0700 (PDT)
Received: from mail-pv0-f172.google.com (mail-pv0-f172.google.com [74.125.83.172]) by core3.amsl.com (Postfix) with ESMTP id B38B428B23E for <hybi@ietf.org>; Mon, 19 Apr 2010 12:16:03 -0700 (PDT)
Received: by pvf33 with SMTP id 33so3381347pvf.31 for <hybi@ietf.org>; Mon, 19 Apr 2010 12:15:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.143.44.3 with HTTP; Mon, 19 Apr 2010 12:15:52 -0700 (PDT)
In-Reply-To: <4BCC99E7.3030909@caucho.com>
References: <8B0A9FCBB9832F43971E38010638454F03E3F313ED@SISPE7MB1.commscope.com> <u2m2a10ed241004181635qd0554193v36da94ecd7284d31@mail.gmail.com> <l2o2a10ed241004181637hdfab97d5r68f6845be49e8ad8@mail.gmail.com> <20100419005102.GC18876@shareable.org> <g2n2a10ed241004182005n9d8a5f02o29702620ae6205f4@mail.gmail.com> <4BCBD6B6.7010802@caucho.com> <x2i2a10ed241004182127oaee6eaf2j8c56d967a55353ad@mail.gmail.com> <4BCBE72A.50009@caucho.com> <l2x2a10ed241004182306t6952ad5fw960b0351e4af7d51@mail.gmail.com> <4BCC99E7.3030909@caucho.com>
Date: Mon, 19 Apr 2010 12:15:52 -0700
Received: by 10.143.84.6 with SMTP id m6mr2312437wfl.8.1271704552649; Mon, 19 Apr 2010 12:15:52 -0700 (PDT)
Message-ID: <w2u2a10ed241004191215g5bebc81cz891872b8003ecdd@mail.gmail.com>
From: Mike Belshe <mike@belshe.com>
To: Scott Ferguson <ferg@caucho.com>
Content-Type: multipart/alternative; boundary="000e0cd5f5341eb43504849bca52"
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Frame size
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: Mon, 19 Apr 2010 19:17:03 -0000

On Mon, Apr 19, 2010 at 10:59 AM, Scott Ferguson <ferg@caucho.com> wrote:

> Mike Belshe wrote:
>
>>
>> So, given the WebSockets API, how would chunks be used?  The application
>> calls send(DOMString).  There is no need for chunking here, because the full
>> string (and it's length) is already available.  Or did I miss something?
>>
> Yes, you forgot the server side :)
>
> Buffering the message on the client is essentially unavoidable and not a
> major problem, because the client is only managing a small number of
> connections. The server is running 100s or possibly 1000s and really doesn't
> want to buffer entire messages before sending it out.
>
>
>>    To tie this into the KISS requirement, it's a way to keep the
>>    client/server APIs and application code simple for the simple
>>    cases. Applications don't need to know about frames/chunks, just
>>    messages.
>>
>>
>> KISS, I think, would have solve the problem in the simplest way to support
>> the WebSockets API.
>>
> The chunking is needed to support the client WebSockets API to receive
> messages.
>
> Since the WebSockets API needs to receive the entire message, not the
> individual frames, the chunking is needed to support the API on the
> receiving end. It's true that the browser client buffers the entire response
> (not the only client, BTW).
>
> In other words, it is the simplest way to support the WebSockets API.
>
>
>> Are there really other protocols to be solved with the same websockets
>> framework?  (if so, let's list them!)
>>
> Technically, every application will invent its own protocol. "tic-tac-toe"
> uses a tic-tac-toe protocol. XMPP (or HMTP) over WebSockets. REST over
> websockets.  WebSockets isn't a full protocol stack, its just a layer
> (though an important one.)
>
>  My biggest fear is that a generic protocol will take a very high burden of
>> proof for implementation and deployment because it will offer so many
>> features and that this time will only delay solving the one problem we do
>> know of (fix hanging GET) while not really solving any other specific
>> problem either.  By contrast, if we stay focused on the problem at hand,
>> coming to agreement on the WebSockets protocol seems quite achievable.
>>
> We're talking about a very simple protocol. No one wants to make it
> complicated. Here's essentially the entire frame grammar (for something like
> Martin's proposal.)
>
>  stream ::= message*
>  message ::= non-final-frame* final-frame
>  non-final-frame ::= (0x4000 | length) <octet-data>
>  final-frame ::= (0x0000 | length) <octet-data>
>
> Done.
>

You've convinced me.

Thanks,
Mike


>
> If we do add the keepalive capabilities, close messages, error conditions
> (and the NAT discussion is convincing me that heartbeat/keepalive might be
> needed), those are a few, enumerated, specific packets.
>
> 0xff00 - keepalive packet
> 0xffff - graceful close
> 0xff01 - negotiation (?) e.g. requesting a server heartbeat/keepalive
> timeout if keepalives are implemented as unidirectional heartbeats.
>
> etc. (I'd think these would be extremely limited in number.)
>
> The concepts are more complicated than the bytes will be.
>
> -- Scott
>
>  I'm relatively new to this group and may be completely off base - so my
>> apologies if I am :-)  But I was at the IETF mtg on the topic, and it didn't
>> seem that we were  in agreement on what we're doing there either...
>>
>
>
>> Mike
>>
>>
>>
>>
>>    -- Scott
>>
>>
>>        Mike
>>
>>           Here's a basic, typical application. Suppose messages are XMPP
>>           packets (ours are binary HMTP, but the idea's the same). The
>>           message is identical to the entire packet.  The sender
>>        don't know
>>           how big the packet will be until serialization completes, but
>>           receivers may need to know the message/packet end before
>>        parsing.
>>
>>           For sanity and performance, we use a fixed-size output
>>        buffer for
>>           each packet. Each frame is a fragment of the XMPP packet
>>        and the
>>           message only ends with the final frame. We don't know the
>>        length
>>           of the entire packet until the entire thing is serialized.
>>        So the
>>           protocol needs multiple frames forming a message.
>>
>>           This is a very basic pattern. There's nothing unusual about
>>        it and
>>           I don't see how smaller frames addresses the issue, because
>>        it's
>>           the message boundary that's important. If you're not marking
>>           message boundaries, you may as well eliminate the frames
>>        entirely
>>           and just have raw TCP.
>>
>>           16 vs 32 vs variable-length integer encoding isn't hugely
>>           important. Chunking is important.
>>
>>               Overall, I'm talking about simplicity.  A 32bit fixed
>>        length
>>               is simple and sufficient for purposes today and tomorrow.
>>
>>           HTTP's fixed Content-Length is not sufficient for the same
>>        reasons.
>>
>>           -- Scott
>>
>>
>>
>>
>>
>