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

8298381: Improve handling of session tickets for multiple SSLContexts #2750

Closed
wants to merge 2 commits into from

Conversation

schlosna
Copy link
Contributor

@schlosna schlosna commented Jul 29, 2024

I would like to propose a backport of JDK-8298381 commit openjdk/jdk@debe587 that landed in JDK 21 to jdk17u. This change significantly improves TLS handshaking latency and throughput for services that utilize multiple SSLContext. As an example, Apache Kafka running on JDK 17 with significant numbers of clients may see over 40% of CPU utilization due to SessionTicketExtension$KeyState.cleanup(HandshakeContext).

@simonis or others, would you be willing to sponsor this change to JDK 17u and create a corresponding JIRA ticket?

Thanks!


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8298381 needs maintainer approval

Issue

  • JDK-8298381: Improve handling of session tickets for multiple SSLContexts (Bug - P3 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/2750/head:pull/2750
$ git checkout pull/2750

Update a local copy of the PR:
$ git checkout pull/2750
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/2750/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2750

View PR using the GUI difftool:
$ git pr show -t 2750

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/2750.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 29, 2024

👋 Welcome back schlosna! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 29, 2024

@schlosna This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8298381: Improve handling of session tickets for multiple SSLContexts

Reviewed-by: phh

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 2 new commits pushed to the master branch:

  • c32a56f: 8331077: nroff man page update for jar tool
  • f4e8194: 8324753: [AIX] adjust os_posix after JDK-8318696

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@phohensee) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 29, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 29, 2024

Webrevs

@schlosna
Copy link
Contributor Author

As an example, Apache Kafka running on JDK 17 with significant numbers of clients may see over 40% of CPU utilization due to SessionTicketExtension$KeyState.cleanup(HandshakeContext) as seen in JFR snippets from an example environment. Upgrading to JDK 21 does resolve this as expected; however, there are some systems that may not be able to immediately upgrade to JDK 21 or later that would benefit from this change.

image
image

The most sampled method was void sun.security.ssl.SessionTicketExtension$KeyState.cleanup(HandshakeContext), with 4.33 % of the maximum possible samples for 7/27/2024, 3:19:48.000 PM – 3:20:18 PM, and 46.9 % of the actual samples.
The methods that used the most CPU are:
sun.security.ssl.SessionTicketExtension$KeyState.cleanup(HandshakeContext) (46.9 % of samples) 7/27/2024, 3:19:48.000 PM – 3:20:18 PM

The most common stack trace was:
  at void sun.security.ssl.SessionTicketExtension$KeyState.cleanup(sun.security.ssl.HandshakeContext)
  at sun.security.ssl.SessionTicketExtension$StatelessKey sun.security.ssl.SessionTicketExtension$KeyState.nextKey(sun.security.ssl.HandshakeContext)
  at sun.security.ssl.SessionTicketExtension$StatelessKey sun.security.ssl.SessionTicketExtension$KeyState.getCurrentKey(sun.security.ssl.HandshakeContext)
  at byte[] sun.security.ssl.SessionTicketExtension$SessionTicketSpec.encrypt(sun.security.ssl.HandshakeContext, sun.security.ssl.SSLSessionImpl)
  at byte[] sun.security.ssl.NewSessionTicket$T12NewSessionTicketProducer.produce(sun.security.ssl.ConnectionContext, sun.security.ssl.SSLHandshake$HandshakeMessage)
  at byte[] sun.security.ssl.Finished$T12FinishedProducer.onProduceFinished(sun.security.ssl.ServerHandshakeContext, sun.security.ssl.SSLHandshake$HandshakeMessage)
  at byte[] sun.security.ssl.Finished$T12FinishedProducer.produce(sun.security.ssl.ConnectionContext, sun.security.ssl.SSLHandshake$HandshakeMessage)
  at byte[] sun.security.ssl.SSLHandshake.produce(sun.security.ssl.ConnectionContext, sun.security.ssl.SSLHandshake$HandshakeMessage)
  at void sun.security.ssl.Finished$T12FinishedConsumer.onConsumeFinished(sun.security.ssl.ServerHandshakeContext, java.nio.ByteBuffer)
  at void sun.security.ssl.Finished$T12FinishedConsumer.consume(sun.security.ssl.ConnectionContext, java.nio.ByteBuffer)
  at void sun.security.ssl.SSLHandshake.consume(sun.security.ssl.ConnectionContext, java.nio.ByteBuffer)
  at void sun.security.ssl.HandshakeContext.dispatch(byte, java.nio.ByteBuffer)
  at void sun.security.ssl.HandshakeContext.dispatch(byte, sun.security.ssl.Plaintext)
  at void sun.security.ssl.TransportContext.dispatch(sun.security.ssl.Plaintext)
  at sun.security.ssl.Plaintext sun.security.ssl.SSLTransport.decode(sun.security.ssl.TransportContext, java.nio.ByteBuffer[], int, int, java.nio.ByteBuffer[], int, int)
  at sun.security.ssl.Plaintext sun.security.ssl.SSLEngineImpl.decode(java.nio.ByteBuffer[], int, int, java.nio.ByteBuffer[], int, int)
  at javax.net.ssl.SSLEngineResult sun.security.ssl.SSLEngineImpl.readRecord(java.nio.ByteBuffer[], int, int, java.nio.ByteBuffer[], int, int)
  at javax.net.ssl.SSLEngineResult sun.security.ssl.SSLEngineImpl.unwrap(java.nio.ByteBuffer[], int, int, java.nio.ByteBuffer[], int, int)
  at javax.net.ssl.SSLEngineResult sun.security.ssl.SSLEngineImpl.unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[], int, int)
  at javax.net.ssl.SSLEngineResult javax.net.ssl.SSLEngine.unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer)
  at javax.net.ssl.SSLEngineResult org.apache.kafka.common.network.SslTransportLayer.handshakeUnwrap(boolean, boolean)
  at void org.apache.kafka.common.network.SslTransportLayer.doHandshake()
  at void org.apache.kafka.common.network.SslTransportLayer.handshake()
  at void org.apache.kafka.common.network.KafkaChannel.prepare()
  at void org.apache.kafka.common.network.Selector.pollSelectionKeys(java.util.Set, boolean, long)
  at void org.apache.kafka.common.network.Selector.poll(long)
  at void kafka.network.Processor.poll()
  at void kafka.network.Processor.run()
  at void java.lang.Thread.run()

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

Lgtm. I can sponsor, Volker is on vacation. No need to create a backport JBS issue, the bot will do that when it pushes the backport.

@openjdk
Copy link

openjdk bot commented Jul 29, 2024

⚠️ @schlosna This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@schlosna
Copy link
Contributor Author

/approval request Proposing backport JDK-8298381 commit openjdk/jdk@debe587 that landed in JDK 21 to jdk17u. This change significantly improves TLS handshaking latency and throughput for services that utilize multiple SSLContext. As an example, Apache Kafka running on JDK 17 with significant numbers of clients may see over 40% of CPU utilization due to SessionTicketExtension$KeyState.cleanup(HandshakeContext).

@openjdk
Copy link

openjdk bot commented Jul 29, 2024

@schlosna
8298381: The approval request has been created successfully.

@schlosna
Copy link
Contributor Author

Excellent, thanks @phohensee and have a great vacation Volker.

Please let me know if there's anything else I can do to help move this along.

@openjdk openjdk bot added the approval label Jul 29, 2024
@openjdk
Copy link

openjdk bot commented Jul 30, 2024

⚠️ @schlosna the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout ds/8298381
$ git commit --author='Preferred Full Name <you@example.com>' --allow-empty -m 'Update full name'
$ git push

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval labels Jul 30, 2024
@phohensee
Copy link
Member

Please replace the PR title with "Backport debe5879aa7118a114ff6fcf8d15951757ae70a8" and let the bot do its thing.

@schlosna schlosna changed the title 8298381: Improve handling of session tickets for multiple SSLContexts Backport debe5879aa7118a114ff6fcf8d15951757ae70a8 Jul 30, 2024
@openjdk openjdk bot changed the title Backport debe5879aa7118a114ff6fcf8d15951757ae70a8 8298381: Improve handling of session tickets for multiple SSLContexts Jul 30, 2024
@openjdk
Copy link

openjdk bot commented Jul 30, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport label Jul 30, 2024
@schlosna
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 30, 2024
@openjdk
Copy link

openjdk bot commented Jul 30, 2024

@schlosna
Your change (at version 47cbc35) is now ready to be sponsored by a Committer.

@phohensee
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 30, 2024

Going to push as commit a15f35d.
Since your change was applied there have been 2 commits pushed to the master branch:

  • c32a56f: 8331077: nroff man page update for jar tool
  • f4e8194: 8324753: [AIX] adjust os_posix after JDK-8318696

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 30, 2024
@openjdk openjdk bot closed this Jul 30, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 30, 2024
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jul 30, 2024
@openjdk
Copy link

openjdk bot commented Jul 30, 2024

@phohensee @schlosna Pushed as commit a15f35d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@schlosna schlosna deleted the ds/8298381 branch August 16, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants