Skip to content

Cache the ChannelHandlerContext used in Http2StreamChannelBootstrap#9382

Merged
normanmaurer merged 1 commit into4.1from
stream_channel_bootstrap_cache
Jul 18, 2019
Merged

Cache the ChannelHandlerContext used in Http2StreamChannelBootstrap#9382
normanmaurer merged 1 commit into4.1from
stream_channel_bootstrap_cache

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

At the moment we lookup the ChannelHandlerContext used in Http2StreamChannelBootstrap each time the open(...) method is invoked. This is not needed and we can just cache it for later usage.

Modifications:

Cache ChannelHandlerContext in volatile field.

Result:

Speed up open(...) method implementation when called multiple times

if (ctx != null && !ctx.isRemoved()) {
return ctx;
}
ctx = channel.pipeline().context(Http2MultiplexCodec.class);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 calls to channel.pipeline() could be moved to a variable

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.

Sure I can do... that said I think it not really matters

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.

@doom369 addressed... please re-review.

Motivation:

At the moment we lookup the ChannelHandlerContext used in Http2StreamChannelBootstrap each time the open(...) method is invoked. This is not needed and we can just cache it for later usage.

Modifications:

Cache ChannelHandlerContext in volatile field.

Result:

Speed up open(...) method implementation when called multiple times
@normanmaurer normanmaurer force-pushed the stream_channel_bootstrap_cache branch from b327075 to 421e7ff Compare July 17, 2019 18:40
@normanmaurer normanmaurer added this to the 4.1.38.Final milestone Jul 17, 2019
Copy link
Copy Markdown
Member

@Scottmitch Scottmitch left a comment

Choose a reason for hiding this comment

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

thanks @normanmaurer, one question

@normanmaurer normanmaurer merged commit 84cf8f1 into 4.1 Jul 18, 2019
@normanmaurer normanmaurer deleted the stream_channel_bootstrap_cache branch July 18, 2019 08:20
normanmaurer added a commit that referenced this pull request Jul 18, 2019
…9382)

Motivation:

At the moment we lookup the ChannelHandlerContext used in Http2StreamChannelBootstrap each time the open(...) method is invoked. This is not needed and we can just cache it for later usage.

Modifications:

Cache ChannelHandlerContext in volatile field.

Result:

Speed up open(...) method implementation when called multiple times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants