Repository navigation
Add self-serve PetClinic macro-benchmark harness (macrobenchmark) - #11956
Conversation
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
|
Neat! |
One-command PetClinic macro benchmark extending benchmark-integration: fetch + build PetClinic (pinned commit), run it under the agent across version and heap sweeps with a wrk load, capture JFR, and analyze into throughput plus the tracer-overhead split (foreground/background x instrumentation/core, CPU + sampled allocation). Detects a local Datadog Agent on the (configurable) APM port and picks the writer accordingly -- agent-reachable = full pipeline incl. the background serializer, unreachable = the agent-down regime -- with an EXPECT_AGENT guard so an unattended sweep fails fast rather than silently measuring the wrong regime. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The readiness check was TCP-only (`nc -z localhost 8080`), so wrk could start before the app was actually serving under load. Under the java agent (slower startup) this produced `connect` socket errors and a bogus ~26x throughput collapse on the agent runs — a measurement artifact, not tracer overhead (a direct sustained-load repro shows agent ~= NoAgent on this workload). - Readiness gate now polls the home endpoint for a real HTTP 200 (curl if present, else python3), with a 180s timeout and a brief settle before wrk. - Add a sanity gate: if wrk reports socket connect errors on any endpoint, the server was unhealthy under load — abort loudly rather than record a garbage row. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ps -o 'pid,rss'/'pid,time' without -e only lists processes attached to the caller's controlling terminal, so the server PID spawned by this script was invisible in sandboxed/non-interactive shells -- the resulting awk match came up empty, corrupting the CPU/RSS delta columns with arithmetic errors. Target the PID directly with ps -p instead, which works regardless of terminal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Throughput on a shared dev box swings several percent run to run, which made single-sample sweeps hard to trust (see the 1.52.1 vs 1.54.0+ PetClinic sweep). Add test_repeats (PERF_REPEATS / PETCLINIC_REPEATS): warm up once per endpoint, then take N back-to-back measurement windows without restarting the server, and report throughput mean + stdev per endpoint instead of a single point estimate. Default is 1 repeat, matching prior behavior exactly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…s can't flood the run log Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Central Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
04dc06c to
2a4747b
Compare
A single-file Java program that serves a real Agent's /info response, accepts and discards trace and stats payloads immediately, and reports what it received at /_stats. It takes a slow or rejecting local Agent out of the measurement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd an Agent stub check run-perf-test.sh now runs the measured wrk with --latency and reports p99 and young GCs per 1,000 requests per endpoint. PERF_WRK_SCRIPT passes a Lua script to wrk; wrk-upstream-headers.lua makes every request continue a distributed trace (W3C and Datadog headers, baggage). PERF_SINK_STATS_URL points at an Agent stub's /_stats, and the sweep aborts if an agent variant delivered no traces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
run-petclinic.sh starts the Agent stub and points the agent variants at it, so a slow or rejecting local Agent can't change what's measured; PETCLINIC_AGENT=real uses the local Agent instead. Every request carries upstream trace headers unless PETCLINIC_UPSTREAM_HEADERS=false. GC logs are kept with the results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…un-perf-test.sh The Agent is detected by probing its port, so there is no Agent pid to measure and both columns were always 0. Also resolve the Agent port once, share the CPU-seconds parsing, and drop dead fallbacks in start_server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54bc17ada5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Allocation samples are throttled and each stands for its weight in bytes, so counting them ranked the allocation buckets by sample frequency, not allocation. Also reset the parser at every event, so a sample without a stack can't lend its thread to the next one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Wait for the first configured endpoint, not /, which the Jetty and Play apps don't serve. - Only pass -Xlog:gc on JDK 9+, leaving the young-GC column empty on JDK 8. - Read GNU time's max RSS format on Linux. - Give each agent variant its own JFR and GC-log names, even if two builds share a version. - Resolve agent jar paths to absolute ones, and rebuild PetClinic unless the cached jar was built from the pinned commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nstrumentation claim run-petclinic.sh now falls back to JAVA_HOME and then the JDK of the java on PATH, and checks it's 17+ with jfr. analyze-jfr.sh attributes by leaf frame, which counts advice woven into app methods as app, so its instrumentation bucket is now described as helpers only, a lower bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, not just the leaf The tracer allocates and computes mostly through JDK code (HashMap.resize, Arrays.copyOf), which leaf-frame attribution counted as app. On a PetClinic recording the tracer's allocation share goes from 0.8% to 2.1%, and instrumentation's share becomes visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each GC's heap before, minus the heap after the previous GC, summed over the measured window and divided by its requests. It counts all allocation on every thread without sampling, so the tracer's allocation cost is a variant's KB/req minus NoAgent's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t order PETCLINIC_RUNS=N repeats the variant sweep N times per heap, rotating the order (NoAgent included) every pass so drift doesn't always land on the variant that runs first. Each pass keeps its own artifacts, the combined grid gains a Run column, and a median-per-variant grid of throughput and KB/req is printed at the end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Abort when test_endpoint fails (e.g. wrk socket errors): its exit only left the command substitution, so the run went on with an empty row. - On a readiness timeout, kill the launched JVM and its time wrapper, which otherwise outlived the script and held port 8080. - Quote the server package path, so a checkout path with spaces works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-jfr
- Thread names were cut at the first space ("Reference Handler" became
"Reference"), so the role patterns written for names with spaces never
matched. Take the whole quoted name.
- The Jetty and Play perf-test apps live in datadog.perftest, so their
workload matched the datadog.* tracer prefix. Count it as app.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d0f89f629
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The runner built the JVM options and the agent-jar list as strings, so a jar under a path with spaces (e.g. `current` from such a checkout) was split into several arguments and the JVM failed to start. Build both as arrays. Play still gets one JAVA_OPTS string, which its launcher splits itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sweep runs run-perf-test.sh from the script directory, so a PERF_SETTINGS path relative to the caller's directory didn't load. Make it absolute up front, and fail early if the file doesn't exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Events were only emitted when their stack closed, so allocation samples without one dropped out of the totals and shrank the denominator of the tracer share. Emit every event when its block closes, owned by "(no stack)" if it has none. The analyzer's sample count now matches jfr summary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-bound As a fat jar, PetClinic serializes requests: Thymeleaf links go through Spring's resource chain, which looks each one up on the class path on every request, and the lookup doesn't seem to be cached when it finds nothing. Request threads queue on Spring Boot's nested-jar cache lock (UrlJarFiles$Cache); extracted, they queue on the JDK's URLClassPath lock instead. Throughput stays flat as connections rise and the queueing hides tracer overhead. fetch-petclinic.sh now extracts the fat jar (-Djarmode=tools) and prints the extracted jar; run-petclinic.sh sets SPRING_WEB_RESOURCES_CHAIN_ENABLED=false. NoAgent on / at 64 connections (M1 Max): ~1.3k req/s as a fat jar, ~4.2k extracted, ~17.5k extracted with the chain off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
The self-serve PetClinic benchmark adds heap sweeps, rotated runs, JFR analysis, and allocation reporting; Play startup, stale-build fallback, endpoint failure propagation, stub rediscovery, and Jetty attribution are fixed. Median summaries still merge distinct builds sharing a version, concealing their performance differences.
🤖 Bits Code Review · Commit 78d1efa
/oups answers 500 with "Connection: close", so wrk opens a new connection for every request and the endpoint mostly measures TCP setup. At a few thousand req/s that also exhausts local ports on macOS (16K ephemeral ports, 30s TIME_WAIT; a 5s run left ~23K sockets in TIME_WAIT), and wrk's connect errors then abort the sweep. The endpoint stays defined; add 'error' to test_order to run it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@bric3 friendly nudge — could you take a look when you have a chance? Two recent changes since the original description, both about what the harness measures:
Follow-up work (OTel comparison, fixed-rate latency) will come as a separate stacked PR, so this one won't grow. |
Sorry I started reviewing Tuesday, and some comments are still pending. I'll finish this one shortly. |
bric3
left a comment
There was a problem hiding this comment.
OK to proceed, I left a few things. I'm wondering if using wrk2 is the tool used and if it is that it should be enforced.
- cpu_seconds read ps -o time= as hh:mm:ss, but macOS prints minutes:seconds.hundredths, so one second of CPU could add 60 to Server CPU Burn. Read the colon fields as base 60, with Linux's optional day prefix. - The Agent stub's Javadoc now leads with what it's for, and keeps feature discovery, the state header and the knobs as a shorter contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With PETCLINIC_RUNS > 1, two builds reporting the same version (a saved jar against current) were merged into one median row: 100 and 200 req/s became one 150 req/s row. Give each variant an ID before the order rotates (its position plus the token it was given as), carry it into the combined grid as a Variant column, and take medians per heap and variant, keeping the reported version for display. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/merge |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
devflow unqueued this merge request: It did not become mergeable within the expected time |
There was a problem hiding this comment.
The self-serve PetClinic benchmark supports heap sweeps, rotated runs, JFR analysis, and allocation reporting; earlier startup, failure handling, stub discovery, attribution, and same-version grouping issues are fixed. One edge case remains: jar filenames containing commas corrupt the combined CSV and shift median metrics into the wrong columns.
🤖 Bits Code Review · Commit 50abb1a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/merge |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
The expected merge time in
|
There was a problem hiding this comment.
More details
The self-serve PetClinic harness provides heap sweeps, rotated runs, JFR analysis, and allocation reporting. All reported startup, failure handling, stub discovery, attribution, median grouping, and CSV filename defects are resolved; sanitized filenames retain distinct variant identities and correct metric columns.
🤖 Bits Code Review · Commit 64543dd
What Does This Do
Adds a self-serve, one-command PetClinic macro benchmark under
dd-java-agent/benchmark-integration/.run-petclinic.shchains it end to end: fetch + build PetClinic (pinned commit) → resolve the agentvariant(s) → run under
wrkload with JFR → analyze.run-petclinic.shPETCLINIC_HEAPS,PETCLINIC_REPEATS), per-heap result dirs plus a combinedthroughput-grid.csv. Each variant is a jar path,current(builds this checkout's shadow jar), or a release version (GitHub releases, falling back to Maven Central)fetch-petclinic.shagent-stub/AgentStub.java/info, discards payloads immediately, and reports what it received at/_stats. Used by default;PETCLINIC_AGENT=realuses the local Agent insteadwrk-upstream-headers.luatraceparent/tracestate, Datadog headers and propagation tags,baggage). On by default;PETCLINIC_UPSTREAM_HEADERS=falseturns it offanalyze-jfr.shperf-test-petclinic-settings.rcChanges to the shared
run-perf-test.sh(also used by the Jetty and Play apps):wrk --latency; per endpoint, p99 latency and young GCs per 1,000requests inside the measured window (JDK 9+).
PERF_WRK_SCRIPTpasses a Lua script to wrk;PERF_SINK_STATS_URLaborts the sweep if an agentvariant delivered no traces to the stub.
errors abort the run.
Agent CPU Burn/Agent RSS Deltacolumns, which were never measured (always 0).Motivation
Tracer overhead should be reproducible by any developer, not hand-run on one machine: this is the
local, dev-iteration counterpart to the org benchmarking platform (complements, not replaces), and
the macro check that keeps micro benchmarks honest.
expired API key) makes the tracer's writer hold traces in the heap. That changes the GC behavior
being measured, and nothing in the results shows it; it looks like a noisy, unrepeatable
benchmark. The stub accepts everything immediately, and the harness checks every agent variant
actually delivered traces.
should run on every request, not be skipped.
links trigger a class path lookup that serializes requests on a class loader lock (Spring Boot's
UrlJarFiles$Cache, orURLClassPathonce extracted). Throughput stays flat as connections rise, andthe queueing hides tracer overhead. NoAgent on
/at 64 connections: ~1.3k req/s as a fat jar vs ~17.5kfixed. See the README's "Running PetClinic without a class loader lock".
the sweep runs the same variants across heap sizes.
Additional Notes
analyze-jfr.shattributes by leaf frame, so advice woven into app methodscounts as app; the instrumentation bucket is a lower bound.
upstream headers: every agent variant delivered traces, and the new columns are filled. Pointing
the tracer at a different stub than the one checked aborts the run. The Jetty app was run on JDK 8
and 17 with the shared-runner changes. The JDK is
BENCH_JAVA_HOME,JAVA_17_HOME,JAVA_HOME,or the
javaon PATH, checked to be 17+ withjfr.containerization, and integration with the org benchmarking platform.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue🤖 Generated with Claude Code