Skip to content

Map HTTP/2 Streams to Channels; branch 4.1#4503

Closed
ejona86 wants to merge 1 commit into
netty:4.1from
ejona86:http2-stream-as-channel-4.1
Closed

Map HTTP/2 Streams to Channels; branch 4.1#4503
ejona86 wants to merge 1 commit into
netty:4.1from
ejona86:http2-stream-as-channel-4.1

Conversation

@ejona86
Copy link
Copy Markdown
Member

@ejona86 ejona86 commented Nov 22, 2015

This allows using handlers for Streams in normal Netty-style. Tracking issue for larger set of changes along this vein is #3667.

This is a continuation of #3666, but against 4.1 instead of master. The "Map HTTP/2 Streams to Channels" commit is approximately where #3666 left off. The only difference is that the new example was created instead of modifying the pre-existing sample.

Fixing things to actually compile after rebasing is a separate commit to make it obvious what changes/hacks were needed. Overall, very few changes were made since the last review, but I'm now not aware of any blocking issues for to to be merged so that we can begin incremental improvements. Based on the last review, it seems we should be really close now.

@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented Nov 22, 2015

@Scottmitch, PTAL. Not many changes, and I hope I've made it easy to review after the rebase. As I mention, the base commit now creates a new example, but I hope that is easy to review since I only changed import/package and run-example.sh.

@nmittler, FYI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to use some other default size ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about defining a new SocketAddress type whose member fields are:

  • the actual SocketAddress of the underlying socket connection
  • the stream ID

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the moment I'm purposefully not exposing the stream id. Applications don't care about the stream id, and using an object reduces the need for each handler to keep its own int -> stream object mapping. On the child channel the "stream object" is the channel itself, so there's not a gain in exposing any more information here at present.

As we implement more of the features if we end up needing to expose more information, I'm game. But until we have a need, I'd rather leave it limited.

@trustin
Copy link
Copy Markdown
Member

trustin commented Mar 4, 2016

Left a few trivial comments. I see some comments from SonarQube or @normanmaurer were not addressed yet though.

@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented Mar 6, 2016

@normanmaurer @trustin, comments addressed or replied to, PTAL

@trustin, the only SonarQube comments I see are for the example, where they seem dubious and are prexisting in the current example. If I make fixes to the new copy I'd really want to fix the existing one as well, but I'd rather not do that in this PR to avoid scope creep.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INFO Complete the task associated to this TODO comment. rule

@mosesn
Copy link
Copy Markdown
Contributor

mosesn commented Mar 18, 2016

@normanmaurer @trustin is there anything else that needs to be done here? anything I can do to help get this merged? we're excited to start playing with this after it gets into netty.

@olix0r olix0r mentioned this pull request Mar 22, 2016
5 tasks
@Scottmitch
Copy link
Copy Markdown
Member

@mosesn - It seems everyone is content with this. I will pull in tomorrow if no objections.

@normanmaurer
Copy link
Copy Markdown
Member

+1

Am 24.03.2016 um 06:01 schrieb Scott Mitchell notifications@github.com:

@mosesn - It seems everyone is content with this. I will pull in tomorrow if no objections.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@mosesn
Copy link
Copy Markdown
Contributor

mosesn commented Mar 24, 2016

Awesome, super excited!

@normanmaurer normanmaurer added this to the 4.1.0.Final milestone Mar 24, 2016
@normanmaurer
Copy link
Copy Markdown
Member

@ejona86 please squash and I will cherry-pick :) Thanks again

@normanmaurer normanmaurer self-assigned this Mar 24, 2016
Motivation:

This allows using handlers for Streams in normal Netty-style. Frames are
read/written to the channel as messages, not directly as a
callback/method call. Handlers allow mixing and can ease HTTP/1 and
HTTP/2 interoperability by eventually supporting HTTP/1 handlers in
HTTP/2 and vise versa.

Modifications:

New handler Http2MultiplexCodec that converts from the current HTTP/2
API to a message-based API and child channels for streams.

Result:

The basics are done for server-side: new streams trigger creation of new
channels in much the same appearance to how new connections trigger new
channel creation. The basic frames HEADERS and DATA are handled, but
also GOAWAY and RST_STREAM.

Inbound flow control is implemented, but outbound is not. That will be
done later, along with not completing write promises on the child
channel until the write actually completes on the parent.

There is not yet support for outbound priority/weight, push promises,
and many other features.

There is a generic Object that may be set on stream frames. This also
paves the way for client-side support which needs a way to refer to
yet-to-be-created streams (due to how HEADERS allocates a stream id, and
the allocation order must be the same as transmission order).
@ejona86 ejona86 force-pushed the http2-stream-as-channel-4.1 branch from 48bf44b to a6e5cb1 Compare March 24, 2016 21:44
@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented Mar 24, 2016

@normanmaurer, squashed

@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented Mar 24, 2016

Thanks everyone! This has been a long ride with about a year of review and over 500 comments!

Now we just need to do the rest of the things from #3667.

@Scottmitch
Copy link
Copy Markdown
Member

Excellent work @ejona86 ! Lets figure out a good way to divide up the remaining work.

Cherry-picked 4.1 (e24a5d8, 61cfdd7)

@Scottmitch Scottmitch closed this Mar 25, 2016
@mosesn
Copy link
Copy Markdown
Contributor

mosesn commented Mar 25, 2016

@Scottmitch @ejona86 fwiw, I'd love to help out if I can. I'm hoping to build finagle's http2 server implementation against your new API.

@normanmaurer normanmaurer modified the milestones: 4.1.0.Final, 4.1.0.CR5 Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants