Re: [hybi] Random Responses

Jamie Lokier <jamie@shareable.org> Sun, 12 April 2009 21:31 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 4A0713A680D for <hybi@core3.amsl.com>; Sun, 12 Apr 2009 14:31:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.099
X-Spam-Level:
X-Spam-Status: No, score=-5.099 tagged_above=-999 required=5 tests=[AWL=-2.500, 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 Tm9mMwgNNefW for <hybi@core3.amsl.com>; Sun, 12 Apr 2009 14:31:50 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 597AF3A6803 for <hybi@ietf.org>; Sun, 12 Apr 2009 14:31:50 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1Lt7IP-00029S-7K; Sun, 12 Apr 2009 22:32:57 +0100
Date: Sun, 12 Apr 2009 22:32:57 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Greg Wilkins <gregw@webtide.com>
Message-ID: <20090412213257.GL4394@shareable.org>
References: <8A829FEA-0EF2-46D6-974D-0EB237FF2728@lindenlab.com> <Pine.LNX.4.62.0904090030580.19453@hixie.dreamhostps.com> <A66ED417-B7AB-4138-B8DE-31323A4DC0C1@lindenlab.com> <49E1518E.7050402@webtide.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <49E1518E.7050402@webtide.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
Subject: Re: [hybi] Random Responses
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: Sun, 12 Apr 2009 21:31:51 -0000

Greg Wilkins wrote:
> Generally agreeing with all your points.  Yet the attributes you
> describe do sound pretty much like BEEP protocol - or at least
> beep framing.
> 
> BEEP is very much a HTTP style protocol with addition of
> bidirectionality, multiple response requests and multiple
> channels over a single connection.

Yes, although BEEPs channels are unnecessarily expensive (in latency)
to create on demand.

> If BEEP was extended with a few default assumptions (eg
> UTF-8 text body if no content type specified), then it would
> approach the byte efficiency of websocket, while preserving
> the extensibility and flexibility of HTTP.
> 
> If the security and authentication aspects of BEEP were
> stripped, then a pretty simply protocol would remain.
> 
> IF I was forced to pick a winner.... then I'd certainly
> look very closely at BEEP or a BEEP derivative.

I've looked closely at BEEP for this, and I agree, BEEP has some very
good things which should be copied.

Unfortunately its channel setup is expensive (latency, not bandwidth),
and often you'd want a channel per message in flight.  That forces you
to either accept the channel setup latency, or queue messages behind
each other in the same way that HTTP pipelining forces messages to
block behind each other.  Neither is ideal.

There is a BEEP extension to create sub-channels on demand without
having to request one, which is closer to ideal behaviour when you
have a new message to send.  But it unnecessarily constrains the
ordering of messages.  (I asked the author to relax this, but he
didn't see any point for his applications and suggested there are
other protocols to choose from if I need that.  I don't see the point
in the constraint.)

What I think would be ideal, and it's been mentioned already as
"asynchronous HTTP", is:

    HTTP or simplified-HTTP message headers and body.
    Bidirectional - either side can send requests and responses.
    Channel id attached to each message.
    Chunked encoding, with channel id attached to each chunk.
    Per channel flow control exactly like BEEP over TCP profile.
    Request/response id attached to each message.
    Request/response id matches responses out of order to requests.
    Pure messages with no response allowed, using "no-response" r/r id.
    All the above features are optional.

When you make those features optional, it degrades gracefully to
HTTP pipelining, then to HTTP persistent connections.

Also by making features optional, it is much easier to implement just
the subset of features you need, or plug in a feature-complete
implementation when you need all of them.

That provides the message/event protocol some people are asking for,
and also provides the request/response protocol some people are asking
for, does both bidirectionally, and over a single socket, and with
multiple applications sharing the same socket if they want.

It's efficient too, if you regard HTTP as efficient.  They're about
the same overhead.  Latency is sometimes better than HTTP, because it
doesn't have pipeline blocking like HTTP.  Proxy buffering
requirements are about the same as HTTP, in particular they are
bounded similarly.

-- Jamie