-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 builder seems to always load com.amazonaws.auth.DefaultAWSCredentialsProviderChain which is expensive #2211
Comments
Hi @ocind, the DefaultAWSCredentialsProviderChain is more expensive because it will search for credentials in the whole credential provider chain. To avoid this search you can explicitly provide the credentials to the client builder using Regarding the DynamoDB high level library for V2, the team is actively working on it. There are several PRs being worked on (look for the ones that mention DynamoDB enhanced preview), you can track the development status (aws/aws-sdk-java-v2#35) and you can read an overview of the refactored library here: https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/README.md Participation is welcome, we'll be glad to hear your feedback on any stage of its development. |
hi @debora-ito thank you for the response! The way we are supposed to use I was wondering when we do I was suspecting that .standard() basically loads all the default parameters first (which includes loading the I noticed that in AmazonS3ClientBuilder this is actually the case, as can be seen on https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3ClientBuilder.java#L46 The .standard() method actually still loads DefaultAWSCredentialsProviderChain anyway by initializing So the best thing that I can do here is actually not to specify any kind of I saw some github issues' response such as #1774 (comment) in which it seems to be recommended to specify a credentials providers to improve cold start performance. As mentioned above, I think this is actually not the case (at least for Can you help me to clarify if it is the case? I think the best solution for this problem is to replicate the functionality of If this can be done for
Yes, I have been following the development closely as well :) |
Ah apparently this is very similar to this issue reported in V2: aws/aws-sdk-java-v2#749 for which this commit is fixing |
hi @debora-ito I noticed that this issue does not happen with Do you have any suggestion on how to load |
@ocind I'm sorry for the long silence, this issue slipped through the cracks. A lot has changed since 2020! We talked about DynamoDB Enhanced client and it is now generally available. Unfortunately we don't have plans to change the I'll go ahead and mark to this auto-close soon. Let me know if you have any more questions. |
For AmazonDynamoDBClientBuilder the recommended way to initialize the client is
AmazonDynamoDBClientBuilder.standard().withCredentials(...).build()
As I read in various other issues (such as #1774), DefaultAWSCredentialsProviderChain is expensive to create and should be avoided. However, there is no way not to load DefaultAWSCredentialsProviderChain while using the AmazonDynamoDBClientBuilder.
There was
AmazonDynamoDBClient(AWSCredentialsProvider awsCredentialsProvider)
however it has already been deprecated. https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/AmazonDynamoDBClient.java#L283Is there a way to initialize AmazonDynamoDBClient without loading DefaultAWSCredentialsProviderChain to minimize cold start time?
I noticed that the SDK team does not consider new improvements for V1 anymore and focusing on V2 SDK development instead. We really wanted to move to v2 sdk however the lack of DynamoDb high level client in v2 really hinders us from doing so. It has been 2 years since V2 SDK is considered GA without a high level client. Hopefully it could be completed soon!
The text was updated successfully, but these errors were encountered: