Re: [hybi] hum #3: Message

Greg Wilkins <gregw@webtide.com> Thu, 05 August 2010 21:50 UTC

Return-Path: <gregw@webtide.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 89E723A6B5E for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 14:50:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.734
X-Spam-Level:
X-Spam-Status: No, score=-1.734 tagged_above=-999 required=5 tests=[AWL=0.243, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622]
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 sHMcRUfcAMsD for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 14:50:33 -0700 (PDT)
Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by core3.amsl.com (Postfix) with ESMTP id 4ABE73A6B55 for <hybi@ietf.org>; Thu, 5 Aug 2010 14:50:01 -0700 (PDT)
Received: by fxm16 with SMTP id 16so2795290fxm.31 for <hybi@ietf.org>; Thu, 05 Aug 2010 14:50:31 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.123.79 with SMTP id o15mr11614097far.12.1281045031281; Thu, 05 Aug 2010 14:50:31 -0700 (PDT)
Received: by 10.223.57.12 with HTTP; Thu, 5 Aug 2010 14:50:31 -0700 (PDT)
In-Reply-To: <2286.1281043500.752860@puncture>
References: <4C5AE93D.4040803@ericsson.com> <Pine.LNX.4.64.1008051758290.5947@ps20323.dreamhostps.com> <AANLkTik0kbh14s2JZARY2MFh0iNGV7H+B4Px4yG+wX44@mail.gmail.com> <71BCE4BF-D3F6-4F94-BE76-306BDF6A2E67@apple.com> <Pine.LNX.4.64.1008051930160.5947@ps20323.dreamhostps.com> <4C5B1695.6070704@gmx.de> <F8E2F702-9F74-4316-B3B2-D5A731409ABF@apple.com> <4C5B2029.90403@gmx.de> <AANLkTim1WeCRfcPxXUNQcVhb4+t_TtDQDv2bXaxOQ=bk@mail.gmail.com> <01098AD0-FBF4-4A61-B565-947C95722BAA@apple.com> <C1A941B9-058C-4E1D-811A-92C94E18CBDE@apple.com> <2286.1281043500.752860@puncture>
Date: Fri, 06 Aug 2010 07:50:31 +1000
Message-ID: <AANLkTi=q_XEjKyK5vzFQhsZJOaxDh4QgXY1YnBJbG68P@mail.gmail.com>
From: Greg Wilkins <gregw@webtide.com>
To: Dave Cridland <dave@cridland.net>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Cc: Server-Initiated HTTP <hybi@ietf.org>
Subject: Re: [hybi] hum #3: Message
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: Thu, 05 Aug 2010 21:50:37 -0000

Eitherway, I'd like to express strong support for the main parts of the hum:

    *  "Message" is a protocol unit with an end
    * A message may be composed of one or more "frame"s
    * Each frame has a length indication


But I agree with everybody about the arguments for and against the
various length encodings. I think the reason is that everybody is
right!

Sometimes it is more efficient to send big content without chunking
it.  eg in Jetty we use the NIO gather write mechanism to send a
header from a memory buffer with a file mapped buffer of content.
This means the file is sent to the network interface without going via
user space memory.
But then I also very very rarely see any server side developers set
the content-length of dynamic content, so that is almost always best
sent as chunks.  You can have some very large dynamic content coming
out of DB selects etc.


I think the best solution is  fragmentation plus a variable length
encoding since this allows:

 + chunking of dynamic content
 + sending of big content as a single frame
 + minimal cost in bytes for the most frequent little messages.
 + having fragments in the base protocol means that all extensions
must handle them and thus it makes it easier to add extensions like
multiplexing without breaking other things.

The main down side I can think of is that it makes it harder to word
align header and data, but then I don't see a large demand for that.

There is some extra complexity on the receiver for fragments, but I do
not think it is significant.


regards






On 6 August 2010 07:25, Dave Cridland <dave@cridland.net> wrote:
> On Thu Aug  5 22:18:01 2010, Maciej Stachowiak wrote:
>>
>> On Aug 5, 2010, at 2:09 PM, Maciej Stachowiak wrote:
>>
>> >
>> > On Aug 5, 2010, at 1:43 PM, Jack Moffitt wrote:
>> >
>> >>>> Sending a file from disk to the network without processing it in any
>> >>>> way
>> >>>> is more efficient than cutting it into slices and interleaving with
>> >>>> headers.
>> >>>> The IP layer is already going to cut it into slices, in a way that
>> >>>> almost
>> >>>> certainly won't line up with WebSocket-level fragment boundaries.
>> >>>
>> >>> There's no way to "send a file over the network without processing".
>> >>> You
>> >>> need to read it into memory, and then write it to the network. Of
>> >>> course
>> >>> adding frame headers *is* overhead, but it's really identical or close
>> >>> to
>> >>> the overhead on the wire, nothing more.
>> >>
>> >> The kernel's sendfile() is responsible for a lot of the HTTP server
>> >> optimization for static resources, and for this case, I think it is
>> >> true that doing any framing that shows up in the middle of the file
>> >> would lead to a big inefficiency.
>> >>
>> >> I'm not sure how useful this pattern is with dynamic data though. I
>> >> think people will continue to send most static resources via regular
>> >> HTTP because it is very, very good at it.
>> >
>> > I think there's definitely use cases for transferring large static
>> > resources over WebSocket. Consider syncing a media library where items may
>> > have been added on either end.  Sync seems like a pretty likely target for
>> > WebSocket. You will want to do large static transfers in both directions,
>> > and it seems better to use the existing warmed-up WebSocket TCP connection
>> > than to make fresh HTTP connections.
>>
>> If it's an optional extension that intermediaries could ignore, that makes
>> it unlikely that there will be a default expectation that it should be sent
>> and have a correct value.
>
> I'm fine withdefining the extension in the core spec, and making this a
> SHOULD. I can see cases meaning it cannot be a MUST. Would this satisfy?
>
> Dave.
> --
> Dave Cridland - mailto:dave@cridland.net - xmpp:dwd@dave.cridland.net
>  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
>  - http://dave.cridland.net/
> Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>