Skip to content

feat(sdk-core): add SdkWarmUp.prime() for CRaC auto-priming#7056

Open
joviegas wants to merge 1 commit into
feature/master/crac_auto_priming_supportfrom
joviegas/crac_warmup_orchestration_partA
Open

feat(sdk-core): add SdkWarmUp.prime() for CRaC auto-priming#7056
joviegas wants to merge 1 commit into
feature/master/crac_auto_priming_supportfrom
joviegas/crac_warmup_orchestration_partA

Conversation

@joviegas

@joviegas joviegas commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Next building block of CRaC (Coordinated Restore at Checkpoint) auto-priming: the warm-up entry point that drives priming before a checkpoint. Builds on the previously added SdkWarmUpProvider SPI. Follows the same ServiceLoader discovery pattern the SDK already uses for SdkHttpService (the HTTP-client loader).

Modifications

  • Add SdkWarmUp in software.amazon.awssdk.core.crac: a @SdkPublicApi final utility with a single static prime(). It discovers every SdkWarmUpProvider on the classpath via ServiceLoader and invokes warmUp() on each. Modeled on the HTTP-client ServiceLoader loader pattern.
  • Runs at most once per JVM (idempotent), thread-safe via an AtomicBoolean run-once guard.
  • Per-provider failure containment: a provider that throws or fails to load is logged and skipped so the others still run. Empty classpath is a safe no-op.
  • Add internal loader plumbing in software.amazon.awssdk.core.internal.crac (WarmUpInvoker + ClasspathWarmUpInvoker + WarmUpServiceLoader), splitting the discover-and-invoke logic from the static entry point so it stays testable.

License

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

License

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

@joviegas joviegas requested a review from a team as a code owner June 19, 2026 17:59
return;
}

ClasspathWarmUpInvoker.create().invokeAll();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this fails (raises some error), should we reset the PRIMED?

}

invokedAny = true;
try {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason to have two seperate try catch blocks here?

return ServiceLoader.load(SdkWarmUpProvider.class, classLoader).iterator();
}

private static final class CountingProvider implements SdkWarmUpProvider {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a little confused about why we have effectively 3 test implementations that do the same thing (CoutningProvider, RealProvider and CountingWarmUpProvider)? And why does this one use a private invocation counter vs the other ones public constant?

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