Skip to content

Add a PetClinic benchmark for the re-warmup cost of late retransformation - #13770

Draft
dougqh wants to merge 1 commit into
masterfrom
dougqh/retransform-warmup-benchmark
Draft

dougqh wants to merge 1 commit into
masterfrom
dougqh/retransform-warmup-benchmark

Conversation

@dougqh

@dougqh dougqh commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds dd-java-agent/benchmark-integration/retransform-warmup/, a benchmark for what retransforming already-loaded, hot classes costs a running application.

It runs Spring PetClinic with the tracer under steady load, and at 60 s of JVM uptime (well after warmup) does one of:

Arm What happens at 60 s
baseline nothing; the tracer instruments from the start
deferred dd.experimental.defer.integrations.until=60s: the tracer retransforms the classes it deferred
control a small agent retransforms ~1,500 loaded Spring, Tomcat and Thymeleaf classes with identical bytes, in one call
control-each the same, one retransformClasses call per class

run.sh <arm> fetches PetClinic at the pinned commit (fetch-petclinic.sh), sends traces to the existing Agent stub, records JFR, and prints a summary. The per-second timeline joins throughput and latency with JFR deoptimizations, compilations and compile time.

Motivation

Moving work out of startup by applying instrumentation late is often assumed to be cheap. But retransforming a class makes the JVM discard the compiled code of that class and of everything that inlined it, even when the bytes don't change, and the application warms up again under live traffic. Instrumentation targets the classes every request flows through, so late transformation hits exactly the classes where this costs the most. This benchmark makes that cost measurable, so we can compare it with what moving the work saves.

Results so far (JDK 17, 8-core laptop, one run per arm):

Arm Worst second Recovery Lost work
control (identical bytes, one call) −76% throughput ~14 s 6.0 s at full speed
deferred −68% ~33 s to 95% 6.7 s
control-each −97% for 58 s ~5 s after the last call 59.3 s

A later control run on a busier machine dropped 65% and lost 2.1 s, so single runs vary a lot. The README has the full table and caveats.

Additional Notes

  • Lost work is the throughput missing against the steady state until recovery, in seconds at full speed. It reflects what customers feel (warm-up), which time-to-ready doesn't.
  • The load generator waits for each response, so it under-reports latency during a stall; read the throughput drop first.
  • Not covered yet: a single-CPU run, where compiler threads compete directly with request threads.
  • The JFR settings are generated from the running JDK's default.jfc (compilation threshold lowered to 0 ms) rather than committed.

🤖 Generated with Claude Code

…tion

Runs Spring PetClinic with the tracer under steady load and retransforms loaded classes at 60 s
of uptime: the deferred-integrations feature, or an agent retransforming hot Spring, Tomcat and
Thymeleaf classes with identical bytes (one call, or one call per class). Joins per-second
throughput and latency with JFR deoptimizations and compilations, and prints the lost work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added type: feature Enhancements and improvements tag: performance Performance related changes tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM labels Dec 2, 2026
@dd-octo-sts

dd-octo-sts Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.97 s 14.90 s [-0.4%; +1.4%] (no difference)
startup:insecure-bank:tracing:Agent 13.81 s 13.77 s [-0.6%; +1.1%] (no difference)
startup:petclinic:appsec:Agent 17.68 s 16.92 s [+0.3%; +8.7%] (maybe worse)
startup:petclinic:iast:Agent 16.98 s 17.65 s [-8.0%; +0.4%] (no difference)
startup:petclinic:profiling:Agent 16.68 s 17.36 s [-8.1%; +0.3%] (no difference)
startup:petclinic:sca:Agent 17.61 s 17.53 s [-0.3%; +1.2%] (no difference)
startup:petclinic:tracing:Agent 16.64 s 16.90 s [-2.6%; -0.5%] (maybe better)

Commit: fb4a034f · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes tag: performance Performance related changes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant