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

look into improving startup time related to tonic tls-roots initialization #392

Open
cprice404 opened this issue Oct 4, 2024 · 0 comments

Comments

@cprice404
Copy link
Contributor

cprice404 commented Oct 4, 2024

While doing some benchmarking for a lambda environment I discovered that it was taking a very long time to initialize the CacheClient in cases where I wanted to create multiple gRPC channels. On my laptop, instantiating 10 of the grpc clients to support 10 channels was taking about 3 seconds.

@kvcache helped me profile and investigate and it turns out that all of the time is being spent by tonic in loading the tls-roots certificates:

tonic = { version = "0.10", features = ["tls", "tls-roots", "tls-webpki-roots"] }

If we remove the tls-roots feature from the tonic dependency specification, the time required to instantiate the clients drops to ~3 milliseconds.

However, it doesn't seem safe to disable that feature if it is only configurable at build time, it seems like it would have a high risk of breaking the TLS support in some environments.

We should probably try upgrading to a newer version of tonic and seeing if the TLS support is more configurable now. e.g., if we could manually parse the certs once on our own and then pass the result of that in explicitly so that it could be re-used across multiple clients, that would probably help a great deal. It's also possible that there are optimizations that could be made to the parsing itself.

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

No branches or pull requests

1 participant