Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writability state of http2 child channels should be decoupled from th… #9235

Merged
merged 1 commit into from Jun 18, 2019

Conversation

Projects
None yet
2 participants
@normanmaurer
Copy link
Member

commented Jun 12, 2019

…e flow-controller

Motivation:

We should decouple the writability state of the http2 child channels from the flow-controller and just tie it to its own pending bytes counter that is decremented by the parent Channel once the bytes were written.

Modifications:

  • Decouple writability state of child channels from flow-contoller
  • Update tests

Result:

Less coupling and more correct behavior. Fixes #8148.

Writability state of http2 child channels should be decoupled from th…
…e flow-controller

Motivation:

We should decouple the writability state of the http2 child channels from the flow-controller and just tie it to its own pending bytes counter that is decremented by the parent Channel once the bytes were written.

Modifications:

- Decouple writability state of child channels from flow-contoller
- Update tests

Result:

Less coupling and more correct behavior. Fixes #8148.
@normanmaurer

This comment has been minimized.

Copy link
Member Author

commented Jun 12, 2019

@ejona86 PTAL... This replaces #9129 after discussing with you and @Scottmitch. Hope this is more "inline" with what you think is the correct behaviour for child-channels.

@@ -399,6 +392,21 @@ public final void channelRead(ChannelHandlerContext ctx, Object msg) throws Exce
super.channelRead(ctx, msg);
}

@Override
public final void channelWritabilityChanged(final ChannelHandlerContext ctx) throws Exception {
forEachActiveStream(new Http2FrameStreamVisitor() {

This comment has been minimized.

Copy link
@ejona86

ejona86 Jun 17, 2019

Member

Note that this can easily starve later streams. What does the writability of the parent channel even mean to the child, since the scheduler is choosing how much to write? Another stream could have buffered 1 MB and the parent channel is writable only because we haven't flush()ed.

This seems very expensive as we don't generally need to loop through all streams, and this will happen every write cycle. That alone seems prohibitive.

This comment has been minimized.

Copy link
@normanmaurer

normanmaurer Jun 17, 2019

Author Member

@ejona86 so you suggest to complete remove the "parent" relation ship here and also in isWritable ?

This comment has been minimized.

Copy link
@ejona86

ejona86 Jun 17, 2019

Member

I think removing the "parent" relationship is better than what is here. In my design I had expected to ignore the parent's writability.

But I could accept somewhere in-between if we can come up with something. Like: a stream only goes writable after the parent goes writable, but then it will stay writable even as the parent's writability changes, until the stream goes unwritable due to its own writes at which point it will wait for the parent again. That could (eventually) be implemented without looping over all streams and would have significantly fewer notifications. It would also prevent starvation (fairness could still be impacted, though). Other ideas welcome.

This comment has been minimized.

Copy link
@normanmaurer

normanmaurer Jun 17, 2019

Author Member

@ejona86 I see... Let me think about if I can do this cheaply. If not you are happy with the rest (when the parent relationship would be completely removed) ?

This comment has been minimized.

Copy link
@ejona86

ejona86 Jun 17, 2019

Member

The rest looks fine.

It looks like the previous onHttp2StreamWritabilityChanged changed when the channel writability changed, so I guess the issue I'm raising here is pre-existing.

@ejona86
Copy link
Member

left a comment

Since the issue I raised was pre-existing, LGTM. My comment is still something that should probably be changed eventually, but this is a step in the right direction.

@normanmaurer

This comment has been minimized.

Copy link
Member Author

commented Jun 17, 2019

@ejona86 ok cool... will look into doing a followup.

@normanmaurer normanmaurer merged commit f945a07 into 4.1 Jun 18, 2019

3 checks passed

pull request validation (centos6-java11) Build finished.
Details
pull request validation (centos6-java12) Build finished.
Details
pull request validation (centos6-java8) Build finished.
Details

@normanmaurer normanmaurer deleted the http2_multiplex_writability branch Jun 18, 2019

normanmaurer added a commit that referenced this pull request Jun 18, 2019

Writability state of http2 child channels should be decoupled from th…
…e flow-controller (#9235)

Motivation:

We should decouple the writability state of the http2 child channels from the flow-controller and just tie it to its own pending bytes counter that is decremented by the parent Channel once the bytes were written.

Modifications:

- Decouple writability state of child channels from flow-contoller
- Update tests

Result:

Less coupling and more correct behavior. Fixes #8148.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.