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

AWS: Enable RetryMode for AWS KMS client #11420

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hsiang-c
Copy link
Contributor

@hsiang-c hsiang-c commented Oct 29, 2024

  • We're reaching the limit of AWS KMS requests per AWS account quota and we'd like to enable retry in KMS client to be more resilient to failures.
  • This PR is similar to AWS: Set better defaults for S3 retry behaviour #11052 but using the SDK provided RetryMode.
  • I didn't choose RetryPolicy b/c it is deprecated.

@github-actions github-actions bot added the AWS label Oct 29, 2024
@hsiang-c
Copy link
Contributor Author

@nastra @jackye1995 please review it when you have time, thanks!

Copy link
Member

@jbonofre jbonofre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. I just left a nit about pointing to the documentation (especially about retry mode accepted values).

this.kmsRetryMode = RetryMode.valueOf(KMS_RETRY_MODE_DEFAULT);
}

public KmsClientProperties(Map<String, String> properties) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would add the link to AWS configBuilder configuration, especially about retry mode (to know the accepted values for retry mode).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbonofre Thank you for your review! I linked to both RetryMode and ClientOverrideConfiguration.

@danielcweeks
Copy link
Contributor

Is this really necessary to make configurable? Why shouldn't we just set ADAPTIVE_V2 as the default when constructing the client? This is only for retry behavior, I'm not sure it's worth even making it an option.

@hsiang-c
Copy link
Contributor Author

hsiang-c commented Nov 7, 2024

@danielcweeks Thank you for your review.

Is this really necessary to make configurable?

I am also working on an enhancement to Iceberg S3 doc: #11321, which makes me think users might want to configure AWS service clients with available configurations provided by the client libraries.

This is only for retry behavior, I'm not sure it's worth even making it an option.

Got it, I have no problem with setting ADAPTIVE_V2 as the default, though the default mode is LEGACY according to AWS Java V2 SDK.

Is having too many options a concern to you? I'd like to learn more about your thoughts.

Thanks again for your time.

@danielcweeks
Copy link
Contributor

Is having too many options a concern to you? I'd like to learn more about your thoughts.

I feel like the proliferation of options is not a good thing unless there's real value being added. This doesn't seem to be one of those cases. Rather than adding a lot of boilerplate configuration, I would suggest just setting this at ADAPTIVE_V2, which seems to be an improvement upon the legacy default.

@hsiang-c
Copy link
Contributor Author

hsiang-c commented Nov 8, 2024

Thanks for your feedback @danielcweeks Please take a look again.

If you still have time, I have another PR for you #11321

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hsiang-c I agree with @danielcweeks that we need to be cautious when adding new properties, specifically what that means is evaluating if it's a valuable knob that's worth adding. In this case we know that we generally want to retry when throttled and the recommended strategy is adaptive so the produced clients should just do that without exposing things to users.

Overall this PR looks to be a good direction, just had a comment that I don't think the public KmsClientProperties class is needed at the moment.

import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.services.kms.KmsClientBuilder;

public class KmsClientProperties implements Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this class considering there's no separate properties we're introducing for KMS and the fact that it may make sense to also apply ADAPTIVE_V2 for Glue client as well (not needed in this PR, but down the line we could just use that)? Just don't want to avoid public properties classes until they're really necessary

I think an applyRetryConfigurations in the existing AwsClientProperties also would work well since that class is meant for generalizing across the different AWS clients.

Copy link
Contributor Author

@hsiang-c hsiang-c Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amogh-jahagirdar Thank you for your feedback.

Making applyRetryConfigurations as part of AwsClientProperties makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants