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

Patrick McManus <mcmanus@ducksong.com> Wed, 04 August 2010 16:02 UTC

Return-Path: <mcmanus@ducksong.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 14B003A685B for <hybi@core3.amsl.com>; Wed, 4 Aug 2010 09:02:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.434
X-Spam-Level:
X-Spam-Status: No, score=-2.434 tagged_above=-999 required=5 tests=[AWL=0.165, BAYES_00=-2.599]
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 OYOQtD+IHX1Z for <hybi@core3.amsl.com>; Wed, 4 Aug 2010 09:02:00 -0700 (PDT)
Received: from linode.ducksong.com (linode.ducksong.com [64.22.125.164]) by core3.amsl.com (Postfix) with ESMTP id 74D0D3A683A for <hybi@ietf.org>; Wed, 4 Aug 2010 09:02:00 -0700 (PDT)
Received: by linode.ducksong.com (Postfix, from userid 1000) id 017F3102A5; Wed, 4 Aug 2010 12:02:29 -0400 (EDT)
Received: from [192.168.16.214] (cpe-67-253-92-25.maine.res.rr.com [67.253.92.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by linode.ducksong.com (Postfix) with ESMTPSA id E77AD1014F; Wed, 4 Aug 2010 12:02:27 -0400 (EDT)
From: Patrick McManus <mcmanus@ducksong.com>
To: Maciej Stachowiak <mjs@apple.com>
In-Reply-To: <2AD09E86-CFFE-4378-A437-7EAE2E3026FD@apple.com>
References: <AANLkTinyrDoG5d_Ur6HVRy=SgMPjLzJtpJ++Ye=1DQdj@mail.gmail.com> <Pine.LNX.4.64.1008040050040.5947@ps20323.dreamhostps.com> <AANLkTi=3CJDKu37LV+6CG=d7VP5fOe-JNV9Cd=99BjjA@mail.gmail.com> <2AD09E86-CFFE-4378-A437-7EAE2E3026FD@apple.com>
Content-Type: text/plain; charset="UTF-8"
Date: Wed, 04 Aug 2010 12:04:01 -0400
Message-ID: <1280937841.7561.292.camel@tng>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3
Content-Transfer-Encoding: 7bit
Cc: 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: Wed, 04 Aug 2010 16:02:02 -0000

On Tue, 2010-08-03 at 18:20 -0700, Maciej Stachowiak wrote:

>  people think fragmentation is simpler than a variable size length
> field, they should explain why, 


My previous mail
( http://www.ietf.org/mail-archive/web/hybi/current/msg02886.html )
provided some arguments other than simplicity in favor of chunking.

But I also believe fragments with fixed lengths are simpler than a BER
because properly aligned lengths are always correct data - there are no
error cases as all the bits are defined to be some quantity regardless
of their arrangement. BER has error cases and determining the expressed
quantity requires multiple indirections and a significant algorithm to
use it. 

That contrasts with a fixed length 16 bit unsigned integer that requires
only a load instruction and perhaps a built in byte order swap to use
it. The algorithm is literally already in all hardware.

The cost of chunking vs BER is going to be 1 header (~4 bytes) every
64KB and only occurs at all on messages over 64KB (which excludes lots
of use cases). That's cheap!

I will say this though - sometimes the receiver would like to know how
big the total message is upfront in order to do non fragmented
preallocation for example. If the sender knows that information (i.e. it
is not really streaming) but is sending a > 64KB message using fragment
framing there is no way to convey that useful info to the recvr up
front. An option, unrelated to the framing, might be used to carry that
info in a variable length format (ber or maybe even ascii hex..
whatever)