-
Notifications
You must be signed in to change notification settings - Fork 320
Avoid expensive Class.getMethod call in code-origin advice
#10019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid expensive Class.getMethod call in code-origin advice
#10019
Conversation
e0ee350 to
e27ee58
Compare
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 unstable metrics. See unchanged results
Request duration reports for reportsgantt
title reports - request duration [CI 0.99] : candidate=None, baseline=None
dateFormat X
axisFormat %s
section baseline
noprobe (373.058 µs) : 231, 515
. : milestone, 373,
basic (300.345 µs) : 289, 312
. : milestone, 300,
loop (8.455 ms) : 8393, 8517
. : milestone, 8455,
section candidate
noprobe (325.568 µs) : 292, 359
. : milestone, 326,
basic (290.02 µs) : 282, 298
. : milestone, 290,
loop (8.439 ms) : 8377, 8501
. : milestone, 8439,
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 7 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.102 s) : 0, 1102466
Total [baseline] (10.836 s) : 0, 10836121
Agent [candidate] (1.112 s) : 0, 1111864
Total [candidate] (10.958 s) : 0, 10957634
section appsec
Agent [baseline] (1.287 s) : 0, 1286728
Total [baseline] (11.145 s) : 0, 11144551
Agent [candidate] (1.289 s) : 0, 1289237
Total [candidate] (11.241 s) : 0, 11241364
section iast
Agent [baseline] (1.244 s) : 0, 1243870
Total [baseline] (11.325 s) : 0, 11324922
Agent [candidate] (1.251 s) : 0, 1250876
Total [candidate] (11.343 s) : 0, 11342987
section profiling
Agent [baseline] (1.252 s) : 0, 1252445
Total [baseline] (11.205 s) : 0, 11205434
Agent [candidate] (1.236 s) : 0, 1236418
Total [candidate] (11.275 s) : 0, 11275467
gantt
title petclinic - break down per module: candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.496 ms) : 0, 1496
crashtracking [candidate] (1.508 ms) : 0, 1508
BytebuddyAgent [baseline] (708.494 ms) : 0, 708494
BytebuddyAgent [candidate] (714.273 ms) : 0, 714273
GlobalTracer [baseline] (249.215 ms) : 0, 249215
GlobalTracer [candidate] (251.264 ms) : 0, 251264
AppSec [baseline] (31.871 ms) : 0, 31871
AppSec [candidate] (32.354 ms) : 0, 32354
Debugger [baseline] (63.923 ms) : 0, 63923
Debugger [candidate] (64.534 ms) : 0, 64534
Remote Config [baseline] (633.473 µs) : 0, 633
Remote Config [candidate] (648.985 µs) : 0, 649
Telemetry [baseline] (8.329 ms) : 0, 8329
Telemetry [candidate] (8.398 ms) : 0, 8398
Flare Poller [baseline] (3.762 ms) : 0, 3762
Flare Poller [candidate] (3.817 ms) : 0, 3817
section appsec
crashtracking [baseline] (1.481 ms) : 0, 1481
crashtracking [candidate] (1.485 ms) : 0, 1485
BytebuddyAgent [baseline] (734.197 ms) : 0, 734197
BytebuddyAgent [candidate] (734.939 ms) : 0, 734939
GlobalTracer [baseline] (241.796 ms) : 0, 241796
GlobalTracer [candidate] (242.227 ms) : 0, 242227
AppSec [baseline] (174.676 ms) : 0, 174676
AppSec [candidate] (175.506 ms) : 0, 175506
Debugger [baseline] (61.844 ms) : 0, 61844
Debugger [candidate] (62.413 ms) : 0, 62413
Remote Config [baseline] (681.383 µs) : 0, 681
Remote Config [candidate] (675.759 µs) : 0, 676
Telemetry [baseline] (8.372 ms) : 0, 8372
Telemetry [candidate] (8.387 ms) : 0, 8387
Flare Poller [baseline] (4.018 ms) : 0, 4018
Flare Poller [candidate] (3.958 ms) : 0, 3958
IAST [baseline] (24.805 ms) : 0, 24805
IAST [candidate] (24.745 ms) : 0, 24745
section iast
crashtracking [baseline] (1.489 ms) : 0, 1489
crashtracking [candidate] (1.493 ms) : 0, 1493
BytebuddyAgent [baseline] (834.742 ms) : 0, 834742
BytebuddyAgent [candidate] (840.303 ms) : 0, 840303
GlobalTracer [baseline] (238.771 ms) : 0, 238771
GlobalTracer [candidate] (239.459 ms) : 0, 239459
AppSec [baseline] (33.039 ms) : 0, 33039
AppSec [candidate] (32.346 ms) : 0, 32346
Debugger [baseline] (60.994 ms) : 0, 60994
Debugger [candidate] (61.029 ms) : 0, 61029
Remote Config [baseline] (556.118 µs) : 0, 556
Remote Config [candidate] (551.428 µs) : 0, 551
Telemetry [baseline] (7.651 ms) : 0, 7651
Telemetry [candidate] (7.687 ms) : 0, 7687
Flare Poller [baseline] (3.507 ms) : 0, 3507
Flare Poller [candidate] (3.563 ms) : 0, 3563
IAST [baseline] (28.292 ms) : 0, 28292
IAST [candidate] (29.461 ms) : 0, 29461
section profiling
crashtracking [baseline] (1.477 ms) : 0, 1477
crashtracking [candidate] (1.438 ms) : 0, 1438
BytebuddyAgent [baseline] (747.418 ms) : 0, 747418
BytebuddyAgent [candidate] (737.731 ms) : 0, 737731
GlobalTracer [baseline] (225.947 ms) : 0, 225947
GlobalTracer [candidate] (222.748 ms) : 0, 222748
AppSec [baseline] (32.888 ms) : 0, 32888
AppSec [candidate] (32.16 ms) : 0, 32160
Debugger [baseline] (64.545 ms) : 0, 64545
Debugger [candidate] (63.228 ms) : 0, 63228
Remote Config [baseline] (682.027 µs) : 0, 682
Remote Config [candidate] (670.768 µs) : 0, 671
Telemetry [baseline] (8.225 ms) : 0, 8225
Telemetry [candidate] (8.042 ms) : 0, 8042
Flare Poller [baseline] (3.883 ms) : 0, 3883
Flare Poller [candidate] (3.797 ms) : 0, 3797
ProfilingAgent [baseline] (97.295 ms) : 0, 97295
ProfilingAgent [candidate] (97.41 ms) : 0, 97410
Profiling [baseline] (97.888 ms) : 0, 97888
Profiling [candidate] (97.991 ms) : 0, 97991
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.1 s) : 0, 1100091
Total [baseline] (8.874 s) : 0, 8873892
Agent [candidate] (1.106 s) : 0, 1105521
Total [candidate] (8.908 s) : 0, 8907685
section iast
Agent [baseline] (1.248 s) : 0, 1247621
Total [baseline] (9.574 s) : 0, 9574070
Agent [candidate] (1.244 s) : 0, 1244180
Total [candidate] (9.585 s) : 0, 9585418
gantt
title insecure-bank - break down per module: candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.481 ms) : 0, 1481
crashtracking [candidate] (1.494 ms) : 0, 1494
BytebuddyAgent [baseline] (707.642 ms) : 0, 707642
BytebuddyAgent [candidate] (709.344 ms) : 0, 709344
GlobalTracer [baseline] (248.859 ms) : 0, 248859
GlobalTracer [candidate] (250.707 ms) : 0, 250707
AppSec [baseline] (31.893 ms) : 0, 31893
AppSec [candidate] (32.429 ms) : 0, 32429
Debugger [baseline] (62.951 ms) : 0, 62951
Debugger [candidate] (63.95 ms) : 0, 63950
Remote Config [baseline] (619.41 µs) : 0, 619
Remote Config [candidate] (637.88 µs) : 0, 638
Telemetry [baseline] (8.249 ms) : 0, 8249
Telemetry [candidate] (8.333 ms) : 0, 8333
Flare Poller [baseline] (3.639 ms) : 0, 3639
Flare Poller [candidate] (3.7 ms) : 0, 3700
section iast
crashtracking [baseline] (1.5 ms) : 0, 1500
crashtracking [candidate] (1.488 ms) : 0, 1488
BytebuddyAgent [baseline] (838.913 ms) : 0, 838913
BytebuddyAgent [candidate] (834.11 ms) : 0, 834110
GlobalTracer [baseline] (238.37 ms) : 0, 238370
GlobalTracer [candidate] (239.761 ms) : 0, 239761
AppSec [baseline] (34.072 ms) : 0, 34072
AppSec [candidate] (33.237 ms) : 0, 33237
Debugger [baseline] (60.212 ms) : 0, 60212
Debugger [candidate] (60.187 ms) : 0, 60187
Remote Config [baseline] (528.46 µs) : 0, 528
Remote Config [candidate] (543.341 µs) : 0, 543
Telemetry [baseline] (7.635 ms) : 0, 7635
Telemetry [candidate] (7.652 ms) : 0, 7652
Flare Poller [baseline] (3.508 ms) : 0, 3508
Flare Poller [candidate] (3.48 ms) : 0, 3480
IAST [baseline] (27.834 ms) : 0, 27834
IAST [candidate] (28.766 ms) : 0, 28766
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 1 performance regressions! Performance is the same for 17 metrics, 16 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section baseline
no_agent (19.645 ms) : 19441, 19848
. : milestone, 19645,
appsec (18.375 ms) : 18186, 18565
. : milestone, 18375,
code_origins (17.816 ms) : 17636, 17997
. : milestone, 17816,
iast (18.97 ms) : 18773, 19166
. : milestone, 18970,
profiling (18.832 ms) : 18641, 19023
. : milestone, 18832,
tracing (17.631 ms) : 17456, 17807
. : milestone, 17631,
section candidate
no_agent (18.729 ms) : 18537, 18921
. : milestone, 18729,
appsec (18.428 ms) : 18241, 18615
. : milestone, 18428,
code_origins (17.701 ms) : 17524, 17877
. : milestone, 17701,
iast (17.654 ms) : 17475, 17833
. : milestone, 17654,
profiling (19.574 ms) : 19379, 19768
. : milestone, 19574,
tracing (17.568 ms) : 17395, 17741
. : milestone, 17568,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section baseline
no_agent (1.208 ms) : 1196, 1220
. : milestone, 1208,
iast (3.349 ms) : 3300, 3398
. : milestone, 3349,
iast_FULL (5.915 ms) : 5855, 5975
. : milestone, 5915,
iast_GLOBAL (3.675 ms) : 3619, 3731
. : milestone, 3675,
profiling (1.936 ms) : 1919, 1952
. : milestone, 1936,
tracing (1.859 ms) : 1843, 1875
. : milestone, 1859,
section candidate
no_agent (1.208 ms) : 1197, 1220
. : milestone, 1208,
iast (3.316 ms) : 3272, 3360
. : milestone, 3316,
iast_FULL (5.803 ms) : 5744, 5861
. : milestone, 5803,
iast_GLOBAL (3.496 ms) : 3448, 3544
. : milestone, 3496,
profiling (2.292 ms) : 2270, 2315
. : milestone, 2292,
tracing (1.831 ms) : 1816, 1846
. : milestone, 1831,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section baseline
no_agent (14.733 s) : 14733000, 14733000
. : milestone, 14733000,
appsec (14.917 s) : 14917000, 14917000
. : milestone, 14917000,
iast (18.021 s) : 18021000, 18021000
. : milestone, 18021000,
iast_GLOBAL (17.877 s) : 17877000, 17877000
. : milestone, 17877000,
profiling (15.334 s) : 15334000, 15334000
. : milestone, 15334000,
tracing (14.863 s) : 14863000, 14863000
. : milestone, 14863000,
section candidate
no_agent (14.84 s) : 14840000, 14840000
. : milestone, 14840000,
appsec (14.464 s) : 14464000, 14464000
. : milestone, 14464000,
iast (18.235 s) : 18235000, 18235000
. : milestone, 18235000,
iast_GLOBAL (17.858 s) : 17858000, 17858000
. : milestone, 17858000,
profiling (14.644 s) : 14644000, 14644000
. : milestone, 14644000,
tracing (15.05 s) : 15050000, 15050000
. : milestone, 15050000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.57.0-SNAPSHOT~5612b44f2f, baseline=1.57.0-SNAPSHOT~cedc49cb46
dateFormat X
axisFormat %s
section baseline
no_agent (1.472 ms) : 1461, 1484
. : milestone, 1472,
appsec (2.455 ms) : 2404, 2507
. : milestone, 2455,
iast (2.217 ms) : 2152, 2282
. : milestone, 2217,
iast_GLOBAL (2.249 ms) : 2185, 2314
. : milestone, 2249,
profiling (2.088 ms) : 2035, 2142
. : milestone, 2088,
tracing (2.035 ms) : 1985, 2086
. : milestone, 2035,
section candidate
no_agent (1.473 ms) : 1461, 1484
. : milestone, 1473,
appsec (2.467 ms) : 2415, 2519
. : milestone, 2467,
iast (2.214 ms) : 2149, 2279
. : milestone, 2214,
iast_GLOBAL (2.254 ms) : 2189, 2319
. : milestone, 2254,
profiling (2.066 ms) : 2013, 2119
. : milestone, 2066,
tracing (2.043 ms) : 1993, 2094
. : milestone, 2043,
|
d808c97 to
310ed94
Compare
310ed94 to
5612b44
Compare
jpbempel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mcculls for taking care of this!
|
Late for the review, but really nice ! |
What Does This Do
Avoids repeated calls to
Class.getMethod(...)when setting up code-origins.Motivation
We don't need the full
Methodreflection data; only the declaring type, method name, and method descriptor. Changing the@Advice.Originbyte-buddy annotation to provide them as separate strings means byte-buddy can store them as constants.Before this PR, the bytecode inserted by
EntrySpanOriginAdvicelooked like:After this PR it looks like:
The Java 8 JDK also appears to have an intermittent class redefinition bug which is triggered by these repeated calls to
getMethod. Transforming a class that's in the middle of callingClass.getMethod(...)seems in rare situations on Java 8 to either cause thatgetMethodcall to throwNegativeArraySizeExceptionor lead to a native error as reported in #10017Note that this link has not been confirmed because we have not been able to recreate the error locally in order to verify this fix. However, given the current data simplifying the code-origin setup advice should also help with the reported issue.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: DEBUG-4768