-
Notifications
You must be signed in to change notification settings - Fork 855
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
AwsDefaultClientBuilder.mergeChildDefaults() instantiates DefaultCredentialsProvider which is expensive #749
Comments
This is another area that we are looking to improve in regards to cold start latency before we GA. As an aside, are you using the UrlConnectionClient? It should provide a reduction in cold start latency over the Apache Http client. |
@spfink that's great to know, I'm very excited by SDK version 2, it looks like it will be a fantastic update - thanks for your work 👍 Yes, I'm using |
The region and credentials providers are now lazily initialized. |
…cb5e05fc Pull request: release <- staging/859630d5-a0d0-4d86-8866-12dacb5e05fc
Expected Behavior
Specifying a
AwsCredentialsProvider
on a service client should avoid the need to create an instance ofDefaultCredentialsProvider
, which in turn creates 5 implementations ofAwsCredentialsProvider
as part of the chain.Current Behavior
If I've understood the code correctly, I think the reasoning for the current behaviour is to create a config with the defaults then merge this with any user-supplied configuration, resulting in a properly configured object. The code path for this is:
DynamoDbClient.builder().build()
software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration()
software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.mergeChildDefaults(SdkClientConfiguration)
software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider.create()
Possible Solution
I wonder if it's possible to add the user configuration first, and only add defaults for any properties not provided by the user? I guess this would be a change in
software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration()
Steps to Reproduce (for bugs)
The following code will take you down the code path I highlighted above
Context
I am using the SDK in a Lambda which CRUDs data in a DynamoDB table. The Lambdas provide the API for my client so need to be responsive; creating the DynamoDbClient is by far the slowest part of starting my Lambda (provisioning aside, which I can't control) and this is one of the slowest parts as best I can tell from stepping through the code. Populating the
Partitions
object fromendpoints.json
is also slow but that is captured in #748Your Environment
The text was updated successfully, but these errors were encountered: