Skip to content

Fixed bug where using profile-based credentials could cause the SDK to read the profile file with each request. #3950

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

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

millems
Copy link
Contributor

@millems millems commented Apr 25, 2023

This bug was introduced with the profile file supplier changes. If the customer was not overriding the profile file via the client override config AND was relying on profile file-based configuration, that configuration would be read with every request. This had a significant performance cost.

Benchmarking Results (software.amazon.awssdk.benchmark.apicall.protocol.JsonProtocolBenchmark)
Before:   2858.805 ± 181.491  ops/s
After:    10915.079 ± 677.022  ops/s

…o read the profile file with each request.

This bug was introduced with the profile file supplier changes. If the customer was not overriding the profile file via the client override config AND was relying on profile file-based configuration, that configuration would be read with every request. This had a significant performance cost.

```
Benchmarking Results (software.amazon.awssdk.benchmark.apicall.protocol.JsonProtocolBenchmark)
Before:   2858.805 ± 181.491  ops/s
After:    10915.079 ± 677.022  ops/s
```
@millems millems requested a review from a team as a code owner April 25, 2023 18:01
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@@ -264,9 +264,9 @@ protected SdkClientConfiguration mergeChildDefaults(SdkClientConfiguration confi
*/
private SdkClientConfiguration mergeGlobalDefaults(SdkClientConfiguration configuration) {
// Don't load the default profile file if the customer already gave us one.
Supplier<ProfileFile> configuredProfileFileSupplier = configuration.option(PROFILE_FILE_SUPPLIER);
Supplier<ProfileFile> profileFileSupplier = Optional.ofNullable(configuredProfileFileSupplier)
.orElseGet(() -> ProfileFile::defaultProfileFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does the potential read-every-request happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We call get() on the supplier for every request. The supplier used to be ProfileFile::defaultProfileFile, which reads the file when it is called.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, and now we're wrapping it in another layer. Tricky!

@millems millems merged commit 8e55ccc into master Apr 25, 2023
@millems millems deleted the millem/profile-reading-performance-update branch April 25, 2023 21:37
aws-sdk-java-automation added a commit that referenced this pull request May 19, 2025
…c79b30079

Pull request: release <- staging/6ea1a502-2c61-418b-94c7-ceac79b30079
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants