Re: [hybi] Payload only compression extension, again

Takeshi Yoshino <tyoshino@google.com> Mon, 25 July 2011 06:04 UTC

Return-Path: <tyoshino@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 4DD2A21F8AF0 for <hybi@ietfa.amsl.com>; Sun, 24 Jul 2011 23:04:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.976
X-Spam-Level:
X-Spam-Status: No, score=-105.976 tagged_above=-999 required=5 tests=[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.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e8RL4niuc7Zb for <hybi@ietfa.amsl.com>; Sun, 24 Jul 2011 23:04:05 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by ietfa.amsl.com (Postfix) with ESMTP id 51E0521F85DA for <hybi@ietf.org>; Sun, 24 Jul 2011 23:04:05 -0700 (PDT)
Received: from hpaq11.eem.corp.google.com (hpaq11.eem.corp.google.com [172.25.149.11]) by smtp-out.google.com with ESMTP id p6P644i0014520 for <hybi@ietf.org>; Sun, 24 Jul 2011 23:04:04 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1311573844; bh=6Zq+gVKYy8wd+b+j8r8XEJwUmyY=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=o9P9Z38i+pfCBiJMm0YdXVsVcbUY//A5rQIsL1cWdls8zZqZurpFj323d45BIh+Ki BF1JysGAZvzSW8n0/Xp+A==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=dkim-signature:mime-version:in-reply-to:references:from:date: message-id:subject:to:cc:content-type:x-system-of-record; b=EK+1PxpMoeTp6PrEKpYL2dybBsx3qgxWyAiXgv+qc5K4aGLNGWlHhDXR5WknDnfJ4 RUVzh1AEAHNXoYlvhuQlQ==
Received: from gyb11 (gyb11.prod.google.com [10.243.49.75]) by hpaq11.eem.corp.google.com with ESMTP id p6P642Ic008389 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Sun, 24 Jul 2011 23:04:03 -0700
Received: by gyb11 with SMTP id 11so2283211gyb.7 for <hybi@ietf.org>; Sun, 24 Jul 2011 23:04:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=IKignJf8Z/bzyiOOq3RfnzfgkwSv0Oz8zv71K5Zpmb4=; b=qcziQu7MjyMUOhE5m8Ldsa9FsPns6aVJzVwjEaFeG8km9oRrspxTAeg1LQKZ8wD2xU 4Pq/7P7FY9T5CDQ1kw9A==
Received: by 10.150.253.14 with SMTP id a14mr3916600ybi.0.1311573842114; Sun, 24 Jul 2011 23:04:02 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.150.178.16 with HTTP; Sun, 24 Jul 2011 23:03:42 -0700 (PDT)
In-Reply-To: <CAH_y2NG6uWp_Utu_0NRXUA2-i+sMdFjDWnf42zM0JaOzojcXiA@mail.gmail.com>
References: <AANLkTik2LqCC2-ZLLdWNNaQ18ypcQU_5djJobkYtYk6T@mail.gmail.com> <AANLkTik+uh98b0n7U=xrE0Aaa7MyBfZVXSwj+8wfVTKW@mail.gmail.com> <AANLkTinCtDepu+wDt4=8GyXqhfn=SQ7v2SjJhKzP2Mzr@mail.gmail.com> <AANLkTinhw0j5U_tvfCCrcEx=J6b7wBua4XzhWkvthUjL@mail.gmail.com> <BANLkTi=SjQwGQu-3v2wjniyp9DrQ1ZcQdA@mail.gmail.com> <BANLkTi=dqFN-57GV3rYDv4feTAaZFQko1g@mail.gmail.com> <BANLkTikWFwfs0FOuET5ZS1HEzjweNO0_CA@mail.gmail.com> <BANLkTikHXtVM+7nfz60toKTJCXBuMwMC1g@mail.gmail.com> <BANLkTinsMu+Znbg7Fe7+9HZeZg=Q8SwDHg@mail.gmail.com> <4DB8D3B2.8090002@mozilla.com> <BANLkTimE9qYEvBVLGbOsU7YDVGDwHpGjgA@mail.gmail.com> <BANLkTi=L=8r7dCkRa6MTC3AGziZWeM+fpA@mail.gmail.com> <BANLkTi=-msm-ppt1n_2U5+bHoZO1i+Yj7A@mail.gmail.com> <BANLkTikEYhsdcrK1RqQTwjy3yuSVOaw=Dw@mail.gmail.com> <BANLkTimhEai77LC53NFeOhgNzFQes7HS7g@mail.gmail.com> <BANLkTinW8SL-kwJs-ZsJPmqj269dT29N0A@mail.gmail.com> <CAH9hSJYkjiGPM6RihBkF54zFDXFn935Y0T4FU91G6ttekCyBwA@mail.gmail.com> <CALiegfkUa90DP=YAHJuyQK=CrMs4MoSguxca60fuxM16GgYr8w@mail.gmail.com> <CABLsOLAkdxrGJzqvmoBSxF3QH_zqjg2DHzW2TkfJC+iYiSXKrg@mail.gmail.com> <CAH9hSJZmdSU0j5WETz2A339Gbe=7BTp3VXfie0VChboQoJ=Pjw@mail.gmail.com> <CAH_y2NG6uWp_Utu_0NRXUA2-i+sMdFjDWnf42zM0JaOzojcXiA@mail.gmail.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Mon, 25 Jul 2011 15:03:42 +0900
Message-ID: <CAH9hSJbS+y8+742OC0fc_1Hy8VgopPSG7yN+BgBCx4CY+kzGnQ@mail.gmail.com>
To: Greg Wilkins <gregw@intalio.com>
Content-Type: multipart/alternative; boundary="000e0cd306b6f4b9ee04a8de94c9"
X-System-Of-Record: true
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Payload only compression extension, again
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: Mon, 25 Jul 2011 06:04:06 -0000

Hi,

On Sat, Jul 23, 2011 at 07:43, Greg Wilkins <gregw@intalio.com> wrote:

> On 23 July 2011 00:38, Takeshi Yoshino <tyoshino@google.com> wrote:
> > I've implemented this proposal on pywebsocket.
> pywebsocket's deflate-stream
> > implementation flushes compressed data for each frame using Z_SYNC_FLUSH.
> > Compression level is Z_DEFAULT_COMPRESSION. Default Huffman tree is used.
> No
> > dictionary is attached.
>
> Great - I'll make sure we have an implementation in  the next release of
> Jetty.
>
>
> - output of deflate-stream are basically bigger than
> > deflate-application-data since Z_SYNC_FLUSH wastes 4 octets for each
> flush
> > operation
>
> I think you mean deflate-application-data frames are bigger....


yes... bad typo


>  > - for short messages, it just increases size because of ~2 octets for
> two
> > block headers and end of block symbol
>
> Does this not suggest that we should use a reserve bit to indicate if
> the frame is compressed or not?  This will allow uncompressed frames
> (either because of small size or incompressible content) to be sent.
>

Yeah. Taking 1 RSV bit, we can avoid inflation of the size for this kind of
content.

The problem is, as you and John were discussing once, how to give a good
criteria to determine if a certain content of a frame is worth compress or
not. Even if frame N is incompressible, it may be referred to deflate frame
N+1. If we don't get the frame N go through compressor, N+1 cannot refer
it. So, criteria like |compressed| < |original| don't work well. Criteria
like |original| < (some pre-specified size) are also not easy to
define. It's almost clear that for communicating 1 byte key type event,
deflate shouldn't be applied. Thinking of two byte, three byte, ... it's not
trivial. I think we cannot gather real data to define such criteria
sufficient to be put in the spec soon.

Servers can get some advice about this from application level, but user
agents don't have any way. May we ask API side to add some interface to
allow JavaScript to give some hint? Something like

attribute boolean compressOutgoing;

or, more generally

attribute DOMString extensionConfig;

to dynamically instruct the user agent.

It's also an option that we introduce COMP bit in wire spec but initially
have no API exposed for JavaScript to control that.

----

Based on granularity choices are grouped like:

- Connection-wise control: deflate-application-data or no compression
extension
- Direction-wise control: need to have two separate extension
deflate-application-data-server-to-client
deflate-application-data-client-to-server
- Message-wise control: need to have API to on/off compression

Thanks,
Takeshi