-
Notifications
You must be signed in to change notification settings - Fork 193
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
Lazy initialize the default HTTP client #3262
Conversation
We could potentially switch to the regex-lite crate to make the first initialization faster as well. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
👀 You are working fast! Thank you! |
Split the regex changes out of this PR into #3269 |
Since trusted cert initialization only occurs once per process and is only slow on MacOS, I'm currently of the opinion that we shouldn't merge this change. There may be some throw away work in the case where a client is overridden, but that amount is negligible. The primary benefit to optimizing it is for reducing AWS Lambda cold start time, but that is running Linux, and overriding the client there seems niche. I could be persuaded otherwise though. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Even if this isn't required from a performance perspective, you still have the issue where loading native certs doesn't even work. For example, I suspect WASM may be broken by always initializing this connector? I think lazy-loading may be not worth it but I think we do need a solution for not loading one if one is already set. This is also going to make a big difference in running CI on macs as well. |
I believe WASM requires disabling the default hyper connector feature, so it actually still works in the present state. I'll take a look at lazily loading the trusted certs without a behavior version change. It probably is worth it for the tests. |
199b30d
to
15ee8ae
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
This change initializes the TLS trust certs at base client validation time rather than upon creation of the default HTTP client runtime plugin so that if the default is overridden, that initialization doesn't need to take place. This is especially helpful on MacOS where that initialization takes approximately 100 milliseconds.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.