Add overloaded menthod for SdkWarmUp.prime overloaded to accept speci…#7130
Merged
joviegas merged 4 commits intoJul 13, 2026
Merged
Conversation
…fic clients that needs to be warmedUp
9a05f34 to
ccf1b3a
Compare
… that we can retry for next prime call
alextwoods
reviewed
Jul 10, 2026
| boolean warmFailed = false; | ||
| Set<ClientType> matched = EnumSet.noneOf(ClientType.class); | ||
| for (SdkWarmUpProvider provider : providers) { | ||
| ClientType transport = transportFor(requested, provider); |
Contributor
There was a problem hiding this comment.
Naming nit - I found "transport" here to be a litlte confusing - this makes me think about http1.1 vs http2 rather than sync vs async. Maybe just use clientType?
Contributor
Author
There was a problem hiding this comment.
Agreed. I renamed transportFor to clientTypeFor, matchedTransports to matchedClientTypes
| * successfully. | ||
| */ | ||
| @SdkInternalApi | ||
| public final class TargetedWarmUpResult { |
Contributor
There was a problem hiding this comment.
Since this is passed between layers it probably should implement equals/hashcode/toString
Contributor
Author
There was a problem hiding this comment.
Done also added EqualsVerifier test
alextwoods
approved these changes
Jul 13, 2026
59bf458
into
feature/master/crac_auto_priming_support
3 of 4 checks passed
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
SdkWarmUp.prime()warms everySdkWarmUpProvideron the classpath and the discovered HTTP transports. Applications that use a single client (for example onlyS3AsyncClient) pay the cost of warming clients and transports they never use. This change adds a targeted overload,SdkWarmUp.prime(Class...), that warms only the requested service clients and only the transports they need.Modifications
SdkWarmUp.prime(Class<? extends SdkClient>...): new@SdkPublicApioverload. Matches each requested class against the registered providers, warms the matched transport throughSdkWarmUpProvider.warmUpClient(ClientType), then runs only the HTTP warmer for the matched transports (sync, async, or both). Unmatched classes are logged at warn and skipped. Clients already primed in this JVM are skipped on later calls.TargetedWarmUpInvoker(new, internal): stateless matcher that maps requested class names against each provider'ssyncClientClassName()/asyncClientClassName()and returns the matched transports so the caller can narrow the HTTP warm-up.PrimedClientRegistry(new, internal): owns the "which clients are already primed" dedup state, so a client is warmed at most once per JVM. State is per-instance (unit-testable with fresh instances);SdkWarmUpholds one long-lived instance.prime(Class...)is lock-free — dedup uses a thread-safe set, and warm-up (network I/O) runs outside any lock. Concurrent calls may briefly double-warm the same client, which is harmless because warming is idempotent. A run that throws before completing does not record the client as primed, so it is retried on the next call. (ThePRIME_LOCKmutex is used only by the existing no-argprime().)Testing
Testing
License