-
Notifications
You must be signed in to change notification settings - Fork 247
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
Client::from_config() takes several ms to build a client #975
Comments
I believe it takes several ms to create the hyper_14 client with rustls. However, even if I create the client manually, the time does not improve: let tls_connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_webpki_roots()
.https_only()
.enable_http1()
.enable_http2()
.build();
let http_client = HyperClientBuilder::new().build(tls_connector); I pass |
yeah—the issue is creating the Hyper client. This is a priority to fix. Note that this should only occur once per process. |
Agreed, the only issue is that I need to create many clients with different credentials. I tried to pass in the client to the S3Client builder, but it seems to initialize or build another client anyways. |
do you have a code snippet? the connector should be cached in a lazy static so only the first client should be slow to initialize |
I create a config like so: let tls_connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_webpki_roots()
.https_only()
.enable_http1()
.build();
let http_client: aws_sdk_s3::config::SharedHttpClient = HyperClientBuilder::new().build(tls_connector);
let s3config = Config::builder()
.identity_cache(IdentityCache::no_cache())
.region(Region::new(region))
.endpoint_url(endpoint)
.http_client(http_client)
.force_path_style(true); And then I create an S3 client per per set of credentials: let config = self
.config
.clone()
.set_credentials_provider(Some(aws_credentials))
.clone()
.build();
start = std::time::Instant::now();
let client = Client::from_conf(config);
info!("Built AWS Client in {:?}", start.elapsed()); I assume the |
ah—gotcha. Yeah this is from the bug where the native-tls client is always instantiated. We're working on a fix. |
I think the We should avoid loading |
This fix for this has been merged and will go out in an upcoming release (but not necessarily the next one). |
Thank you! |
The fix for this went out in the December 14th release. |
|
Describe the bug
I need to create many clients with different credentials and endpoint parameters. I've been using
aws_sdk_s3::Client::from_conf(config)
for that. After looking into some performance issues, I realized thatClient::from_conf(config)
takes roughly 25ms in my dev build and 2.5ms in a release build. The config configures static credentials, a region and the identity cache is disabled withIdentityCache::no_cache()
.I'm not able to track down where the slow path is. Any ideas how to speed this up?
Expected Behavior
Creating a client should take microseconds.
Current Behavior
Creating a client should take milliseconds.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
Version
Environment details (OS name and version, etc.)
Apple M2
Logs
No response
The text was updated successfully, but these errors were encountered: