Cache handler span keys in spring-webmvc to avoid per-request string concatenation#11141
Draft
Cache handler span keys in spring-webmvc to avoid per-request string concatenation#11141
Conversation
…concatenation The handler span key (used as a request attribute name) was computed via string concatenation on every request entry and exit. Replace with a ClassValue-based cache in SpringWebHttpServerDecorator so each handler class computes its key only once. Uses GenericClassValue.of() following the established codebase pattern to avoid anonymous inner class issues with ByteBuddy helper class injection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 65 metrics, 6 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.057 s) : 0, 1056728
Total [baseline] (8.841 s) : 0, 8841342
Agent [candidate] (1.058 s) : 0, 1058491
Total [candidate] (8.835 s) : 0, 8835154
section iast
Agent [baseline] (1.23 s) : 0, 1230464
Total [baseline] (9.554 s) : 0, 9553761
Agent [candidate] (1.227 s) : 0, 1226989
Total [candidate] (9.592 s) : 0, 9591616
gantt
title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.227 ms) : 0, 1227
crashtracking [candidate] (1.225 ms) : 0, 1225
BytebuddyAgent [baseline] (634.103 ms) : 0, 634103
BytebuddyAgent [candidate] (636.451 ms) : 0, 636451
AgentMeter [baseline] (29.324 ms) : 0, 29324
AgentMeter [candidate] (29.268 ms) : 0, 29268
GlobalTracer [baseline] (248.844 ms) : 0, 248844
GlobalTracer [candidate] (248.213 ms) : 0, 248213
AppSec [baseline] (32.494 ms) : 0, 32494
AppSec [candidate] (32.343 ms) : 0, 32343
Debugger [baseline] (59.235 ms) : 0, 59235
Debugger [candidate] (58.837 ms) : 0, 58837
Remote Config [baseline] (603.98 µs) : 0, 604
Remote Config [candidate] (582.933 µs) : 0, 583
Telemetry [baseline] (8.078 ms) : 0, 8078
Telemetry [candidate] (8.002 ms) : 0, 8002
Flare Poller [baseline] (6.701 ms) : 0, 6701
Flare Poller [candidate] (7.345 ms) : 0, 7345
section iast
crashtracking [baseline] (1.231 ms) : 0, 1231
crashtracking [candidate] (1.265 ms) : 0, 1265
BytebuddyAgent [baseline] (806.021 ms) : 0, 806021
BytebuddyAgent [candidate] (804.116 ms) : 0, 804116
AgentMeter [baseline] (11.64 ms) : 0, 11640
AgentMeter [candidate] (11.374 ms) : 0, 11374
GlobalTracer [baseline] (239.9 ms) : 0, 239900
GlobalTracer [candidate] (239.252 ms) : 0, 239252
IAST [baseline] (26.019 ms) : 0, 26019
IAST [candidate] (25.946 ms) : 0, 25946
AppSec [baseline] (32.338 ms) : 0, 32338
AppSec [candidate] (33.593 ms) : 0, 33593
Debugger [baseline] (63.589 ms) : 0, 63589
Debugger [candidate] (61.695 ms) : 0, 61695
Remote Config [baseline] (543.502 µs) : 0, 544
Remote Config [candidate] (546.512 µs) : 0, 547
Telemetry [baseline] (9.343 ms) : 0, 9343
Telemetry [candidate] (9.338 ms) : 0, 9338
Flare Poller [baseline] (3.491 ms) : 0, 3491
Flare Poller [candidate] (3.554 ms) : 0, 3554
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.065 s) : 0, 1064936
Total [baseline] (11.022 s) : 0, 11021531
Agent [candidate] (1.062 s) : 0, 1062444
Total [candidate] (11.115 s) : 0, 11115432
section appsec
Agent [baseline] (1.265 s) : 0, 1264553
Total [baseline] (11.209 s) : 0, 11209493
Agent [candidate] (1.244 s) : 0, 1244437
Total [candidate] (11.069 s) : 0, 11068855
section iast
Agent [baseline] (1.223 s) : 0, 1223435
Total [baseline] (11.386 s) : 0, 11386421
Agent [candidate] (1.226 s) : 0, 1226490
Total [candidate] (11.335 s) : 0, 11335382
section profiling
Agent [baseline] (1.188 s) : 0, 1188306
Total [baseline] (11.162 s) : 0, 11161754
Agent [candidate] (1.186 s) : 0, 1186119
Total [candidate] (11.097 s) : 0, 11096700
gantt
title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.228 ms) : 0, 1228
crashtracking [candidate] (1.226 ms) : 0, 1226
BytebuddyAgent [baseline] (636.868 ms) : 0, 636868
BytebuddyAgent [candidate] (638.002 ms) : 0, 638002
AgentMeter [baseline] (29.605 ms) : 0, 29605
AgentMeter [candidate] (29.61 ms) : 0, 29610
GlobalTracer [baseline] (250.127 ms) : 0, 250127
GlobalTracer [candidate] (249.842 ms) : 0, 249842
AppSec [baseline] (32.702 ms) : 0, 32702
AppSec [candidate] (32.477 ms) : 0, 32477
Debugger [baseline] (60.309 ms) : 0, 60309
Debugger [candidate] (60.332 ms) : 0, 60332
Remote Config [baseline] (600.374 µs) : 0, 600
Remote Config [candidate] (590.514 µs) : 0, 591
Telemetry [baseline] (8.171 ms) : 0, 8171
Telemetry [candidate] (8.157 ms) : 0, 8157
Flare Poller [baseline] (9.1 ms) : 0, 9100
Flare Poller [candidate] (5.974 ms) : 0, 5974
section appsec
crashtracking [baseline] (1.244 ms) : 0, 1244
crashtracking [candidate] (1.208 ms) : 0, 1208
BytebuddyAgent [baseline] (671.532 ms) : 0, 671532
BytebuddyAgent [candidate] (659.378 ms) : 0, 659378
AgentMeter [baseline] (12.302 ms) : 0, 12302
AgentMeter [candidate] (11.982 ms) : 0, 11982
GlobalTracer [baseline] (252.023 ms) : 0, 252023
GlobalTracer [candidate] (247.804 ms) : 0, 247804
IAST [baseline] (24.865 ms) : 0, 24865
IAST [candidate] (24.422 ms) : 0, 24422
AppSec [baseline] (186.693 ms) : 0, 186693
AppSec [candidate] (185.127 ms) : 0, 185127
Debugger [baseline] (66.498 ms) : 0, 66498
Debugger [candidate] (65.781 ms) : 0, 65781
Remote Config [baseline] (613.785 µs) : 0, 614
Remote Config [candidate] (621.151 µs) : 0, 621
Telemetry [baseline] (8.503 ms) : 0, 8503
Telemetry [candidate] (8.412 ms) : 0, 8412
Flare Poller [baseline] (3.623 ms) : 0, 3623
Flare Poller [candidate] (3.491 ms) : 0, 3491
section iast
crashtracking [baseline] (1.225 ms) : 0, 1225
crashtracking [candidate] (1.221 ms) : 0, 1221
BytebuddyAgent [baseline] (800.478 ms) : 0, 800478
BytebuddyAgent [candidate] (802.313 ms) : 0, 802313
AgentMeter [baseline] (11.428 ms) : 0, 11428
AgentMeter [candidate] (11.466 ms) : 0, 11466
GlobalTracer [baseline] (239.013 ms) : 0, 239013
GlobalTracer [candidate] (239.581 ms) : 0, 239581
IAST [baseline] (25.751 ms) : 0, 25751
IAST [candidate] (25.895 ms) : 0, 25895
AppSec [baseline] (32.878 ms) : 0, 32878
AppSec [candidate] (31.413 ms) : 0, 31413
Debugger [baseline] (63.247 ms) : 0, 63247
Debugger [candidate] (65.083 ms) : 0, 65083
Remote Config [baseline] (544.263 µs) : 0, 544
Remote Config [candidate] (547.821 µs) : 0, 548
Telemetry [baseline] (9.289 ms) : 0, 9289
Telemetry [candidate] (9.377 ms) : 0, 9377
Flare Poller [baseline] (3.48 ms) : 0, 3480
Flare Poller [candidate] (3.562 ms) : 0, 3562
section profiling
crashtracking [baseline] (1.2 ms) : 0, 1200
crashtracking [candidate] (1.184 ms) : 0, 1184
BytebuddyAgent [baseline] (692.5 ms) : 0, 692500
BytebuddyAgent [candidate] (693.879 ms) : 0, 693879
AgentMeter [baseline] (9.169 ms) : 0, 9169
AgentMeter [candidate] (9.044 ms) : 0, 9044
GlobalTracer [baseline] (208.218 ms) : 0, 208218
GlobalTracer [candidate] (206.761 ms) : 0, 206761
AppSec [baseline] (33.087 ms) : 0, 33087
AppSec [candidate] (32.693 ms) : 0, 32693
Debugger [baseline] (66.013 ms) : 0, 66013
Debugger [candidate] (65.488 ms) : 0, 65488
Remote Config [baseline] (591.11 µs) : 0, 591
Remote Config [candidate] (573.226 µs) : 0, 573
Telemetry [baseline] (7.856 ms) : 0, 7856
Telemetry [candidate] (7.813 ms) : 0, 7813
Flare Poller [baseline] (3.568 ms) : 0, 3568
Flare Poller [candidate] (3.542 ms) : 0, 3542
ProfilingAgent [baseline] (94.701 ms) : 0, 94701
ProfilingAgent [candidate] (93.664 ms) : 0, 93664
Profiling [baseline] (95.279 ms) : 0, 95279
Profiling [candidate] (94.221 ms) : 0, 94221
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 3 performance regressions! Performance is the same for 18 metrics, 15 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section baseline
no_agent (18.329 ms) : 18146, 18512
. : milestone, 18329,
appsec (18.65 ms) : 18464, 18836
. : milestone, 18650,
code_origins (17.871 ms) : 17693, 18049
. : milestone, 17871,
iast (17.963 ms) : 17784, 18141
. : milestone, 17963,
profiling (18.253 ms) : 18071, 18434
. : milestone, 18253,
tracing (18.028 ms) : 17847, 18209
. : milestone, 18028,
section candidate
no_agent (19.293 ms) : 19097, 19489
. : milestone, 19293,
appsec (18.582 ms) : 18395, 18768
. : milestone, 18582,
code_origins (17.89 ms) : 17714, 18066
. : milestone, 17890,
iast (18.279 ms) : 18099, 18459
. : milestone, 18279,
profiling (18.451 ms) : 18271, 18632
. : milestone, 18451,
tracing (17.61 ms) : 17439, 17782
. : milestone, 17610,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section baseline
no_agent (1.241 ms) : 1229, 1253
. : milestone, 1241,
iast (3.221 ms) : 3178, 3265
. : milestone, 3221,
iast_FULL (6.199 ms) : 6135, 6264
. : milestone, 6199,
iast_GLOBAL (3.595 ms) : 3535, 3656
. : milestone, 3595,
profiling (2.104 ms) : 2085, 2124
. : milestone, 2104,
tracing (1.859 ms) : 1844, 1874
. : milestone, 1859,
section candidate
no_agent (1.217 ms) : 1205, 1228
. : milestone, 1217,
iast (3.436 ms) : 3387, 3484
. : milestone, 3436,
iast_FULL (5.994 ms) : 5932, 6055
. : milestone, 5994,
iast_GLOBAL (3.696 ms) : 3634, 3758
. : milestone, 3696,
profiling (2.18 ms) : 2160, 2200
. : milestone, 2180,
tracing (1.891 ms) : 1874, 1909
. : milestone, 1891,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section baseline
no_agent (14.901 s) : 14901000, 14901000
. : milestone, 14901000,
appsec (14.438 s) : 14438000, 14438000
. : milestone, 14438000,
iast (18.45 s) : 18450000, 18450000
. : milestone, 18450000,
iast_GLOBAL (17.77 s) : 17770000, 17770000
. : milestone, 17770000,
profiling (15.009 s) : 15009000, 15009000
. : milestone, 15009000,
tracing (14.941 s) : 14941000, 14941000
. : milestone, 14941000,
section candidate
no_agent (14.899 s) : 14899000, 14899000
. : milestone, 14899000,
appsec (14.575 s) : 14575000, 14575000
. : milestone, 14575000,
iast (18.309 s) : 18309000, 18309000
. : milestone, 18309000,
iast_GLOBAL (17.925 s) : 17925000, 17925000
. : milestone, 17925000,
profiling (14.873 s) : 14873000, 14873000
. : milestone, 14873000,
tracing (15.137 s) : 15137000, 15137000
. : milestone, 15137000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~72064d6849, baseline=1.62.0-SNAPSHOT~3fb37337ab
dateFormat X
axisFormat %s
section baseline
no_agent (1.49 ms) : 1479, 1502
. : milestone, 1490,
appsec (2.538 ms) : 2483, 2593
. : milestone, 2538,
iast (2.282 ms) : 2212, 2351
. : milestone, 2282,
iast_GLOBAL (2.335 ms) : 2264, 2405
. : milestone, 2335,
profiling (2.149 ms) : 2090, 2207
. : milestone, 2149,
tracing (2.093 ms) : 2039, 2147
. : milestone, 2093,
section candidate
no_agent (1.489 ms) : 1477, 1500
. : milestone, 1489,
appsec (3.845 ms) : 3622, 4068
. : milestone, 3845,
iast (2.277 ms) : 2207, 2346
. : milestone, 2277,
iast_GLOBAL (2.311 ms) : 2242, 2380
. : milestone, 2311,
profiling (2.107 ms) : 2052, 2162
. : milestone, 2107,
tracing (2.092 ms) : 2038, 2145
. : milestone, 2092,
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClassValue<String>-based caches inSpringWebHttpServerDecorator(3.1 and 6.0) to map handlerClass<?>to precomputed span key stringsDD_HANDLER_SPAN_PREFIX_KEY + handler.getClass().getName()string concatenation with cache lookupsGenericClassValue.of()(established codebase pattern) to avoid class loading issues with ByteBuddy helper injectionMotivation: Handler span keys were computed via string concatenation on every HTTP request entry AND exit across 4 advice classes. The keys are deterministic per handler class and never change.
Files changed
SpringWebHttpServerDecorator.java(3.1 and 6.0) — added caches and accessor methodsHandlerAdapterInstrumentation.java/ControllerAdvice.java— replaced concatenation with cache lookupsInvocableHandlerMethodInstrumentation.java/WrapContinuableResultAdvice.java— sameTest plan
tag: no release note
tag: ai generated
🤖 Generated with Claude Code