Re: [hybi] Frame size

Scott Ferguson <ferg@caucho.com> Mon, 19 April 2010 17:59 UTC

Return-Path: <ferg@caucho.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 945F93A62C1 for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 10:59:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.122
X-Spam-Level:
X-Spam-Status: No, score=-0.122 tagged_above=-999 required=5 tests=[AWL=-0.123, BAYES_50=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 hsI5d5gNeiqr for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 10:59:16 -0700 (PDT)
Received: from smtp111.biz.mail.re2.yahoo.com (smtp111.biz.mail.re2.yahoo.com [66.196.116.96]) by core3.amsl.com (Postfix) with SMTP id 6DF863A688F for <hybi@ietf.org>; Mon, 19 Apr 2010 10:59:16 -0700 (PDT)
Received: (qmail 20005 invoked from network); 19 Apr 2010 17:59:05 -0000
Received: from [192.168.1.10] (ferg@66.92.8.203 with plain) by smtp111.biz.mail.re2.yahoo.com with SMTP; 19 Apr 2010 10:59:04 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: 7lq8FyIVM1nKQXomhACP5CksJjbidgx7DxX0kQoTvMzNytnihDXNytYF0epiZvsKELntFxEonPSlI4yq1DudGK8RqPc2202KpR384uOPZ7_dT4FWeBLNvWWXpiZpAPX.aK1ds9EVW7QVuuu9PdJX2jvcsBjQk_TNZct0xs8SOka_7K_Zz1yVDHh0CQHAROxqYCrzNCfb2wCWx24zmBd.qRJ_iJJSIQj9MGaSIzs86wWdhwFvoJNiVT9QdFfyeZn86MWJGgVGFqKBrW.XibO5j0vhOXFo3ig94CW5BpkdYGw5z8TfXGkVas_bTdnHfeZ2rvnNw43oKzIICJvvQc0OpYMK90fpdZz0gEfVgOupMrqf25xgs_IDSKTLgz6Ckh1oCrtf30TjPXr70sHX.6.eseG3nLEchvIGeJYzHXvyqG4-
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4BCC99E7.3030909@caucho.com>
Date: Mon, 19 Apr 2010 10:59:03 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: Mike Belshe <mike@belshe.com>
References: <8B0A9FCBB9832F43971E38010638454F03E3F313ED@SISPE7MB1.commscope.com> <t2iad99d8ce1004160949yb1ba9582l3b626c19dacf8d9@mail.gmail.com> <4BC96DA1.3000706@webtide.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>
In-Reply-To: <l2x2a10ed241004182306t6952ad5fw960b0351e4af7d51@mail.gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
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 17:59:17 -0000

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.

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
>
>
>
>