Remove ServiceMetadata from client creation and request paths to improve cold start - #7161
Open
S-Saranya1 wants to merge 10 commits into
Open
Remove ServiceMetadata from client creation and request paths to improve cold start#7161S-Saranya1 wants to merge 10 commits into
S-Saranya1 wants to merge 10 commits into
Conversation
…ated client builders (#7094) * Remove ServiceMetadata usage from AwsClientEndpointProvider in generated client builders * Adding tests * Additional changes * Address PR comments
…eptors (#7105) * Remove ServiceMetadata usage from RDS/Neptune/DocDB presigning interceptors * Add tests
… DefaultPollyPresigner (#7110) * Remove ServiceMetadata usage from DefaultS3Presigner, S3Utilities, and DefaultPollyPresigner * Add tests and minor cleanup * cache endpoint at construction time in DefaultPollyPresigner * Address PR feedback * update comments
…erceptor (#7168) * Remove ServiceMetadata dependency from HelpfulUnknownHostExceptionInterceptor
* Stop generating ServiceMetadata classes for new services Add service-metadata-allowlist.txt to freeze ServiceMetadata generation to the current 307 services. New services added to endpoints.json will not get ServiceMetadata classes generated. ServiceMetadataProviderGenerator no longer depends on Partitions/endpoints.json — takes the service list directly from the allowlist. * Fix test failures * Fix checkstyle * fix fully-qualified class references * Fix spotbugs * Address PR feedback * Remove test/region-testing module and add variant tests to PartitionServiceMetadataTest
) * Remove resolveClientEndpointProvider from AwsDefaultClientBuilder This fallback method was triggering GeneratedServiceMetadataProvider initialization (~350ms) during every client creation because AttributeMap.build() eagerly resolves all lazy values including lazyOptionIfAbsent fallbacks. All generated clients have set CLIENT_ENDPOINT_PROVIDER themselves since SDK 2.27.16. Added null validation with clear error message for custom clients that don't set it * fix tests * update s3 depedency version in the old version compatibilty tests * Update javadoc * update javadoc * Adress PR feedback * Fix tests * Replace old-client-version-compatibility-test with service-client-backward-compat-test * Fix tests
Fred1155
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
ServiceMetadata.of() triggers the static initialization of GeneratedServiceMetadataProvider, which eagerly instantiates all 307 service metadata classes, adding 350-500ms of cold start latency to every AWS client creation. This significantly impacts Lambda and latency-sensitive applications. The endpoint resolved by ServiceMetadata is ultimately replaced by Endpoints 2.0 at request time anyway, making this initialization cost entirely wasted.
This PR removes all internal SDK usages of ServiceMetadata from client creation and request-processing paths, replaces them with direct Endpoints 2.0 resolution, freezes ServiceMetadata class generation to the current 307 services via an allowlist and not generate ServiceMetadata classes for new services, and removes the base class fallback that was triggering the expensive initialization. Fixes #3664
List of all the PRs that are merged into feature branch
#7094 — Remove ServiceMetadata from AwsClientEndpointProvider in generated builders
#7105 — Remove ServiceMetadata from RDS/Neptune/DocDB presigning interceptors
#7110 — Remove ServiceMetadata from DefaultS3Presigner, S3Utilities, DefaultPollyPresigner
#7168 — Remove ServiceMetadata from HelpfulUnknownHostExceptionInterceptor
#7163 — Remove ServiceMetadata from signing region resolution
#7186 — Remove resolveClientEndpointProvider from AwsDefaultClientBuilder
#7185 - Stop generating Service Metadata Classes for new services
Modifications
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License