Skip to content

Cache auth scheme resolution results per operation - #7282

Open
davidh44 wants to merge 2 commits into
masterfrom
hdavidh/cache-authScheme
Open

Cache auth scheme resolution results per operation#7282
davidh44 wants to merge 2 commits into
masterfrom
hdavidh/cache-authScheme

Conversation

@davidh44

Copy link
Copy Markdown
Contributor

Motivation and Context

Cache deterministic auth scheme resolution results to reduce per-request CPU overhead. Auth scheme resolution is called on every request and produces the same result for a given operation when using the default provider - caching avoids repeated allocation and computation.

Modifications

  • Generate ConcurrentHashMap<String, List<AuthSchemeOption>> authSchemeCache field on sync/async client classes
  • Cache activates only when: 1) no per-request auth scheme provider override AND 2) client-level provider instanceof DefaultXxxAuthSchemeProvider
  • Disabled for endpoint-based auth provider services (e.g. S3) where resolution depends on endpoint parameters

Testing

  • Added unit tests
  • Ran benchmarks confirming no regression on full-roundtrip workloads and significant savings on the isolated auth resolution path

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@davidh44
davidh44 requested a review from a team as a code owner August 14, 2026 23:03
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.

1 participant