Re: [hybi] Multiplexing: Pre-AddChannelResponse quota

Jamie Lokier <jamie@shareable.org> Fri, 22 June 2012 12:17 UTC

Return-Path: <jamie@shareable.org>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0034321F85CC for <hybi@ietfa.amsl.com>; Fri, 22 Jun 2012 05:17:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CgFYE-hoKE5V for <hybi@ietfa.amsl.com>; Fri, 22 Jun 2012 05:17:41 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by ietfa.amsl.com (Postfix) with ESMTP id 459AA21F85C0 for <hybi@ietf.org>; Fri, 22 Jun 2012 05:17:41 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1Si2ny-0003q3-C1; Fri, 22 Jun 2012 13:17:38 +0100
Date: Fri, 22 Jun 2012 13:17:38 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Takeshi Yoshino <tyoshino@google.com>
Message-ID: <20120622121738.GR5812@jl-vm1.vm.bytemark.co.uk>
References: <002001cd4a14$53eb66f0$fbc234d0$@noemax.com> <CAH9hSJbz9HQrN67=Jf6bEmJikTGEViNEqjDP8XbHKrPKhYD19Q@mail.gmail.com> <001301cd4acf$d8c5cda0$8a5168e0$@noemax.com> <CAH9hSJYzbfUKMjuV3J1-tdapV59N5aewO-nAMLMexzF2f6KosA@mail.gmail.com> <6A3569A8-C253-4363-B00C-F336B0CA3128@noemax.com> <CAH9hSJayEAqJEE7=KdYuq669HOaG76kS9AVwUMUYaPKLtO=zEw@mail.gmail.com> <000301cd503d$0aff8f00$20fead00$@noemax.com> <CAH9hSJaNpAV2WYqRr7Pf47=auvADPHusx9ipUDLvAZRhRp7iuA@mail.gmail.com> <002101cd504f$d8a20e30$89e62a90$@noemax.com> <CAH9hSJayzKB9RFNtebKNygZa2HH3crkw9ycyRPGb+BrACYwAMQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAH9hSJayzKB9RFNtebKNygZa2HH3crkw9ycyRPGb+BrACYwAMQ@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: hybi@ietf.org
Subject: Re: [hybi] Multiplexing: Pre-AddChannelResponse quota
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Fri, 22 Jun 2012 12:17:42 -0000

Takeshi Yoshino wrote:
>    Without the server assigning some identifier for the new slot (doesn't
>    need to be the channel ID to be used after channel open, but some
>    identifier), we cannot match the slot and the pre-handshake FC frames.
>    Sorry but could you elaborate your idea? Maybe, you said here that
>    we'll be able to send FC after receiving AddChannelRequest and before
>    sending back AddChannelResponse?
>    What I had in my mind is like this:
>    (C) receives Physical channel server's opening handshake
>    (C) receives NewChannelSlot[ID=1]
>    (C) receives NewChannelSlot[ID=2]
>    (C) receives NewChannelSlot[ID=3]
>    Now (C) can issue three AddChannelRequests but may not send any
>    pre-handshake data.

Why not just send NewChannelSlots[ADD=3], instead of 3
NewChannelSlot messages?

The slot messages are wasteful if the server is happy to accept 1000
low-usage slots from the beginning.

>    (C) receives FlowControl[ID=1, quota=1024]
>    (C) receives FlowControl[ID=2, quota=1024]
>    (C) receives FlowControl[ID=3, quota=1024]
>    Now (C) is allowed to send pre-handshake data up to 1024 for each of
>    allocated slots.

Why not just send NewChannelSlots[ADD=3,PER_CHANNEL_QUOTA=1024]?

(Or SHARED_QUOTA, whatever seems to work best.)

>    Here, the client attempts to open a new logical channel using the first
>    allocated slot.
>    (C) sends AddChannelRequest[ID=1]

Replace with:

    (C) sends AddChannelRequest[CLIENT_ASSIGNED_ID=1]

(where the ID is whatever the client says it should be - or it might
follow some rule such as incrementing from 1 each new one).

>    (C) sends TextData[len=512]

Yes.  The channel data quota on the client is now 512.

>    (C) receives AddChannelResponse[ID=1, success]

Yes.  But the ID is what the client assigned.  The server can also
send response data immediately after this, if it has some very
quickly.

>    (C) receives NewChannelSlot[ID=4]

Replace with:

    (C) receives NewChannelSlots[ADD=1,PER_CHANNEL_QUOTA=1024].

(Or it can be a flag in the AddChannelResponse parameters in the
common case where it's COUNT=1 and the data quotas haven't changed,
but that's just a special case to compress a message.)

This is the same method as flow control for bytes in a channel, but
for new channel counts.  Send out messages granting more room.

>    (C) receives FlowControl[ID=1, quota=1024]
>    Now channel 1 is open and its quota  is 1536.

Yes.

So the main differences between your and my scheme here is:

  - the client assigns IDs
  - the server sends one count update, not a message for each slot

In both schemes, new channel assignment is "pessimistic" in the sense
that channel requests can't block the socket or get rejected at the
mux level.

If it turns out to that network scaling behaviour improves with
"optimistic" requests that can fail and be retried, it can be built on
top of this in various ways, such as NewChannelSlotsAck for when slots
are reduced (negative ADD, round trip before server is allowed to
block) or AddChannelDropped (client must retry, here or elsewhere, and
it's guaranteed the server did not act on the data sent; allows server
to remove quota immediately instead of round-trip).  However TCP works
fine without this sort of "quota retraction", using gradually
increasing window if needed to share memory, so I don't know that it's
useful and I would bet on low-quality clients reacting buggily to it.

-- Jamie