HTTP in JSON Binary Encoding / Data Model
Phillip Hallam-Baker <hallam@gmail.com> Wed, 29 May 2013 16:33 UTC
Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0172F21F941D for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 29 May 2013 09:33:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.598
X-Spam-Level:
X-Spam-Status: No, score=-10.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NSOW3ycDSr3J for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 29 May 2013 09:33:36 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 0B18521F93ED for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 29 May 2013 09:33:35 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UhjIi-0003Kq-Dw for ietf-http-wg-dist@listhub.w3.org; Wed, 29 May 2013 16:32:36 +0000
Resent-Date: Wed, 29 May 2013 16:32:36 +0000
Resent-Message-Id: <E1UhjIi-0003Kq-Dw@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <hallam@gmail.com>) id 1UhjIK-0003HK-Ta for ietf-http-wg@listhub.w3.org; Wed, 29 May 2013 16:32:12 +0000
Received: from mail-we0-f175.google.com ([74.125.82.175]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <hallam@gmail.com>) id 1UhjIF-0000B0-8J for ietf-http-wg@w3.org; Wed, 29 May 2013 16:32:12 +0000
Received: by mail-we0-f175.google.com with SMTP id p60so6604515wes.34 for <ietf-http-wg@w3.org>; Wed, 29 May 2013 09:31:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=t5V5V/Lp1mhL70WpSIebywGlU5UZFlzUQaNWjbqUG0A=; b=S0MRuIzTfEmDgxfj21X8c8edHTBsh9ALcUbL+VskkoXVDqpwFiFH+iiNiR0Dbx5ti8 nDHjA7MOFfBAU1vQxdNAG9Ns4foF1tsv+xGFS5QlyUAYE2CkRpMMzvSdUPU+1uPZPHYG tbgUDKFufInzOE8ys9sXtr7pu67Pikh0jGT1qdyQTXMzVbo5OhH1bgG3FWwFKQncUgxz S0+t8HLs0E/PvCo3wAesEXGXe5POM1thBblKb8Rma3hadXBqkZWaWWAk4S7S7AM8H7ya 1CL16dJ0cZqC6idXWGczsUu0ZeMGM4r9YmfZCr5X77w2KTzqVOddeVgx1xZ7NqAX7XJ+ S/Ug==
MIME-Version: 1.0
X-Received: by 10.194.172.66 with SMTP id ba2mr2001860wjc.22.1369845101074; Wed, 29 May 2013 09:31:41 -0700 (PDT)
Received: by 10.194.44.100 with HTTP; Wed, 29 May 2013 09:31:40 -0700 (PDT)
Date: Wed, 29 May 2013 12:31:40 -0400
Message-ID: <CAMm+LwjTFm3prX2emJxWpZKfnRzgvvK+H9Rgz1AAoXBTQd=kTw@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: "ietf-http-wg@w3.org Group" <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="089e01184dd4a59f0804ddddeacd"
Received-SPF: pass client-ip=74.125.82.175; envelope-from=hallam@gmail.com; helo=mail-we0-f175.google.com
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.679, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1UhjIF-0000B0-8J 83ba9a0b7c90a0dcec91dfef8c70c57b
X-Original-To: ietf-http-wg@w3.org
Subject: HTTP in JSON Binary Encoding / Data Model
Archived-At: <http://www.w3.org/mid/CAMm+LwjTFm3prX2emJxWpZKfnRzgvvK+H9Rgz1AAoXBTQd=kTw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/18145
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>
Sorry for throwing this in at the last minute. But I think there are advantages to this scheme that make it likely that people will tread this path in the future regardless of what decision the WG comes to on HTTP encoding. I did consult with Mark Nottingham before throwing this in here. The idea that prompted this proposal was Hoffman and Bormann's CBOR proposal which defines a subset that provides a binary encoding of JSON. It seemed to me that many of the ideas raised in the HTTP encoding debate would be relevant to binary JSON. I also realized that to be useful in a Web Services context, any scheme would need something like the HTTP chunked transport encoding. The primary value of a binary encoding for JSON would be that it avoids the need to base64 encode binary blobs, a problem that gets a lot worse when nested binary structures are involved and the 33% overhead per pass rises exponentially. So imagine for the sake of argument we have an encoding for JSON that: * Is easy to convert existing JSON parsers/emitters to read/write * Is as compact as the JSON specification and with the same data model * Supports compression of strings to tag codes * Supports binary blobs of data * Supports chunked encoding of binary data and strings Such an encoding would have obvious advantage in Web Services applications that deal with large chunks of binary data. Instead of having to switch encodings or pass binary data as links, all the data can be managed in one framework. Now imagine that the Web Service could use the same encoding for the HTTP framing layer and the application layer. Instead of needing separate HTTP and application stacks, it is now easy to combine both in to a single scheme. This is the part of the ASN.1 vision that was brilliant. It was the implementation of ASN.1 that sucked. In this model HTTP headers would become JSON tags. Since JSON tags are simply strings, a mechanism that allowed codes to be substituted for strings would allow compression of both. Proposing a scheme that meets these requirements is not difficult and I propose to have one sometime next week. There are many other existing proposals including BJSON which is heavily used in MongoDB. And there is a whole set of arguments around the limitations that JSON imposes because it is not possible to convert between binary and decimal representations of floating point numbers without loss of precision which is a show stopper for scientific applications. For the sake of this argument assume that such an encoding can be devised that offers comparable space/time efficiency to other encoding proposals. This approach would be a huge win for Web Services. It would also provide an easy and consistent way to represent HTTP headers in JavaScript and other scripting languages so there are advantages to the browser side as well. The main problem is the time factor. Now is not the time to restart the coding discussion from scratch. But that is not the only area that this proposal would affect. The much bigger impact would be on the data model used to describe HTTP headers. If the group chooses a data model for HTTP headers that is aligned with the JavaScript data model and so has a convenient conversion into and out of JSON, it will be possible to adopt a binary encoding of JSON in Web Services applications at a later date. -- Website: http://hallambaker.com/
- HTTP in JSON Binary Encoding / Data Model Phillip Hallam-Baker
- Re: HTTP in JSON Binary Encoding / Data Model James M Snell
- Re: HTTP in JSON Binary Encoding / Data Model Phillip Hallam-Baker