Re: Identify streams unidirectional vs bidirectional based on stream ID

Jana Iyengar <jri@google.com> Thu, 26 October 2017 19:42 UTC

Return-Path: <jri@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 7659213F5F2 for <quic@ietfa.amsl.com>; Thu, 26 Oct 2017 12:42:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.71
X-Spam-Level:
X-Spam-Status: No, score=-0.71 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=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 j7A9cazcNEwU for <quic@ietfa.amsl.com>; Thu, 26 Oct 2017 12:42:09 -0700 (PDT)
Received: from mail-yw0-x244.google.com (mail-yw0-x244.google.com [IPv6:2607:f8b0:4002:c05::244]) (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 3454613F43D for <quic@ietf.org>; Thu, 26 Oct 2017 12:42:09 -0700 (PDT)
Received: by mail-yw0-x244.google.com with SMTP id w5so3892149ywg.11 for <quic@ietf.org>; Thu, 26 Oct 2017 12:42:09 -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=e/o+59uqXyAS0qvbU54ambC8PhWaDRVB30lH4Y541Cg=; b=ltoDBWf47KMxqJuj8mA/B0ZExt1WLmvZZ8ZDVm0n/UUx8tiettShe0CcWkKwPtjK2e xn86F+/Yi+GTmC1uaoxRVABztmRbTJOYfOdDf2jbIgJGbuXemOBl33iAt/O7fXq01+Ud UXNrV4iulAI8NEcYh0mV/IeVd4B1pRdkrONsJk74ZFkj6o5StUWAGHUkxypJt8q0VuD7 bfq5JQzJ2d0S/XP5OVSue0h3U4WvH3KzUuh7mPGw980d2JLVgDGou9eKFJoey03wTB+u wj5pCIFt6KG6kKmbD7iWmZaVpvJjQMwLv05yqUWs1pYZUnI44dQGuL208aD3rtKfcvny +r0Q==
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=e/o+59uqXyAS0qvbU54ambC8PhWaDRVB30lH4Y541Cg=; b=aOOr/nXPwSSSLyRAeueY1PBhhDf1Ni7cId8+TTdGYSWmIcryL/2agYe2r8iD/GwYvr IztSEaIT+MPd5GGxIgzxgNP9hp2nUiZ9ufsfSfEemDmIhTFuJv3gHx/ciHXPnT+j4Xm3 AsBcCDH+YP4qVD7+F9AmfAXtqHNLRZqmUK7KuLu/dOcTHl5xhsC3rZsGQdBhRcg057Ep woUR2wuZFU6YWSLuejJh29WcXTZ6KzTP9J5ghvDKeymYgcLhALCxUVLOi/sbfTnULiwz R6pM6YL7awUUg/ooGHfhAt7gIrUWEzwuYC6F/aXlaIKMecewA1YaotH0gDiy9N6jJj8C 8Prg==
X-Gm-Message-State: AMCzsaWHncG+fNk86jFxbi+xzbwo56RRzB0pyFrAPKCjR4sn6KEq0794 yOJDTqDqRFp4zqVZ4jd41jQi/qlgBRRvUEfT4lBWPg==
X-Google-Smtp-Source: ABhQp+Qs8n+ShcaAWc54yLolFFD4/XT0swiZVTtpVCvR8zTHnMCTfdZOAxP8Y/IcXARjIawAhQ2HYIBEA44UB2ILQeg=
X-Received: by 10.129.226.6 with SMTP id p6mr10824914ywl.72.1509046927900; Thu, 26 Oct 2017 12:42:07 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.37.70.5 with HTTP; Thu, 26 Oct 2017 12:42:06 -0700 (PDT)
In-Reply-To: <CAGD1bZYP23okSyWvkQ5jjbCPkciYLk2Bs_zkpqJDYOpS99R9XQ@mail.gmail.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> <CAGD1bZYP23okSyWvkQ5jjbCPkciYLk2Bs_zkpqJDYOpS99R9XQ@mail.gmail.com>
From: Jana Iyengar <jri@google.com>
Date: Thu, 26 Oct 2017 15:42:06 -0400
Message-ID: <CAGD1bZapVjFsyi-SwhzzG5c3-gD+c9wWKTAuKRBP7iQL_DTHXQ@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>, Mike Bishop <Michael.Bishop@microsoft.com>, Ian Swett <ianswett@google.com>, "quic@ietf.org" <quic@ietf.org>, Hugues Fafard <fafard@in.tum.de>, Roberto Peon <fenix@fb.com>
Content-Type: multipart/alternative; boundary="f403043eca7817257d055c785e47"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/sIWe4yjR28APc0DwIPP69AQ_794>
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: Thu, 26 Oct 2017 19:42:13 -0000

I'd like to merge #872 <https://github.com/quicwg/base-drafts/pull/872>. If
I don't hear any serious issues I'll merge it tomorrow.

On Mon, Oct 16, 2017 at 11:56 PM, Jana Iyengar <jri@google.com> wrote:

> On Mon, Oct 16, 2017 at 6: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?
>>
>
> There's not a lot of dedicated mechanisms; indeed you can implement uni as
> a special case of bidi streams. The issue was, as Ian summarized nicely
> here, that implicitly open streams became ambiguous. For instance if stream
> 15 was opened after stream 11,  the spec requires stream 13 to be opened
> implicitly, but should it be opened as a uni stream or a bidi one?
> Separating namespaces for uni/bidi means that only streams in that
> particular namespace are opened implicitly.
>
>
>
>>
>>
>> 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
>> >>>
>> >>>
>> >>
>> >>
>> >
>>
>>
>