Skip to content

feat: add app-level indy A/B benches to the performance workflow - #16169

Merged
jdaugherty merged 14 commits into
9.0.xfrom
feat/app-bench-ci
Oct 14, 2026
Merged

jdaugherty merged 14 commits into
9.0.xfrom
feat/app-bench-ci

Conversation

@jamesfredley

@jamesfredley jamesfredley commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

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

  • AppHttpBench helper + unit tests (rejects empty sample sets, clamps the chunk count, CPU ruler shares CpuRulerBenchmark's work)
  • Gated AppBench* specs for latency, app1, and gsp-layout
  • gsp-layout now depends on grails-testing-support-http-client
  • Native Gradle orchestrator: ./gradlew :grails-test-examples-benchmarks:appIndyBench
  • benchmark.yml app-bench job on the performance label calls that single task (warmup 30000 / samples 10000 / chunks 10)
  • No PowerShell, shell, or Python runner

Local usage

./gradlew :grails-test-examples-benchmarks:appIndyBench

Optional: -PappBenchWarmup, -PappBenchSamples, -PappBenchChunks, -PappBenchOutDir. The -PappBench=true wiring lives in gradle/functional-test-config.gradle, so any example app can host an AppBench* 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

  • AppHttpBenchSpec
  • AppIndyBenchSpec
  • CI performance label runs the new job (four label runs on this PR; the last two measured all three apps)

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
Copilot AI lite review requested due to automatic review settings August 18, 2026 21:40

Copilot AI left a comment

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.

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 AppHttpBench helper (and unit tests) to measure HTTP request latency and write JMH-shaped JSON output.
  • Add gated AppBench* integration specs in grails-test-examples (latency, app1, gsp-layout) and wire a shared Gradle test configuration to pass bench properties.
  • Add a new app-bench GitHub 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 calls gradlew.bat, which will fail on non-Windows systems. Use gradlew on 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 calls gradlew.bat, which will fail on non-Windows systems. Use gradlew on 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.

Comment thread gradle/app-bench-config.gradle Resolved
@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.9873%. Comparing base (386e881) to head (27581b3).

Additional details and impacted files

Impacted file tree graph

@@                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     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
@jdaugherty

Copy link
Copy Markdown
Contributor

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 jdaugherty left a comment

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.

The following review was AI generated for more feedback:

Comment thread gradle/app-bench-config.gradle Resolved
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
@jamesfredley

Copy link
Copy Markdown
Contributor Author

@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.

@jdaugherty

Copy link
Copy Markdown
Contributor

FYI: Scott's PR was merged prior to this, so we'll want to move this to grails-test-examples/benchmarks too

@jdaugherty jdaugherty left a comment

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.

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.

@jdaugherty

Copy link
Copy Markdown
Contributor

@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.

@jdaugherty jdaugherty left a comment

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.

Brought the branch up to date with 9.0.x (5822aa7) and addressed the five remaining items in 37d722d; details on each thread.

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 jdaugherty left a comment

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.

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.

@jdaugherty

Copy link
Copy Markdown
Contributor

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.
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

JMH Shard Pairing

Complete shard pairs used: 2

JMH Benchmark Report

Regressions: 0
Improvements: 0
Runner health: worst ruler deviation: 2.3% in shard-a.json (MemoryRulerBenchmark.allocateAndCopyArray (mode=avgt))
Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
Ruler movements: shard-a.json: CpuRulerBenchmark.integerArithmetic (mode=avgt): 1.00x, shard-a.json: MemoryRulerBenchmark.allocateAndCopyArray (mode=avgt): 1.02x, shard-b.json: CpuRulerBenchmark.integerArithmetic (mode=avgt): 1.00x, shard-b.json: MemoryRulerBenchmark.allocateAndCopyArray (mode=avgt): 1.01x

Group geometric means are descriptive only, not verdicts.

Group Descriptive geomean speedup n
controllers 1.00x 6
databinding 1.00x 2
gsp 1.00x 2
interceptors 1.00x 6
urlmappings 0.98x 4
views 1.01x 2
web 0.99x 12
Per-benchmark results
Benchmark Base score Head score Speedup Verdict Allocation delta (ADVISORY)
controllers.ControllerActionBenchmark.commandObjectAction (mode=avgt) 4.45e+04 ns/op 4.48e+04 ns/op 0.99x no clear change +582 B/op (+0.7%)
controllers.ControllerActionBenchmark.plainAction (mode=avgt) 47.8 ns/op 44.7 ns/op 1.07x no clear change ~0 B/op
controllers.ControllerActionBenchmark.restrictedAction (mode=avgt) 56.7 ns/op 58.6 ns/op 0.97x no clear change ~0 B/op
controllers.ControllerMappingCollectionBenchmark.fourCandidates (mode=avgt) 876 ns/op 877 ns/op 1.00x no clear change +6 B/op (+0.4%)
controllers.ControllerMappingCollectionBenchmark.oneCandidate (mode=avgt) 302 ns/op 311 ns/op 0.97x no clear change ~0 B/op
controllers.ControllerMappingCollectionBenchmark.twoCandidates (mode=avgt) 448 ns/op 441 ns/op 1.02x no clear change ~0 B/op
databinding.SimpleDataBinderBenchmark.bindFlatMap (mode=avgt) 6.8e+03 ns/op 6.83e+03 ns/op 0.99x no clear change ~0 B/op
databinding.SimpleDataBinderBenchmark.bindMapWithTypeConversion (mode=avgt) 7.11e+03 ns/op 7.09e+03 ns/op 1.00x no clear change ~0 B/op
gsp.GroovyPageParserBenchmark.parseSmallTemplate (mode=avgt) 7.25e+03 ns/op 7.32e+03 ns/op 0.99x no clear change -14 B/op (-0.0%)
gsp.GroovyPageParserBenchmark.parseTemplateWithTagsAndExpressions (mode=avgt) 3.75e+04 ns/op 3.72e+04 ns/op 1.01x no clear change -44 B/op (-0.1%)
interceptors.InterceptorChainBenchmark.oneInterceptorNoOpRegistry (mode=avgt) 76.2 ns/op 73.2 ns/op 1.04x no clear change ~0 B/op
interceptors.InterceptorChainBenchmark.oneInterceptorObservingRegistry (mode=avgt) 368 ns/op 366 ns/op 1.01x no clear change ~0 B/op
interceptors.InterceptorChainBenchmark.threeInterceptorsNoOpRegistry (mode=avgt) 536 ns/op 531 ns/op 1.01x no clear change ~0 B/op
interceptors.InterceptorChainBenchmark.threeInterceptorsObservingRegistry (mode=avgt) 1.48e+03 ns/op 1.61e+03 ns/op 0.92x no clear change ~0 B/op
interceptors.UrlMappingMatcherBenchmark.matchUriPattern (mode=avgt) 133 ns/op 126 ns/op 1.05x no clear change ~0 B/op
interceptors.UrlMappingMatcherBenchmark.rejectNonMatchingUriPattern (mode=avgt) 37.3 ns/op 37.4 ns/op 1.00x no clear change ~0 B/op
ruler.CpuRulerBenchmark.integerArithmetic (mode=avgt) 1.73e+03 ns/op 1.72e+03 ns/op 1.00x ruler - excluded ~0 B/op
ruler.MemoryRulerBenchmark.allocateAndCopyArray (mode=avgt) 415 ns/op 408 ns/op 1.02x ruler - excluded ~0 B/op
urlmappings.UrlMappingsBenchmark.matchColdCatchAllFallThrough (mode=avgt) 1.38e+03 ns/op 1.36e+03 ns/op 1.02x no clear change -9 B/op (-0.5%)
urlmappings.UrlMappingsBenchmark.matchColdVariedKeys (mode=avgt) 1.21e+03 ns/op 1.24e+03 ns/op 0.98x no clear change +7 B/op (+0.4%)
urlmappings.UrlMappingsBenchmark.matchWarmCache (mode=avgt) 4.44 ns/op 4.68 ns/op 0.95x no clear change ~0 B/op
urlmappings.UrlMappingsBenchmark.reverseMappingAndCreateRelativeUrl (mode=avgt) 118 ns/op 119 ns/op 1.00x no clear change ~0 B/op
views.ViewTemplateRenderingBenchmark.renderJsonTemplate (mode=avgt) 6e+03 ns/op 6.02e+03 ns/op 1.00x no clear change -18 B/op (-0.1%)
views.ViewTemplateRenderingBenchmark.renderMarkupTemplate (mode=avgt) 598 ns/op 585 ns/op 1.02x no clear change -6 B/op (-0.6%)
web.GrailsWebRequestBenchmark.construct (mode=avgt) 24.5 ns/op 24.8 ns/op 0.99x no clear change ~0 B/op
web.GrailsWebRequestBenchmark.paramsCached (mode=avgt) 0.593 ns/op 0.592 ns/op 1.00x no clear change ~0 B/op
web.GrailsWebRequestBenchmark.paramsOnFreshRequest (mode=avgt) 904 ns/op 924 ns/op 0.98x no clear change +58 B/op (+1.9%)
web.GrailsWebRequestBenchmark.paramsRebuilt (mode=avgt) 438 ns/op 481 ns/op 0.91x no clear change ~0 B/op
web.MultipartResolutionBenchmark.resolveMultipartBehindTwoWrappers (mode=avgt) 4.59 ns/op 4.57 ns/op 1.00x no clear change ~0 B/op
web.MultipartResolutionBenchmark.resolveMultipartByAttribute (mode=avgt) 3.14 ns/op 3.21 ns/op 0.98x no clear change ~0 B/op
web.MultipartResolutionBenchmark.resolvePlainBehindTwoWrappers (mode=avgt) 23.4 ns/op 23.8 ns/op 0.98x no clear change ~0 B/op
web.MultipartResolutionBenchmark.resolvePlain (mode=avgt) 1.92 ns/op 1.93 ns/op 1.00x no clear change ~0 B/op
web.RequestPropertyAccessBenchmark.groovyAttributeCall (mode=avgt) 2.46 ns/op 2.57 ns/op 0.96x no clear change ~0 B/op
web.RequestPropertyAccessBenchmark.groovyGetterBackedProperty (mode=avgt) 0.779 ns/op 0.786 ns/op 0.99x no clear change ~0 B/op
web.RequestPropertyAccessBenchmark.groovyUnknownProperty (mode=avgt) 136 ns/op 131 ns/op 1.03x no clear change ~0 B/op
web.RequestPropertyAccessBenchmark.javaGetAttribute (mode=avgt) 2.42 ns/op 2.4 ns/op 1.01x no clear change ~0 B/op

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.
@testlens-app

testlens-app Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 27581b3
▶️ Tests: 77806 executed
🟡 Checks: 93/94 completed


Learn more about TestLens at testlens.app/docs.

@jdaugherty
jdaugherty merged commit e63c8a2 into 9.0.x Oct 14, 2026
162 of 168 checks passed
@jdaugherty
jdaugherty deleted the feat/app-bench-ci branch October 14, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants