Re: [hybi] Call for Consensus: draft-tyoshino-hybi-websocket-perframe-deflate as WG Item

John Tamplin <jat@google.com> Fri, 02 March 2012 01:11 UTC

Return-Path: <jat@google.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0FBB521E8187 for <hybi@ietfa.amsl.com>; Thu, 1 Mar 2012 17:11:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.976
X-Spam-Level:
X-Spam-Status: No, score=-102.976 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
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 SKv-pGzm1qyN for <hybi@ietfa.amsl.com>; Thu, 1 Mar 2012 17:10:59 -0800 (PST)
Received: from mail-qw0-f44.google.com (mail-qw0-f44.google.com [209.85.216.44]) by ietfa.amsl.com (Postfix) with ESMTP id E969F21E8062 for <hybi@ietf.org>; Thu, 1 Mar 2012 17:10:58 -0800 (PST)
Received: by qadc14 with SMTP id c14so23398qad.10 for <hybi@ietf.org>; Thu, 01 Mar 2012 17:10:58 -0800 (PST)
Received-SPF: pass (google.com: domain of jat@google.com designates 10.224.218.10 as permitted sender) client-ip=10.224.218.10;
Authentication-Results: mr.google.com; spf=pass (google.com: domain of jat@google.com designates 10.224.218.10 as permitted sender) smtp.mail=jat@google.com; dkim=pass header.i=jat@google.com
Received: from mr.google.com ([10.224.218.10]) by 10.224.218.10 with SMTP id ho10mr6176681qab.16.1330650658534 (num_hops = 1); Thu, 01 Mar 2012 17:10:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record; bh=uPkTSr48RJSTgz4inPO2DPKZFNrukwWUiugVZV8mirE=; b=Im6ugk8BhlPmXn+9K67HEdPm2Q2EZciIPhuP4eRnhK2W7g2Irrl2QUL/5QDTlm4g+A nFKwfNyNmACkL9ZAiSnZywd2aNq7iv8Qt3oorATtNoFq2lOj4ll/kJcoyL6dV/soYDRT tCeu8mD0ok7qxnFDhsLtxnDFm8bB1Y6X+8HJ3LvvL2IMFmZ8GPoRhcTpkreYcQKC2gfm aBQFAZZIp9OUyGa3RrQn1ScfJ0yfIr7gD3qrsSqI4rmgpEuIGGfrnkdpEfLxrZHddt2E XESZSdm3QJknJl0Bmlf6oMZ2jljI3yNTqyl731nHLr3UHQESzXgvKUqqCmzv7oRkeEX9 NzuA==
Received: by 10.224.218.10 with SMTP id ho10mr5186463qab.16.1330650658431; Thu, 01 Mar 2012 17:10:58 -0800 (PST)
Received: by 10.224.218.10 with SMTP id ho10mr5186454qab.16.1330650658268; Thu, 01 Mar 2012 17:10:58 -0800 (PST)
MIME-Version: 1.0
Received: by 10.229.103.149 with HTTP; Thu, 1 Mar 2012 17:10:38 -0800 (PST)
In-Reply-To: <CAE8AN_XfYsqG6Vc6hd4=iu7hfk=gJ++JdYoJyvsQ3qHHRNW+MQ@mail.gmail.com>
References: <4F4C8568.7070403@ericsson.com> <CAH_y2NF0mG9+PWotJmG0e4trgSxhOtaoGXLeeQUS1Tn5zpZuYQ@mail.gmail.com> <CAH9hSJakzY8RAHgBgQbjGq4GvPJFdrtS8TXt_aUqjiwZCOZR-g@mail.gmail.com> <CABLsOLAZe3d3BXWMEvTL-nHAMRzXJ_F-eSCUnjdsN99CTnL99g@mail.gmail.com> <CAH_y2NHyp_1ZKVR18QDZMW0EB2X18UCNfv140RuFDfMThsHs1w@mail.gmail.com> <CAE8AN_XfYsqG6Vc6hd4=iu7hfk=gJ++JdYoJyvsQ3qHHRNW+MQ@mail.gmail.com>
From: John Tamplin <jat@google.com>
Date: Thu, 01 Mar 2012 20:10:38 -0500
Message-ID: <CABLsOLDZpdgo++jk_6-CV6s=kKNoYh0hsu1zDXaqmWUye3QNiA@mail.gmail.com>
To: Brian <theturtle32@gmail.com>
Content-Type: multipart/alternative; boundary="20cf300fad4fce668904ba383f93"
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQlm1t5UV3nds3UXqJuXfrKM6belmhpeWeuPvvr8Qn6SP24qKqskaWwA9l+DvbAzLe0OE9YVewgK8kJ75LzF3Tir7jrtAwzYDwaIrVSBS5WQGW7ZYT5/krZi/ZT3iLpEQ5cYS1P5
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Call for Consensus: draft-tyoshino-hybi-websocket-perframe-deflate as WG Item
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Fri, 02 Mar 2012 01:11:00 -0000

On Thu, Mar 1, 2012 at 7:58 PM, Brian <theturtle32@gmail.com> wrote:

> I like option "d."  One framing byte of overhead is practically nothing
> and enables lots of opportunities for tuning and control.  If the byte of
> overhead is too much for some people, perhaps there could be a
> configuration parameter during the handshake to allow the user to opt into
> across-the-board compression settings that would eliminate the byte and
> just apply to every frame.  That would allow users with
> consistently compressible data to eliminate the one byte overhead.
>
> Alternatively, we could define a control frame to configure the
> compression extension that could turn the per-frame control byte on or off.
>

The options of knowing what to compress are:
1) compress everything on a connection, configured at handshake time.  We
know compressing incompressible data is
a loss, so we would need to expose a way in the JS API to indicate whether
to use compression or not.  Applications that mix compressible and
incompressible data would use multiple connections (made less costly via
multiplexing).

2) compress only compressible data in a frame, leaving incompressible data
in uncompressed frames.  The choice of how to determine compressibility:
  2a) the API says whether it is compressible
  2b) the API gives a type of data being supplied, and an implementation
chooses whether to compress it based on the type
  2c) heuristic choices, such as "compress all text frames, leave binary
frames uncompressed" (though earlier experiments with GwtQuake over
WebSockets showed that even its binary data substantially benefited from
compression)
  2d) try and compress the data, and send it compressed only if it reduces
the size

Another question is about sharing compression state -- if we compress each
frame individually, we lose the benefit of redundancy with other frames.
 For example, the WS binary frames in GwtQuake saw little improvement at
all if each frame was compressed individually, but there was a lot of
redundancy across frames.  To take advantage of this, we need a compression
scheme that maintains a compression dictionary for the stream (which might
complicated 2d above depending on the compression library available).

As Greg said, if we aren't going to use a reserved bit for per-frame
compression, where we hope to reduce the payload to a small number of bytes
already so an extra byte to indicate compression may be expensive, what
exactly will we use it for?

My opinion is we should allocate a reserved bit for per-frame compression,
create an extension to indicate that is to be used for compression and a
way to select the compression algorithm, and define deflate with no state
shared across frames as a required compression algorithm to be supported if
no other algorithm is negotiated.  We can then define more effective
compression algorithms that provide ways of sharing compression state
across frames, for example, though we still have to work out the above
questions though.

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