Repository navigation
feat: add app-level indy A/B benches to the performance workflow - #16169
Conversation
Land the gated HTTP harness (latency, app1, gsp-layout) and run it from benchmark.yml when a PR has the performance label. Compare -PgrailsIndy=false vs true on HEAD. Does not change the plugin default. Assisted-by: claude-code:claude-opus-5
There was a problem hiding this comment.
Pull request overview
This PR extends the performance-labeled CI workflow to run app-level HTTP benchmarks comparing Groovy indy vs classic callsite dispatch, emitting JMH-compatible JSON so results can be compared with the existing :grails-benchmarks:jmhCompare tooling.
Changes:
- Add
AppHttpBenchhelper (and unit tests) to measure HTTP request latency and write JMH-shaped JSON output. - Add gated
AppBench*integration specs ingrails-test-examples(latency, app1, gsp-layout) and wire a shared Gradle test configuration to pass bench properties. - Add a new
app-benchGitHub Actions job (runs noindy then indy, then publishes a comparison report and artifacts) and a local PowerShell runner.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| grails-testing-support-http-client/src/main/groovy/org/apache/grails/testing/http/client/bench/AppHttpBench.groovy | New helper to measure request timings and emit JMH-compatible JSON entries. |
| grails-testing-support-http-client/src/test/groovy/org/apache/grails/testing/http/client/bench/AppHttpBenchSpec.groovy | Unit tests for the new bench helper behavior. |
| grails-test-examples/latency/src/integration-test/groovy/latencyapp/AppBenchFastPingSpec.groovy | New gated integration bench for a simple controller render path. |
| grails-test-examples/latency/build.gradle | Applies shared app-bench Gradle wiring to pass bench properties to tests. |
| grails-test-examples/app1/src/integration-test/groovy/functionaltests/AppBenchInterceptorDemoSpec.groovy | New gated integration bench for interceptor + controller path. |
| grails-test-examples/app1/build.gradle | Applies shared app-bench Gradle wiring to pass bench properties to tests. |
| grails-test-examples/gsp-layout/src/integration-test/groovy/org/example/grails/layout/AppBenchDemoRenderTextSpec.groovy | New gated integration bench for GSP layout app request path. |
| grails-test-examples/gsp-layout/build.gradle | Adds HTTP client support dependency for integration tests + applies app-bench wiring. |
| gradle/app-bench-config.gradle | New shared Gradle config to set system properties and disable caching when benches are enabled. |
| grails-benchmarks/scripts/run-app-indy-bench.ps1 | Local runner to execute noindy/indy benches and compare results. |
| .github/workflows/benchmark.yml | Adds app-bench job gated by the performance label and publishes comparison artifacts/summary. |
Suppressed comments (2)
grails-benchmarks/scripts/run-app-indy-bench.ps1:96
- This script is invoked via
pwsh(cross-platform), but it callsgradlew.bat, which will fail on non-Windows systems. Usegradlewon Unix-like systems.
& "$root\gradlew.bat" '-q' ':grails-benchmarks:jmhCompare' `
grails-benchmarks/scripts/run-app-indy-bench.ps1:115
- This script is invoked via
pwsh(cross-platform), but it callsgradlew.bat, which will fail on non-Windows systems. Usegradlewon Unix-like systems.
& "$root\gradlew.bat" '-q' ':grails-benchmarks:jmhCompare' `
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 9.0.x #16169 +/- ##
==================================================
- Coverage 60.9989% 60.9873% -0.0117%
+ Complexity 26648 26640 -8
==================================================
Files 2249 2249
Lines 111561 111561
Branches 20207 20207
==================================================
- Hits 68051 68038 -13
- Misses 34526 34536 +10
- Partials 8984 8987 +3 🚀 New features to boost your workflow:
|
Run app-level indy A/B benches through :grails-benchmarks:appIndyBench. Nested Gradle is launched via the wrapper JAR, not gradlew or a shell script. CI now calls that single task. AppHttpBench rejects empty sample sets and clamps fork count. Assisted-by: Sisyphus:grok-4.6
|
I asked Scott to fix this in his other PR, but 'grails-benchmarks' should either be under grails-test-examples or it should be considered a test project in the root build.gradle where we set testProjectsStartWith variable. I think Scott just moved it in his PR. FYI: his PR expands on this significantly. |
jdaugherty
left a comment
There was a problem hiding this comment.
The following review was AI generated for more feedback:
Move AppHttpBench into http-client test fixtures, report a t-interval over fork means, emit a ruler-equivalent, and replace JSON output. Treat grails-benchmarks as a test project. Interleave indy/noindy per app, continue after nested failures with a fallback summary, forward GRADLE_OPTS, and stop daemons before measurement. Assisted-by: Sisyphus:grok-4.6 Made-with: Cursor
|
@jdaugherty Implemented in c17dc64. grails-benchmarks is now in root testProjectsStartWith next to grails-test-suite and grails-test-examples, so it is classified as a test project rather than a published module. |
|
FYI: Scott's PR was merged prior to this, so we'll want to move this to grails-test-examples/benchmarks too |
jdaugherty
left a comment
There was a problem hiding this comment.
Re-reviewed after bringing the branch up to date with 9.0.x (the benchmarks module now lives under grails-test-examples/benchmarks, so the new sources moved there and the task is :grails-test-examples-benchmarks:appIndyBench). The earlier round of feedback is addressed. Two things still undercut what the harness reports, plus a test that does not check what it appears to, and two small nits.
|
@jamesfredley this is ready for your review again |
- Split each timed series into 10 chunks by default (appBenchChunks, formerly appBenchForks) so the scoreError t-interval has the same degrees of freedom as JMH's 10 iteration means. With 2 chunks the 12.706 critical value kept the comparator's disjointness test from ever firing on the 1-2% indy deltas the benches are meant to resolve. - Run the CpuRulerBenchmark recurrence (1,024 LCG rounds with carried state) in the app CPU ruler instead of 64 foldable adds, so the ruler measures CPU throughput rather than System.nanoTime() granularity. - Assert the per-invocation mode/directory routing in AppIndyBenchSpec; comparisons inside the each closure were not Spock conditions. - Resolve a relative -PappBenchOutDir against the repository root and document that results are written under its run/ subdirectory. - Head the success-path step summary like the failure path so it reads apart from the JMH report in the same job.
Every example app applies gradle/functional-test-config.gradle, so the -PappBench=true integrationTest wiring now lives there, guarded on the plugin that registers integrationTest, instead of in a separate script each benched app had to remember to apply. The orchestrator's roster stays explicit so a missing named spec still fails fast.
jdaugherty
left a comment
There was a problem hiding this comment.
Folded the app bench wiring into functional-test-config.gradle in 59ec5e6 (roster thread), and replied on the six-build thread with why that one stays as is.
|
Per discussion at CoC, I intend to merge this once tests pass now that feedback is implemented. |
The 9.0.x merge moved every other job in benchmark.yml to setup-gradle v6.4.0 with the shared Develocity key and read-only PR caching, and validateRepositoryConventions rejects a file that pins one action at two SHAs.
JMH Shard PairingComplete shard pairs used: 2 JMH Benchmark ReportRegressions: 0 Group geometric means are descriptive only, not verdicts.
Per-benchmark results
|
The first CI run of the app-bench job reported a 65% ruler deviation between the two gsp-layout JVMs with every HTTP verdict unchanged. The ruler was warmed with the HTTP warm-up count (80 calls), which leaves a microsecond loop mid-JIT: fresh JVMs sampled after 80 calls settle at two different levels, while 20,000 or more calls give a flat series with equal half means. The ruler now discards at least 50,000 calls before sampling, and its entry records that in warmupTime so the JSON says what was done. Also exclude the nested builds' project caches from the uploaded artifact; they were 22 MB of the 22 MB result bundle.
The two label runs of the app-bench job disagreed on every app (latency 0.97x then 1.25x, app1 1.18x then 1.04x) with ±4-14% intervals at the 80 / 300 profile, so a single run's verdict was noise. Sampling is a negligible share of the job next to the six nested Gradle builds: 2,000 requests of a millisecond or two add a few seconds per build while giving the JIT a real warm-up and the chunk means a far tighter interval.
The 2,000 / 2,000 profile still sampled apps that were warming up: the gsp-layout chunk medians fell from 690 to 490 us across the series and the interval did not narrow. Measured from a cold start, every example app keeps getting faster for tens of thousands of requests, and app1 only settles within 5% of its steady latency after about 28,000. Warm up 30,000 requests and sample 10,000, which leaves roughly ±3-7% intervals and costs about 20 seconds of requests per nested build on a runner.
✅ All tests passed ✅🏷️ Commit: 27581b3 Learn more about TestLens at testlens.app/docs. |
Purpose
Teach CI to measure app-level indy vs classic callsite, not just JMH micros.
This does not change the Grails plugin indy default. That remains #16165.
What landed
AppHttpBenchhelper + unit tests (rejects empty sample sets, clamps the chunk count, CPU ruler sharesCpuRulerBenchmark's work)AppBench*specs for latency, app1, and gsp-layoutgsp-layoutnow depends ongrails-testing-support-http-client./gradlew :grails-test-examples-benchmarks:appIndyBenchbenchmark.ymlapp-benchjob on theperformancelabel calls that single task (warmup 30000 / samples 10000 / chunks 10)Local usage
Optional:
-PappBenchWarmup,-PappBenchSamples,-PappBenchChunks,-PappBenchOutDir. The-PappBench=truewiring lives ingradle/functional-test-config.gradle, so any example app can host anAppBench*spec.Local numbers already posted on #16165
Same harness, same settings: latency 0.98x, app1 0.99x, no clear change. gsp-layout was skipped there because that module lacked the HTTP client dep; this PR adds it.
Test plan
AppHttpBenchSpecAppIndyBenchSpecperformancelabel runs the new job (four label runs on this PR; the last two measured all three apps)