Skip to content

SslHandler avoid calling wrap/unwrap when unnecessary - #6311

Closed
Scottmitch wants to merge 1 commit into
netty:4.1from
Scottmitch:ssl_handler_optimize
Closed

Scottmitch wants to merge 1 commit into
netty:4.1from
Scottmitch:ssl_handler_optimize

Conversation

@Scottmitch

Copy link
Copy Markdown
Member

Motivation:
The SSLEngine wrap and unwrap methods can be called in a way that has no side effects, but this could involve costly validation and allocation. The SslHandler should avoid calling into these methods if possible.

Modifications:

  • wrapNonAppData should provide additional status which can be used by wrap to breakout early if possible

Result:
SslHandler invokes the SSLEngine less.

@Scottmitch Scottmitch added this to the 4.1.9.Final milestone Feb 4, 2017
@Scottmitch Scottmitch self-assigned this Feb 4, 2017
@Scottmitch
Scottmitch force-pushed the ssl_handler_optimize branch 2 times, most recently from 63adfa0 to 59e3a12 Compare February 4, 2017 22:03
@normanmaurer

Copy link
Copy Markdown
Member

@Scottmitch please check unit test failures.

@Scottmitch
Scottmitch force-pushed the ssl_handler_optimize branch from 59e3a12 to ad7c595 Compare February 6, 2017 18:18

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.

@Scottmitch can you put this in front of the while just to make it more clear:

unwrapLoop: while(....)

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 done

@Scottmitch
Scottmitch force-pushed the ssl_handler_optimize branch from ad7c595 to 6cc01e6 Compare February 6, 2017 19:54

@normanmaurer normanmaurer left a comment

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.

Just a few nits... LGTM otherwise

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.

@Scottmitch as you changed this to java docs please use {@link #setHandshakeFailure(.....

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.

done

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.

can you add some comments why its ok to break the loop in this case ?

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.

can you add some comments why its ok to break the loop in this case ?

Motivation:
The SSLEngine wrap and unwrap methods can be called in a way that has no side effects, but this could involve costly validation and allocation. The SslHandler should avoid calling into these methods if possible.

Modifications:
- wrapNonAppData should provide additional status which can be used by wrap to breakout early if possible

Result:
SslHandler invokes the SSLEngine less.
@Scottmitch
Scottmitch force-pushed the ssl_handler_optimize branch from 6cc01e6 to 94d6299 Compare February 7, 2017 08:09
@normanmaurer

Copy link
Copy Markdown
Member

@Scottmitch ship it

@Scottmitch

Copy link
Copy Markdown
Member Author

4.1 (6353c22) 4.0 (ab65b1e)

@Scottmitch Scottmitch closed this Feb 7, 2017
@Scottmitch
Scottmitch deleted the ssl_handler_optimize branch February 7, 2017 08:13
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.

2 participants