Re: [hybi] CML

"Brian Smith" <brian@briansmith.org> Mon, 23 August 2010 16:46 UTC

Return-Path: <brian@briansmith.org>
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 29C783A689C for <hybi@core3.amsl.com>; Mon, 23 Aug 2010 09:46:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.991
X-Spam-Level:
X-Spam-Status: No, score=-1.991 tagged_above=-999 required=5 tests=[AWL=0.607, BAYES_00=-2.599, 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 8O3cMoIXKrAj for <hybi@core3.amsl.com>; Mon, 23 Aug 2010 09:46:03 -0700 (PDT)
Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) by core3.amsl.com (Postfix) with ESMTP id 9260C3A6903 for <hybi@ietf.org>; Mon, 23 Aug 2010 09:46:02 -0700 (PDT)
Received: from T60 (unknown [98.200.150.199]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id EAD98509DC; Mon, 23 Aug 2010 12:46:29 -0400 (EDT)
From: Brian Smith <brian@briansmith.org>
To: hybi@ietf.org
References: <8B0A9FCBB9832F43971E38010638454F03EF2669F2@SISPE7MB1.commscope.com> <AANLkTi=G-gZ1+7uoYE=fhiKFUXoziWacx5_k-HfxC-0z@mail.gmail.com> <8B0A9FCBB9832F43971E38010638454F03EF266A07@SISPE7MB1.commscope.com> <AANLkTimTBLvHXTGciDM4ef1hNXPHn7cjR-kxbd8pBq3+@mail.gmail.com> <8B0A9FCBB9832F43971E38010638454F03EF266A23@SISPE7MB1.commscope.com> <efa3d0a4449d1f830c095466238c5f81.squirrel@sm.webmail.pair.com> <AANLkTimk+roUEXiVKm18AfPBM4Sq4Hj6wxf007ZY=pxN@mail.gmail.com> <dda7ae8b47caed4b15305932cd8db7a7.squirrel@sm.webmail.pair.com> <AANLkTikYs6zdY2YNHb88f7n24BOp2k42VHGQuOQrRPQq@mail.gmail.com>
In-Reply-To: <AANLkTikYs6zdY2YNHb88f7n24BOp2k42VHGQuOQrRPQq@mail.gmail.com>
Date: Mon, 23 Aug 2010 11:46:29 -0500
Message-ID: <005701cb42e2$bf8297c0$3e87c740$@briansmith.org>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0058_01CB42B8.D6ADEF50"
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQJMQCThV9lqCgsAbFXahF7t/SqzmgG0r1jQAe0UrlECptCIpAHiAl3NAdaKifQCru8nfgKDLHr2AVsrBzUBkSSa1A==
Content-Language: en-us
Subject: Re: [hybi] CML
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, 23 Aug 2010 16:46:04 -0000

The protocol should be designed to be optimized for any particular web browser memory allocation strategy. There is so many layers and each is potentially going to do its own fragmenting/coalescing: at the TCP/IP level, in the IP(v6) compression layer, in the operating system network buffer manager, in the operating system’s VMM, in the TLS stack (including an extra layer for compression), in the browser’s networking code (including possibly an extra layer for compression again), in the browser’s JavaScript buffer/string handling, etc. As long as the protocol is not designed maliciously, it should be straightforward to find a memory allocation strategy that adds virtually no overhead.

 

Plus, like somebody else pointed out, a lot of the buffer management stuff can be abstracted out at the application API level like boost::buffer_iterator and the old SGI Rope class do for C++. 

 

I think some basic problems have to be solved before it makes sense to try to resolve issues CML. For example, if WebSockets is to be a TLS-only protocol, then there are no intermediaries fragmenting messages according to their own whims. In the case of a multi-server configuration, the way messages are transferred between the servers is an implementation detail; the wire format used for framing between those servers could be completely different than the standard WebSockets wire format (e.g. just “real” TCP/IP), and even the format of the application data could be different (e.g. using efficient binary encodings instead of data that was originally sent JSON-encoded). It isn’t (necessarily) WebSockets all the way down.

 

Also, I joined the list late. Was there already a discussion about the merits of optimizing framing below the TCP/IP MTU? In particular, what is the motivation for optimizing the overhead of a 128 byte message when even a 512-byte message will still only require a single packet? If the idea is that many frames could be stuffed into a single TCP/IP packet when multiplexing is used, then it is probably better to instead directly address the overhead of that multiplexing. Perhaps techniques similar to the ones used in modern SQL databases (e.g. Oracle) for compression of data within a given block could be used: create a frame header format that can describe multiple frames much more compactly than it can describe frames individually, and send that “multi-header” ahead of all the frames it describes. But, such complexity should first have a clear concrete motivation.

 

Regards,

Brian

 

 

The browser now receives this first frame.  Ultimately, it wants to pass an object containing the message to JS code, and it needs to allocate a buffer to receive the data.  How big does it allocate?  Without CML, it doesn't know and must guess.  Note that if there were no intermediary introducing fragmentation, it would have had the buffer length required after reading the header of the first frame.  Note that it is not the application on the receiving end that consumes the CML, but rather then WS framing level, which is why the CML is included in the framing rather than the application data.