Re: [hybi] Framing take IV [why fragment]

John Tamplin <jat@google.com> Thu, 05 August 2010 15:38 UTC

Return-Path: <jat@google.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 8F6A63A67F5 for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 08:38:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.847
X-Spam-Level:
X-Spam-Status: No, score=-105.847 tagged_above=-999 required=5 tests=[AWL=0.129, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 UKV6szKihL3m for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 08:38:53 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id EBD723A6800 for <hybi@ietf.org>; Thu, 5 Aug 2010 08:38:52 -0700 (PDT)
Received: from wpaz9.hot.corp.google.com (wpaz9.hot.corp.google.com [172.24.198.73]) by smtp-out.google.com with ESMTP id o75FdM6e027595 for <hybi@ietf.org>; Thu, 5 Aug 2010 08:39:22 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1281022762; bh=rJ64vDEt7NLQINUXTOxIwQBTCNU=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cQZov5feXde1nvmxwWeJtMRcznFjMi0uI4lT64h6roeKSufBotFLLM8c0cgfwyD/u gy+AdaBxj4/d59CJ72OKQ==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:from:date:message-id: subject:to:cc:content-type:x-system-of-record; b=eKnzsMJUSq6ddz5c+yPTcBWEyCvHiG7RFThbrb4wfgpF8Wwn7XSBBsQrDJwHTdUqH wDVE4MdhGbEM+ZPK4X5CQ==
Received: from gwb11 (gwb11.prod.google.com [10.200.2.11]) by wpaz9.hot.corp.google.com with ESMTP id o75FdLn5022766 for <hybi@ietf.org>; Thu, 5 Aug 2010 08:39:22 -0700
Received: by gwb11 with SMTP id 11so2829959gwb.18 for <hybi@ietf.org>; Thu, 05 Aug 2010 08:39:21 -0700 (PDT)
Received: by 10.151.130.15 with SMTP id h15mr12547303ybn.378.1281022758262; Thu, 05 Aug 2010 08:39:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.60.3 with HTTP; Thu, 5 Aug 2010 08:38:58 -0700 (PDT)
In-Reply-To: <2286.1281017237.786534@puncture>
References: <AANLkTinyrDoG5d_Ur6HVRy=SgMPjLzJtpJ++Ye=1DQdj@mail.gmail.com> <Pine.LNX.4.64.1008040050040.5947@ps20323.dreamhostps.com> <1280932393.7561.271.camel@tng> <2286.1281017237.786534@puncture>
From: John Tamplin <jat@google.com>
Date: Thu, 05 Aug 2010 11:38:58 -0400
Message-ID: <AANLkTimWeL5Td0_H0+q+p=CpPqy-GAdhiKxqr5yyGNzL@mail.gmail.com>
To: Dave Cridland <dave@cridland.net>
Content-Type: multipart/alternative; boundary="0016368e266d7498b5048d155a14"
X-System-Of-Record: true
Cc: Server-Initiated HTTP <hybi@ietf.org>
Subject: Re: [hybi] Framing take IV [why fragment]
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 15:38:54 -0000

On Thu, Aug 5, 2010 at 10:07 AM, Dave Cridland <dave@cridland.net> wrote:

> On Wed Aug  4 15:33:13 2010, Patrick McManus wrote:
>
>> On Wed, 2010-08-04 at 00:53 +0000, Ian Hickson wrote:
>> >  I could see an argument for supporting
>> > fragmentation in the case of multiplexing, but without that it doesn't
>> > seem to actually gain us anything.
>>
>> In the absence of fragmentation the sender must have the entire message
>> available in order to prefix the total length in the header - so it
>> engages in store and forward instead of streaming behavior.
>>
>>
>>  I think some of these are bad arguments.


Imagine we have frame-based compression (I know this still up for debate,
though I think a good case has been made that we need to be able to compress
some payloads and not others).  Then the code is going to look something
like this:

empty output buffer
while there is input data
    read the next buffer full (if not already in a byte array/string)
    while the input buffer is not empty
      compress the input buffer into the output buffer
      if output buffer is full, send a non-final frame with the output
buffer and clear it
      advance the input buffer pointer
    end while
end while
send a final frame with the output buffer

If we don't have chunking, we must buffer the entire compressed output in
memory, which means allocating and reallocating an arbitrarily large buffer
rather than sending each output buffer's full of data.

No, because the receiver cnnot process portions of messages - at least with
> our current API. And you can achieve this behaviour by sending multiple
> messages anyway.


For per-frame compression, you certainly can decompress each chunk as you
receive it.  Yes, the JS API currently does not have a way to pass partial
messages, and perhaps that needs to get fixed when binary support is added
since it seems more likely you will want to be able to react to partial
messages as each part is received.

-- 
John A. Tamplin
Software Engineer (GWT), Google