Re: Identify streams unidirectional vs bidirectional based on stream ID

Ian Swett <ianswett@google.com> Tue, 17 October 2017 02:19 UTC

Return-Path: <ianswett@google.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1F884132D53 for <quic@ietfa.amsl.com>; Mon, 16 Oct 2017 19:19:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.011
X-Spam-Level:
X-Spam-Status: No, score=-0.011 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=1.989, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7TfU73_fvX7c for <quic@ietfa.amsl.com>; Mon, 16 Oct 2017 19:19:18 -0700 (PDT)
Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5C6A91321A4 for <quic@ietf.org>; Mon, 16 Oct 2017 19:19:18 -0700 (PDT)
Received: by mail-it0-x22a.google.com with SMTP id n195so670533itg.0 for <quic@ietf.org>; Mon, 16 Oct 2017 19:19:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/5BHKEl7PrhKo4BNd3lYcoEJoeiepSAbBkr3q+GiTEs=; b=YsvewL00wiMHq3kh6B4rUQxelTiqfuYItLk8d8KRnWa8PasgEFmbIvfJTu6G+Ajrnb SCCr2C212t3uFYb9bG76qFWtV4Ch3Rz2nI4xe71YsdbxEp7X+Hp8NTSDyQ+RkxXRnMxT 7dHH/MWZDriWsEdqlJHAX/Ag0CKsSI3WRbtZUJyemVl0LU/SwbykdeLNVpVxsnFWDA+K Ttj2OBe8Yy7o6fEH9kdfeK3dOxtNw/mAs9gdP9Uhh1/jcZlR5klpR2oBNpbVDfelPKlL a/YA44gesruZV04GLVfZFKyNCsWYOQNMcpLhITabAOO1YRRLLkdbkWuzz/vK6Sw3zXvZ F68Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/5BHKEl7PrhKo4BNd3lYcoEJoeiepSAbBkr3q+GiTEs=; b=NhL/nw9SPyQgdHmPmGzsOIPM5igdGPgnJYXtUGMxilU9S5M6QmhswQ2PBd9tm7WFVA wts6M3pjTddiyoJ23260GHyz9Xw6Vcoodc0HoGpO+S6kY4f2q+d2cSqCGL2k/0xSESxQ rXyyOBgmroCOlf2xKYC8cj930o3+a+GEXH7HcdVt050PxXnyY1Hv9WmpAW4ORF5iklA9 Q2cg56CxVtTa3iAvYDf5FqR9onwaJMBoOXmKCc+1/LC70T6FqJPw0ZfkxJpzNNJZdS/q dQkl9sawkq8EDngcrsRsAdeaBUuZT1y2Y1fRNnCGZe6a0ak9ybDVwA8yeBlHQQ4zrv5P rtFg==
X-Gm-Message-State: AMCzsaWOxUWlCzNJG6hFkEMBWi68ChVe5KSloW2NPoIl8Hd7vHrTiKYv 107o557FdhxwCPJ5CQYKK96IAWcSCV2ttTDbd7FeVA==
X-Google-Smtp-Source: ABhQp+SObSxkSr7xL31EGebOS+qys7XrMNpBaLvKuxY+OwsUtALvaLDNIBg+7PPNTqNDhAuhThSCbzN/Za9BHB/PrIc=
X-Received: by 10.36.120.136 with SMTP id p130mr3581507itc.54.1508206757280; Mon, 16 Oct 2017 19:19:17 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.107.142.4 with HTTP; Mon, 16 Oct 2017 19:18:56 -0700 (PDT)
In-Reply-To: <MWHPR21MB0288008D1302D533FB07C6DFB64C0@MWHPR21MB0288.namprd21.prod.outlook.com>
References: <CAJ_4DfQe=twhj3OBy1o6h+u1O4qB2YzD26EMCHKnz4HWEEa7OQ@mail.gmail.com> <0ffd80fd-d6a9-5df4-2128-d304b65dedf4@in.tum.de> <CAN1APdcT7djsTTt8fxx8S7cY1_7Tp-mhxedk-nnzyF2+XV6+GQ@mail.gmail.com> <MWHPR21MB01412840605BA9EBC872900D87480@MWHPR21MB0141.namprd21.prod.outlook.com> <CAKcm_gPFF=j68F4Ehrg__m2sWi-wdKRSnjqv8MxnSNyEVZSUUA@mail.gmail.com> <DC15026F-2376-41B3-B05E-C5606C8E0C73@fb.com> <CAKcm_gN=qer1VCG2KS8oLhsfa15A3Jg0ghxhssiVn9qyHP-2Tw@mail.gmail.com> <CAGD1bZbnGAmAewnxjqJqhUnz8n47=+5pg3UwdHW1Y5=DdHYHtA@mail.gmail.com> <CABkgnnUYH_aqkUR=aS9HWj4-=7KNz=OS3jpPtwQdz+jqQ+nKPg@mail.gmail.com> <CAN1APdfesrEFGajX6OajjtL9vBd2Bu19RM7WW3cp+35de=R34g@mail.gmail.com> <MWHPR21MB0288008D1302D533FB07C6DFB64C0@MWHPR21MB0288.namprd21.prod.outlook.com>
From: Ian Swett <ianswett@google.com>
Date: Mon, 16 Oct 2017 22:18:56 -0400
Message-ID: <CAKcm_gO8vznmYeOxRY-1odeGPihcHrN2dLodYfeqShrgUAf3nw@mail.gmail.com>
Subject: Re: Identify streams unidirectional vs bidirectional based on stream ID
To: Praveen Balasubramanian <pravb@microsoft.com>
Cc: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>, Martin Thomson <martin.thomson@gmail.com>, Jana Iyengar <jri@google.com>, Mike Bishop <Michael.Bishop@microsoft.com>, "quic@ietf.org" <quic@ietf.org>, Hugues Fafard <fafard@in.tum.de>, Roberto Peon <fenix@fb.com>
Content-Type: multipart/alternative; boundary="001a114ab8e40487a6055bb4c0fe"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/LyNWwUDFREJU9HyBSpCwG-HbLj0>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Oct 2017 02:19:22 -0000

On a high level, I 'think' the working group has agreed on three things:
 1) The transport needs to support bidirectional streams (Prague)
 2) The approach of adding an association stream ID in the first few bytes
of the stream adds more complexity than we'd like. (Ekr's prototype in
Seattle)
 3) There is a lot of interest in having unidirectional streams as a first
class transport feature. (I can't call this consensus, but there's
certainly lots of interest)

This heads us towards an approach where another bit somewhere in the stream
frame indicates whether it's unidirectional or bidirectional.  One option
was my original PR#656 <https://github.com/quicwg/base-drafts/pull/656>,
but that would require changes to remove implicitly opened streams(ie: I
receive stream ID 7, indicating 5 must have been opened) from the current
QUIC transport.  Ryan's PR creates 4 separate namespaces for different
types of streams instead of the current two namespaces.  There a few ways
to move bits around, but I think most end up functionally very similar
either to my PR or Ryan's.


On Mon, Oct 16, 2017 at 9:41 PM, Praveen Balasubramanian <
pravb@microsoft.com> wrote:

> I agree that this is adding complexity with four special cases, but I
> would actually argue the other way: apps that want uni streams should be
> able to use the existing bidi stream mechanism. An API for uni stream can
> achieve this by closing the stream in one direction immediately after
> opening it so that the very first packet for that stream signals that one
> direction is closed and the other end knows that the stream is uni. Bidi
> streams are a more general case and if we are going to support them (which
> I think we should) then do we need any dedicated transport mechanisms for
> uni streams?
>
>
>
> Thanks
>
>
>
> *From:* QUIC [mailto:quic-bounces@ietf.org] *On Behalf Of *Mikkel Fahnøe
> Jørgensen
> *Sent:* Monday, October 16, 2017 6:20 PM
> *To:* Martin Thomson <martin.thomson@gmail.com>; Jana Iyengar <
> jri@google.com>
> *Cc:* Mike Bishop <Michael.Bishop@microsoft.com>; Ian Swett <
> ianswett@google.com>; quic@ietf.org; Hugues Fafard <fafard@in.tum.de>;
> Roberto Peon <fenix@fb.com>
>
> *Subject:* Re: Identify streams unidirectional vs bidirectional based on
> stream ID
>
>
>
> I’m just wondering why this approach was preferred as opposed to building
> bidi on top of uni. I suppose this must have been discussed at the interim
> and in part based on the recent experimental implementation of uni streams.
>
>
>
> A straightforward implementation may not have much difficulty in handling
> the implementation either way but when you attempt to achieve low latency
> and low memory foot print with shortest possible state life times including
> coordination with application level buffers, then bidi streams are not very
> fun to work with at the transport level. As become more agreeable after it
> was concluded that teardown did not have to wait for FIN ACK and related,
> but it is still a lot of complexity with potential bugs.
>
>
>
> One aspect of the complexity is that there are now four special cases
> instead of two in the stream identifiers which must be dealt with in
> several frame types. Some of this involves flow control per stream type
> which bidi on top of uni would not support at the same granularity, but is
> this really needed?
>
>
>
> Adding uni streams in addition to bidi streams is still a lot better than
> not having uni streams because they solve problems such as async messaging
> at high volume and partial reliability via throw away streams. However,
> they do nothing to simplify the transport with the current proposal.
>
>
>
> Kind Regards,
>
> Mikkel Fahnøe Jørgensen
>
>
>
> On 17 October 2017 at 02.49.38, Martin Thomson (martin.thomson@gmail.com)
> wrote:
>
> Those low order bits are important. No need to rush (it's a
> relatively small changeset).
>
> On Tue, Oct 17, 2017 at 10:48 AM, Jana Iyengar <jri@google.com> wrote:
> > Based on what I'm seeing on the PR and on this thread, I think there's
> > general agreement on this strategy to go forward. I would like to merge
> this
> > PR soon, modulo a new revision to address some open comments. (There's
> > currently a question about whether to use the high or the low-order bits
> for
> > this, which should also get resolved before merging.)
> >
> > I'm asking folks to please review and speak up if they have
> disagreements
> > with the direction or with any specifics.
> >
> > I'll be away from connectivity for a week, so unless there are
> unresolved
> > issues then, I'd like to merge this in a week when I return. Martin can
> > merge this sooner if there's only agreement.
> >
> > On Mon, Oct 16, 2017 at 8:15 AM, Ian Swett <ianswett@google.com> wrote:
> >>
> >> I believe the motivation for separate stream limits is to put a
> reasonable
> >> limit on the number of incoming streams you'll accept. Otherwise, an
> >> application could use a very large number of one type(ie: uni) of
> stream and
> >> almost none of another(ie: bidi), which would allow them to suddenly
> open a
> >> huge number of the other type(ie: bidi) of stream if they wanted.
> >>
> >> If we were using H2 style max open streams we could do it either way,
> but
> >> I think keeping them separate is probably best anyway.
> >>
> >> On Mon, Oct 16, 2017 at 11:01 AM, Roberto Peon <fenix@fb.com> wrote:
> >>>
> >>> In H2, the even/odd thing was just an easy way to encode a unique ID
> per
> >>> stream while indicating direction.
> >>> This proposal seems to do the same thing, and that makes sense to
> >>> me—instead of even-odd, we have mod-4-offset.
> >>>
> >>> I’d ask why bother to have separate stream limits. You could still
> just
> >>> have the one limit for the overall space.
> >>> With H2, that was part of the point of putting it there (though it was
> >>> implit)—it was all part of one space, and thus the space was singly
> >>> countable!
> >>>
> >>>
> >>>
> >>> -=R
> >>>
> >>>
> >>>
> >>> From: QUIC <quic-bounces@ietf.org> on behalf of Ian Swett
> >>> <ianswett@google.com>
> >>> Date: Friday, October 13, 2017 at 2:05 PM
> >>> To: Mike Bishop <Michael.Bishop@microsoft.com>
> >>> Cc: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>, "quic@ietf.org"
> >>> <quic@ietf.org>, Hugues Fafard <fafard@in.tum.de>
> >>>
> >>>
> >>> Subject: Re: Identify streams unidirectional vs bidirectional based on
> >>> stream ID
> >>>
> >>>
> >>>
> >>> In many ways, they are 4 independent spaces, but Ryan pointed out to
> me
> >>> that both for the purposes of draft text and implementation it's very
> useful
> >>> to have a single unique identifier for a stream, since otherwise you
> have to
> >>> talk about/pass around (StreamID, Type) everywhere instead of just
> StreamID.
> >>>
> >>>
> >>>
> >>> Keeping one stream ID avoids creating two of all the stream specific
> >>> frames(STOP_SENDING, RST_STREAM, STREAM_FRAME, MAX_DATA_OFFSET, etc),
> one
> >>> for each stream space.
> >>>
> >>>
> >>>
> >>> Using the two most significant bits would eliminate the usefulness of
> any
> >>> variable length integer encoding(current or Martin's new proposal), so
> using
> >>> the lower bits makes sense.
> >>>
> >>>
> >>>
> >>> On Fri, Oct 13, 2017 at 4:56 PM, Mike Bishop
> >>> <Michael.Bishop@microsoft.com> wrote:
> >>>
> >>> Indeed. I almost think it makes more sense to say that there are four
> >>> independent stream spaces, each with their own numbers. That does mean
> that
> >>> each side will need to separately manage Max Stream ID for two spaces,
> but
> >>> that seems more reasonable than the alternative. In fact, this PR
> already
> >>> implies that the limits for unidirectional and bidirectional streams
> are
> >>> handled separately, which gets really weird when the IDs are
> interleaved
> >>> with each other.
> >>>
> >>>
> >>>
> >>> In fact, this plays well with the variable-length encoding idea, since
> >>> the maximum size of a Stream ID would be 62 bits. They could then be
> stored
> >>> locally as a 64-bit value with the “extra” bits indicating which space
> they
> >>> refer to.
> >>>
> >>>
> >>>
> >>> From: QUIC [mailto:quic-bounces@ietf.org] On Behalf Of Mikkel Fahnøe
> >>> Jørgensen
> >>> Sent: Friday, October 13, 2017 1:04 PM
> >>> To: quic@ietf.org; Hugues Fafard <fafard@in.tum.de>
> >>> Subject: Re: Identify streams unidirectional vs bidirectional based on
> >>> stream ID
> >>>
> >>>
> >>>
> >>> Especially with the new variable length encoding proposal, storing the
> >>> identifiers early makes sense, as you only have to inspect the first
> byte.
> >>> But it gets complicated, because you don’t want to use 8 bytes for
> some
> >>> stream types and you don’t want the bits at some random location in a
> >>> decoded 8 byte representation either.
> >>>
> >>>
> >>>
> >>> Regardless of bit placement, encoding state using bits is not ideal
> when
> >>> considering variable length encoding because you now use two bits for
> length
> >>> and two bits for stream type, leaving only 16 different streams before
> the
> >>> stream identifier needs to use two bytes, and so forth.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Kind Regards,
> >>>
> >>> Mikkel Fahnøe Jørgensen
> >>>
> >>>
> >>>
> >>> On 13 October 2017 at 21.50.06, Hugues Fafard (fafard@in.tum.de)
> wrote:
> >>>
> >>> I see, you used the 2 least significant bits to encode that
> >>> information. When only using one bit to indicate the direction, it
> >>> boiled down to odd/even which more or less made sense, but when using
> >>> 2 bits that breaks apart.
> >>>
> >>> Why not use the most significant bits instead? That way, getting the
> >>> 'clean' stream ID without the flags would be as simple doing a `&
> >>> 0x3F...FF` instead of bit-shifting things around. Similarly, encoding
> >>> the stream ID would just entail `| 0x?0...00` to set the appropriate
> >>> bits and also avoid bit-shifts.
> >>>
> >>> Regards,
> >>> Hugues
> >>>
> >>> On 2017-10-13 20:51, Ryan Hamilton wrote:
> >>> > As I understand the discussions at the interim, we've decided to
> >>> > allow streams to be unidirectional or bidirectional. I support this
> >>> > idea and was motivated to write up an idea I've been thinking about
> >>> > for a while. In the same way that we use a bit in the stream ID to
> >>> > identify the client vs server nature of the stream, we can use a
> >>> > bit to identify the directionality. This divides the stream ID
> >>> > space neatly into 4 distinct spaces (much like the 2 two we have
> >>> > today: client/server). In addition this means that a stream ID
> >>> > always uniquely identifies a single stream, and frames which
> >>> > mention stream ID (STREAM, MAX_STREAM_ID, MAX_STREAM_DATA,
> >>> > RST_STREAM, etc) do not need to explicitly convey the
> >>> > directionality as fields in those frames (or implicitly based on
> >>> > the directionality of the frames themselves).
> >>> >
> >>> > https://github.com/quicwg/base-drafts/pull/872
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fquicwg%2Fbase-drafts%2Fpull%2F872&data=02%7C01%7Cpravb%40microsoft.com%7C7fd2013c69494e8d202a08d514fd326e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636438000073300849&sdata=ou8Qaukn6GgIa0bsWPVCWrTLkutNaW85THUQfjLduys%3D&reserved=0>
> >>> >
> >>> > Cheers,
> >>> >
> >>> > Ryan
> >>>
> >>>
> >>
> >>
> >
>
>