Re: [hybi] #1: HTTP Compliance

Willy Tarreau <w@1wt.eu> Thu, 22 July 2010 00:22 UTC

Return-Path: <w@1wt.eu>
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 31A303A6B4A for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 17:22:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.381
X-Spam-Level:
X-Spam-Status: No, score=-3.381 tagged_above=-999 required=5 tests=[AWL=-1.338, BAYES_00=-2.599, HELO_IS_SMALL6=0.556]
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 UuFESWc9WI1p for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 17:22:54 -0700 (PDT)
Received: from 1wt.eu (1wt.eu [62.212.114.60]) by core3.amsl.com (Postfix) with ESMTP id EABE33A6B2C for <hybi@ietf.org>; Wed, 21 Jul 2010 17:22:53 -0700 (PDT)
Received: (from willy@localhost) by mail.home.local (8.14.4/8.14.4/Submit) id o6M0N8Aw007574; Thu, 22 Jul 2010 02:23:08 +0200
Date: Thu, 22 Jul 2010 02:23:08 +0200
From: Willy Tarreau <w@1wt.eu>
To: Jamie Lokier <jamie@shareable.org>
Message-ID: <20100722002308.GD7174@1wt.eu>
References: <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> <20100722001105.GH14589@shareable.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20100722001105.GH14589@shareable.org>
User-Agent: Mutt/1.4.2.3i
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:22:56 -0000

On Thu, Jul 22, 2010 at 01:11:05AM +0100, Jamie Lokier wrote:
> 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.

And it's reliance on random numbers in userspace and MD5 to hash
minuscule messages does not help at all keeping latency low !

> 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.

Agreed. You're defining a well-stacked model where each layer informs
the upper one about some information that may be needed for its handshake
to complete without having to wait.

> (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.)

I think it was the principle of TTCP, but with TCP it's not possible
because you don't know how large the other side's buffers before you
receive the SYN-ACK which contains the MSS. However if you're interested,
I can explain to you a system-dependant way to save one ACK from the
client to the server by sending the data with the first ACK ;-)

> 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.

That's what is nice with declarative protocols such as HTTP where
you announce what you're doing. At least we should find a clean way
to be able to decide whether we want an HTTP medium or just a TCP
medium. I thought that the port was a good thing, but maybe the
protocol scheme itself speaks better (ws/wss). After all, browsers
currently use http/https for this. We could even have variants such
as :

  - WS = plain TCP, no initial handshake
  - WSS = plain TLS, no initial handshake beyond TLS
  - WSTP = WS over HTTP = HTTP initial handshake

Just a few ideas, hoping they will help others find better ones.

Regards,
Willy