Re: [hybi] #1: HTTP Compliance

Jamie Lokier <jamie@shareable.org> Thu, 22 July 2010 00:10 UTC

Return-Path: <jamie@shareable.org>
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 496DD3A696E for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 17:10:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.49
X-Spam-Level:
X-Spam-Status: No, score=-2.49 tagged_above=-999 required=5 tests=[AWL=0.109, 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 IbJQaUYTwP0B for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 17:10:52 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id DB30C3A6840 for <hybi@ietf.org>; Wed, 21 Jul 2010 17:10:51 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1ObjNR-000174-E5; Thu, 22 Jul 2010 01:11:05 +0100
Date: Thu, 22 Jul 2010 01:11:05 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Greg Wilkins <gregw@webtide.com>
Message-ID: <20100722001105.GH14589@shareable.org>
References: <4BF12FF1.2020101@webtide.com> <15307.1274106895.116423@Sputnik> <Pine.LNX.4.64.1005172259030.22838@ps20323.dreamhostps.com> <20100518003753.GP20356@shareable.org> <Pine.LNX.4.64.1005180229430.22838@ps20323.dreamhostps.com> <20100518121245.GR20356@shareable.org> <AANLkTiniCjBwm5T59as8jByM5xDhPMrea-GqZFpWPAVS@mail.gmail.com> <Pine.LNX.4.64.1005182105360.22838@ps20323.dreamhostps.com> <AANLkTingZLsWoejLWbEbXGy_9mBo4eBc_Kv0wW9_Q0Xr@mail.gmail.com> <AANLkTild4QZdIO56pvt7vPAC2LFb59cHy7QUsEWauzK4@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <AANLkTild4QZdIO56pvt7vPAC2LFb59cHy7QUsEWauzK4@mail.gmail.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] #1: HTTP Compliance
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, 22 Jul 2010 00:10:53 -0000

Greg Wilkins wrote:
>    I can visibly tell when establishing a
>    chat room if I have the WS transport enabled in the client or not,
>    because I can see the extra delays as WS is tried and fails.
>    This will be a barrier to frameworks like cometd-2 including WS in
>    their transport negotiations.

(Aside: I think Ian's past responses suggest the following resolution:
When you're establishing a chat room connection, you *ought* to know
if you're connecting to a WS-aware chat service, in the same way that
you already must know in advance which WS subprotocol to request
if you do get a WS connection.)

As noted some time ago, even when WS negotation *succeeds*, it can be
slower than comet-style HTTP, both slower in sending the first
messages, and slower in receiving the first responses.

That situation is ridiculous.

It means latency-optimised apps may open *two* connections in
parallel: One comet-style HTTP, and one WebSocket.  They will
communicate initial messages over the HTTP connection, and switch to
the WebSocket connection when that is ready.  That's not kind on
low bandwidth links, nor easy to program, so it's an ugly compromise.

We can greatly improve the situation by avoiding some delays in the
negotiation sequence.

Unfortunately it seems each "waiting point" needs a different method
of avoidance, so TLS negotation round trip delay is reduced only by
using an ignorable TLS extension to carry initial messages; HTTP
handshake round trip delay is reduced only by encoding initial
messages in a HTTP-compatible manner, post-HTTP confirmation round
trip delay is removed only by encoding initial messages in a way that
is harmless to non-WS servers, and delays to messages originating
between those stages are reduced only by rather fiddly inter-stage
encodings.

(Ideally we'd avoid the TCP 3-way handshake round trip too by
including some data in the SYN, finally outperforming HTTP :-), but I
have the uncertain impression that's considered inadvisable.)

Fortunately there is a systematic approach possible, even though the
details are annoyingly technical, and fortunately each step could be
optionally implemented or not according to the implementer's
preference.  Simple implementations could ignore them entirely.

-- Jamie