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

SSL connection reusage #239

Open
samfrown opened this issue Feb 8, 2021 · 2 comments · May be fixed by #251
Open

SSL connection reusage #239

samfrown opened this issue Feb 8, 2021 · 2 comments · May be fixed by #251

Comments

@samfrown
Copy link

samfrown commented Feb 8, 2021

Hi

I faced a performance issue of high CPU usage in a service backed by Vault storage.
The service is processing about 300 requests per second leading to the same or more amount of reads to the Vault cluster.

Profiling shows that most of the CPU time (>80%) service is spending in SSL connection handshake code. It also affects a Vault server load.

Seems that a new connection is opened on each request.
Moreover, tests show that the old connection isn't closed (disconnected) right after usage and persisted in the keep-alive cache by JVM.

Java HTTP implementation supports persistent connections out of the box
https://docs.oracle.com/javase/7/docs/technotes/guides/net/http-keepalive.html

But for HTTPS the consequent requests should also use the same instance of SSLSocketFactory.

Sample fixes are here master...samfrown:ssl-connections-reusage

The idea is to build and keep an SSLSocketFactory instance with a SslConfig/VaultConfig instance. So the same SSLSocketFactory can be passed to a Rest instance on every operation based on the same config.
It requires additional configuration on every Rest instance creation so I fixed this only for the Logical class yet.

I would like to discuss this solution and prepare a PR if it will be found suitable.

@agupta-hw
Copy link

Can this be merged? I am seeing similar issues with using ssl.

@samfrown
Copy link
Author

samfrown commented Mar 2, 2022

I've just created PR - but the project seems dead :(

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 a pull request may close this issue.

2 participants