Re: [hybi] Call for interest: multiplexing dedicated for WebSocket

Tobias Oberstein <> Sat, 01 June 2013 09:56 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 951E921F8749 for <>; Sat, 1 Jun 2013 02:56:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.299
X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5 tests=[AWL=-0.300, BAYES_00=-2.599, J_CHICKENPOX_12=0.6]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id BEI+l9DsVefP for <>; Sat, 1 Jun 2013 02:55:55 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id BC67921F86F4 for <>; Sat, 1 Jun 2013 02:55:54 -0700 (PDT)
Received: from ([]) by ([]) with mapi; Sat, 1 Jun 2013 02:55:53 -0700
From: Tobias Oberstein <>
To: Simone Bordet <>, Takeshi Yoshino <>
Date: Sat, 1 Jun 2013 02:55:54 -0700
Thread-Topic: [hybi] Call for interest: multiplexing dedicated for WebSocket
Thread-Index: Ac5attqzWx6pbG2eQ4i04OK+Y1TkLwD76sSA
Message-ID: <>
References: <> <> <> <007501ce56f0$67f74080$37e5c180$> <> <> <> <> <> <>
In-Reply-To: <>
Accept-Language: de-DE, en-US
Content-Language: de-DE
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "" <>
Subject: Re: [hybi] Call for interest: multiplexing dedicated for WebSocket
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sat, 01 Jun 2013 09:56:06 -0000

> On Mon, May 27, 2013 at 10:25 AM, Takeshi Yoshino <>
> wrote:
> > Isn't it in-app priority? Can't script and server address that
> > problem? If only the client knows current priority, the client can
> > tell the priority to the peer servlet using a WebSocket message. If
> > the server know priority for each position, it can just control transmission
> speed.
> >
> > Even if we need help by the server, the servlet would call some
> > special function to tell the server about priority.
> >
> > Different from HTTP/2.0's case, we don't need to provide a special
> > field in mux protocol to pass priority, I think.

If intermediaries are no preserve a per-channel priority based scheduling, then they might need to know the channel priority.

> Sure, but then you force every application to reinvent this mechanism on top of
> WebSocket mux.
> At that point, one could argue that application messages could have their own
> "channel_id" in their messages, and applications can do mux themselves, if
> they need it.

Yep, agree.

Scheduling integrated with MUX has another advantage:

e.g. when doing per-channel priority based scheduling the scheduling could not only consider channel priority, but also the quota.

A high priority channel with data outstanding to be sent but not quota to send would otherwise block a lower priority channel with data _and_ quota.

Another issue: implementing like priority based scheduling at app level would might require to reinvent some kind of fragmentation at the app level to be able to schedule according to priority (otherwise once a very large message on a low prio channel is started to be sent, it'll block everything else).

One way to look at this is:

WS fragmentation < WS multiplexing < WS scheduling | APP

where "<" means "builds on", and everything up to "|" is provided by an WS implementation, hence does not need to be reinvented at app level, and WS aware infrastructure can optimize / do their thing.


It seems that HTTP/2 likely will have "request priorization" (I don't know about "response priorization").

If we (in a pure WS land) don't have priorization, that's a potential disadvantage and source of discussion.


A per-channel scheduling could work according to different policies:

1. Round-Robin scheduling
2. Priority scheduling
3. Fair Bandwidth scheduling
4. First-Come, First-Serve scheduling

The policy mechnism could be selected for the whole physical WS (and communicated for intermediaries), e.g.

Sec-WebSocket-Extensions: mux; scheduler="round-robin"

Only with 2. there is a need to select and communicate a per-channel info (during channel creation), e.g.

Sec-WebSocket-Extensions: mux; scheduler="priority"

and then

AddChannelRequest with the 3 RSV bits (currently unassigned) containing a priority 0-7 for the channel. 

[This does not yet answer how to re-prioritize an existing channel]

Hence I'd like to propose to

1) add an (optional) extension parameter "scheduler" as above
2) use the 3 currently unassigned RSV bits in AddChannelRequest for channel prio (when scheduler="priority")
3) define appropriate MUST semantics (scheduling should not follow advisory semantics .. apps should be able to rely on it)
4) probably add a new PriorityControl message to change prio of existing channels


Above is a kind of per-channel scheduling. One might argue that it lacks in at least 2 respects:

- an app is not able to control e.g. prio on a per-message basis
- there are no ordering guarantees between messages on different channels

An app creates an empty file on some cloud service. Subsequently the app wants to append to that file.

The first could be a high-prio message, the latter messages low-prio.

The app does not care whether those messages travel over 1 physical, or multiple different logical WS channels.

However, the app does care that the first "create file" message arrives before any subsequent "append to file" messages.

So a different design involving per-message prios on a single WS channel (physical or logical) might allow higher-prio messages to overtake lower prio-messages, but not otherwise round.