Re: [hybi] Technical feedback. was: Process!

Greg Wilkins <gregw@webtide.com> Sat, 30 January 2010 22:56 UTC

Return-Path: <gregw@webtide.com>
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 4BE8B3A67DA for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 14:56:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.063
X-Spam-Level:
X-Spam-Status: No, score=-2.063 tagged_above=-999 required=5 tests=[AWL=-0.064, BAYES_00=-2.599, J_CHICKENPOX_26=0.6]
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 01DMvJJjg62T for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 14:56:50 -0800 (PST)
Received: from mail-yw0-f173.google.com (mail-yw0-f173.google.com [209.85.211.173]) by core3.amsl.com (Postfix) with ESMTP id 274C83A67CF for <hybi@ietf.org>; Sat, 30 Jan 2010 14:56:49 -0800 (PST)
Received: by ywh3 with SMTP id 3so458288ywh.22 for <hybi@ietf.org>; Sat, 30 Jan 2010 14:57:14 -0800 (PST)
Received: by 10.91.55.39 with SMTP id h39mr2413026agk.77.1264892234284; Sat, 30 Jan 2010 14:57:14 -0800 (PST)
Received: from ?10.10.1.11? (60-242-119-126.tpgi.com.au [60.242.119.126]) by mx.google.com with ESMTPS id 15sm2173852gxk.0.2010.01.30.14.57.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 30 Jan 2010 14:57:13 -0800 (PST)
Message-ID: <4B64B93E.3010703@webtide.com>
Date: Sun, 31 Jan 2010 09:57:02 +1100
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: Maciej Stachowiak <mjs@apple.com>
References: <de17d48e1001280012i2657b587i83cda30f50013e6b@mail.gmail.com> <4B620B8F.6030706@gmx.de> <Pine.LNX.4.64.1001282217320.22053@ps20323.dreamhostps.com> <bbeaa26f1001281449q1a6e1813q3f537fe15a5a9d60@mail.gmail.com> <4B625733.2020907@webtide.com> <6.2.5.6.2.20100128225542.06fa8d68@resistor.net> <Pine.LNX.4.64.1001290817520.22020@ps20323.dreamhostps.com> <4B62C5FE.8090904@it.aoyama.ac.jp> <Pine.LNX.4.64.1001291134350.22020@ps20323.dreamhostps.com> <4B62E516.2010003@webtide.com> <5c902b9e1001290756r3f585204h32cacd6e64fbebaa@mail.gmail.com> <4B636757.3040307@webtide.com> <BBF3CE06-3276-4A7C-8961-7B3DDEE406D0@apple.com> <4B63DC2D.4090702@webtide.com> <4678E38C-EBD3-4867-B3A6-53A60F7F26C0@apple.com>
In-Reply-To: <4678E38C-EBD3-4867-B3A6-53A60F7F26C0@apple.com>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Technical feedback. was: Process!
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: Sat, 30 Jan 2010 22:56:51 -0000

Maciej Stachowiak wrote:
> On Jan 29, 2010, at 11:13 PM, Greg Wilkins wrote:
> 
>>>> So if you look on the wire of cometd running over websocket, it just looks like long polling.  We use the same /meta/connect long poll message as a keep alive and as our
>>>> ack carrier.
>>>> 
>>>> We've saved 1 connection, which is great.   But I fear that saving will be eaten up by the ability of application developers to open any number of websockets.
>>> Doesn't it also save you the need to potentially close and reopen the connection that would have been used for messages from the client to the server? It seems like proper
>>> full duplex is a significant win, especially over SSL where connection setup is very expensive.
>> No.  HTTP/1.1 keeps the connection open between long poll requests.
> 
> HTTP/1.1 doesn't guarantee that the client will actually reuse the connection, it just makes it possible.

Indeed. An sometime if you go via a load balancing proxy like nginx,
the HTTP/1.1 persistent connections are downgraded to HTTP/1.0
non-persistent.

But the long polling techniques still work and for many use-cases
the extra cost of opening a connection is not significant.
For other use-cases it is significant.


My point is that my current pain point is more the max number
of connections rather than the open/close rate of connections (although
the later does cause some problems so avoiding HTTP/1.0 is good
to do).


>> 
>>>> But as I've frequently said, it works ok, but it solves few of my real pain points as comet vendor and it's caused me more code/complexity not less.
>>> I'm curious to hear about some of the pain points that you think are not addressed. You mentioned two (reliable message delivery and maintaining idle connections) and I
>>> think you're right that those should be addressed. Any others?
>> For the scaling of the web applications that I work with, connections have often been the limiting factor.
>> 
>> Websockets have no limits on the number of connections that an application can open, thus no limit on the amount of server side resources that a client side developer can
>> requisition.
> 
> It does have a limit that the client can only be starting one connection per server at a time (see section 4.1, step 1 in the algorithm), and allows servers to reject
> connections. Thus the server could enforce a connection limit per client IP or per client IP+Origin. It seems like that is enough to limit the potential for abuse. What do you
> think?


It is very hard for a server to determine what is abuse.

If the server sets a low limit of connections per browser, then multiple
tabs/frames in the same browser can quickly hit that limit in non abusing
uses.

If the server sets a moderate limit of connections to allow for the occasional
user of multiple tabs/windows, then a single frame can abuse that limit
and open maximal connections.

The point is that the connection usage policy should be something that
is handled between the user-agent and the server.   The application
developer should not be required to (or able to) participate in
the connection management.


>> I've previously explained in detail how a widget vendor might find some better performance by opening multiple websockets, so that they get a greater share of the bandwidth
>> available from a server.   But that only works if your the only one doing it.  Soon everybody will be opening 4, 8, 16 connections etc.
> 
> So, this seems to have an assumption that the client-side code is developed by an independent entity from the server-side code. I can see how that might be true if your
> WebSocket service is intended for cross-site use. However, it seems like that often won't be the case. For example, a vendor providing the chat service is likely to author both
> the client-side JavaScript and the server-side code to manage it. Presumably they would not make this mistake. We do need to make sure that it's practical for clients to
> minimize the number of connections they choose to use of course.

Firstly it is problematic to make assumptions about future usage.   But there are already plenty
of examples of where third parties contribute code to a webpage either statically or dynamically.
Go to any home page on any portal site and you will see plenty of third party widgets offering
services... many of which would benefit from websocket type connectivity.

It is also not safe to assume that client libraries provided by a server will always be used.
If the connection limit is imposed by the client library and their is an advantage to be
obtained by exceeding the connection limit, then app developers will work around the libraries
(or in js they will probably just modify the code).

Voluntary resource restriction just does not work.



> I do think the ability to do multiplexing as an optional feature may be useful. I see it as something that could be a 2.0 (or 1.1) protocol feature, and that could be totally
> transparent in the client API. But if there are pitfalls that make it impossible to roll out later, it would be good to know now.

I agree that multiplexing would be advantageous and I've proposed several ways in which
it could be done.    However I also do recognize that it is a difficult thing to achieve in 1.0.

The suggestion that I have made (and that was rejected) was that at least the 1.0 spec change it's
language so that the websocket user is not promised a connection, but rather a conduit or channel.
This would allow multiplexing to be added at a later date with less disruption etc.


>> working with load balancers and other intermediaries that need out-of-band communication with the server is another.
> 
> What's needed for the sake of these kinds of intermediaries? I think the principle we should apply here is that the protocol should be able to work with no changes to
> intermediaries in general, but if we have a way to make it work better with optional cooperation from intermediaries, we should consider it. Can you mention some concrete
> problems that come up here? Do you have solutions in mind?


The number and type of intermediaries is too numerous and varied to generalize.
But the ability to insert meta data into a stream that will not affect the application data is
something that is easy to do and would enable a large variety of extensions (including multiplexing).

EG. a meta data frame could be injected to indicate the channel, encoding, encryption, origin, etc.
of a following frame (or frames).



regards