-
Notifications
You must be signed in to change notification settings - Fork 323
Batch re-transformations when there are a high number of inner classes #10289
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
Conversation
if a source file has a large number of inner classes, putting a line probe will trigger the retransformation of all inner classes individually which can lead to significant overhead (retransformation is Stop-The-World event). The api instrumentation::retransformClasses can take a list of classes that are retransformed in a single STW event which armortized the cost. However we put a hard limit of number of inner classes to avoid long STW event in case of generated code.
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
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 (324.148 µs) : 282, 366
. : milestone, 324,
basic (279.552 µs) : 273, 286
. : milestone, 280,
loop (8.965 ms) : 8960, 8969
. : milestone, 8965,
section candidate
noprobe (312.421 µs) : 289, 336
. : milestone, 312,
basic (278.266 µs) : 272, 285
. : milestone, 278,
loop (8.964 ms) : 8959, 8968
. : milestone, 8964,
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 57 metrics, 8 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.089 s) : 0, 1088880
Total [baseline] (8.791 s) : 0, 8790519
Agent [candidate] (1.085 s) : 0, 1084769
Total [candidate] (8.746 s) : 0, 8746151
section iast
Agent [baseline] (1.234 s) : 0, 1233771
Total [baseline] (9.322 s) : 0, 9322353
Agent [candidate] (1.222 s) : 0, 1222429
Total [candidate] (9.34 s) : 0, 9339504
gantt
title insecure-bank - break down per module: candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.193 ms) : 0, 1193
BytebuddyAgent [baseline] (653.826 ms) : 0, 653826
BytebuddyAgent [candidate] (651.485 ms) : 0, 651485
GlobalTracer [baseline] (284.103 ms) : 0, 284103
GlobalTracer [candidate] (282.609 ms) : 0, 282609
AppSec [baseline] (33.002 ms) : 0, 33002
AppSec [candidate] (32.713 ms) : 0, 32713
Debugger [baseline] (67.671 ms) : 0, 67671
Debugger [candidate] (67.859 ms) : 0, 67859
Remote Config [baseline] (614.268 µs) : 0, 614
Remote Config [candidate] (619.512 µs) : 0, 620
Telemetry [baseline] (9.085 ms) : 0, 9085
Telemetry [candidate] (9.047 ms) : 0, 9047
Flare Poller [baseline] (3.798 ms) : 0, 3798
Flare Poller [candidate] (3.759 ms) : 0, 3759
section iast
crashtracking [baseline] (1.194 ms) : 0, 1194
crashtracking [candidate] (1.193 ms) : 0, 1193
BytebuddyAgent [baseline] (799.535 ms) : 0, 799535
BytebuddyAgent [candidate] (791.738 ms) : 0, 791738
GlobalTracer [baseline] (257.247 ms) : 0, 257247
GlobalTracer [candidate] (255.12 ms) : 0, 255120
AppSec [baseline] (33.78 ms) : 0, 33780
AppSec [candidate] (33.503 ms) : 0, 33503
Debugger [baseline] (66.1 ms) : 0, 66100
Debugger [candidate] (65.648 ms) : 0, 65648
Remote Config [baseline] (605.823 µs) : 0, 606
Remote Config [candidate] (620.953 µs) : 0, 621
Telemetry [baseline] (8.643 ms) : 0, 8643
Telemetry [candidate] (8.485 ms) : 0, 8485
Flare Poller [baseline] (3.544 ms) : 0, 3544
Flare Poller [candidate] (3.551 ms) : 0, 3551
IAST [baseline] (27.406 ms) : 0, 27406
IAST [candidate] (27.071 ms) : 0, 27071
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.088 s) : 0, 1088124
Total [baseline] (11.033 s) : 0, 11032679
Agent [candidate] (1.086 s) : 0, 1086093
Total [candidate] (10.737 s) : 0, 10736925
section appsec
Agent [baseline] (1.27 s) : 0, 1269605
Total [baseline] (10.928 s) : 0, 10927935
Agent [candidate] (1.267 s) : 0, 1266968
Total [candidate] (10.917 s) : 0, 10917375
section iast
Agent [baseline] (1.237 s) : 0, 1237354
Total [baseline] (11.295 s) : 0, 11295441
Agent [candidate] (1.226 s) : 0, 1226256
Total [candidate] (11.11 s) : 0, 11110319
section profiling
Agent [baseline] (1.207 s) : 0, 1207038
Total [baseline] (11.036 s) : 0, 11036169
Agent [candidate] (1.211 s) : 0, 1211376
Total [candidate] (10.943 s) : 0, 10943123
gantt
title petclinic - break down per module: candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.188 ms) : 0, 1188
crashtracking [candidate] (1.188 ms) : 0, 1188
BytebuddyAgent [baseline] (653.413 ms) : 0, 653413
BytebuddyAgent [candidate] (652.332 ms) : 0, 652332
GlobalTracer [baseline] (282.991 ms) : 0, 282991
GlobalTracer [candidate] (282.508 ms) : 0, 282508
AppSec [baseline] (32.877 ms) : 0, 32877
AppSec [candidate] (32.81 ms) : 0, 32810
Debugger [baseline] (68.324 ms) : 0, 68324
Debugger [candidate] (68.365 ms) : 0, 68365
Remote Config [baseline] (629.966 µs) : 0, 630
Remote Config [candidate] (636.258 µs) : 0, 636
Telemetry [baseline] (9.201 ms) : 0, 9201
Telemetry [candidate] (8.974 ms) : 0, 8974
Flare Poller [baseline] (3.854 ms) : 0, 3854
Flare Poller [candidate] (3.733 ms) : 0, 3733
section appsec
crashtracking [baseline] (1.187 ms) : 0, 1187
crashtracking [candidate] (1.197 ms) : 0, 1197
BytebuddyAgent [baseline] (695.862 ms) : 0, 695862
BytebuddyAgent [candidate] (693.092 ms) : 0, 693092
GlobalTracer [baseline] (258.441 ms) : 0, 258441
GlobalTracer [candidate] (258.141 ms) : 0, 258141
AppSec [baseline] (174.528 ms) : 0, 174528
AppSec [candidate] (173.635 ms) : 0, 173635
Debugger [baseline] (65.895 ms) : 0, 65895
Debugger [candidate] (66.878 ms) : 0, 66878
Remote Config [baseline] (758.214 µs) : 0, 758
Remote Config [candidate] (778.135 µs) : 0, 778
Telemetry [baseline] (9.258 ms) : 0, 9258
Telemetry [candidate] (9.419 ms) : 0, 9419
Flare Poller [baseline] (3.69 ms) : 0, 3690
Flare Poller [candidate] (3.725 ms) : 0, 3725
IAST [baseline] (24.453 ms) : 0, 24453
IAST [candidate] (24.632 ms) : 0, 24632
section iast
crashtracking [baseline] (1.214 ms) : 0, 1214
crashtracking [candidate] (1.196 ms) : 0, 1196
BytebuddyAgent [baseline] (800.165 ms) : 0, 800165
BytebuddyAgent [candidate] (793.786 ms) : 0, 793786
GlobalTracer [baseline] (258.541 ms) : 0, 258541
GlobalTracer [candidate] (256.1 ms) : 0, 256100
AppSec [baseline] (34.7 ms) : 0, 34700
AppSec [candidate] (33.429 ms) : 0, 33429
Debugger [baseline] (66.562 ms) : 0, 66562
Debugger [candidate] (66.452 ms) : 0, 66452
Remote Config [baseline] (611.513 µs) : 0, 612
Remote Config [candidate] (579.49 µs) : 0, 579
Telemetry [baseline] (8.734 ms) : 0, 8734
Telemetry [candidate] (8.518 ms) : 0, 8518
Flare Poller [baseline] (3.617 ms) : 0, 3617
Flare Poller [candidate] (3.447 ms) : 0, 3447
IAST [baseline] (27.567 ms) : 0, 27567
IAST [candidate] (27.205 ms) : 0, 27205
section profiling
crashtracking [baseline] (1.214 ms) : 0, 1214
crashtracking [candidate] (1.216 ms) : 0, 1216
BytebuddyAgent [baseline] (703.948 ms) : 0, 703948
BytebuddyAgent [candidate] (707.964 ms) : 0, 707964
GlobalTracer [baseline] (220.554 ms) : 0, 220554
GlobalTracer [candidate] (221.351 ms) : 0, 221351
AppSec [baseline] (32.037 ms) : 0, 32037
AppSec [candidate] (32.3 ms) : 0, 32300
Debugger [baseline] (68.389 ms) : 0, 68389
Debugger [candidate] (68.227 ms) : 0, 68227
Remote Config [baseline] (646.649 µs) : 0, 647
Remote Config [candidate] (637.991 µs) : 0, 638
Telemetry [baseline] (8.841 ms) : 0, 8841
Telemetry [candidate] (8.807 ms) : 0, 8807
Flare Poller [baseline] (3.711 ms) : 0, 3711
Flare Poller [candidate] (3.698 ms) : 0, 3698
ProfilingAgent [baseline] (97.798 ms) : 0, 97798
ProfilingAgent [candidate] (97.329 ms) : 0, 97329
Profiling [baseline] (98.384 ms) : 0, 98384
Profiling [candidate] (97.911 ms) : 0, 97911
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 2 performance regressions! Performance is the same for 16 metrics, 16 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section baseline
no_agent (1.214 ms) : 1202, 1226
. : milestone, 1214,
iast (3.14 ms) : 3099, 3181
. : milestone, 3140,
iast_FULL (5.837 ms) : 5779, 5895
. : milestone, 5837,
iast_GLOBAL (3.614 ms) : 3555, 3673
. : milestone, 3614,
profiling (1.976 ms) : 1959, 1993
. : milestone, 1976,
tracing (1.775 ms) : 1760, 1790
. : milestone, 1775,
section candidate
no_agent (1.196 ms) : 1184, 1207
. : milestone, 1196,
iast (3.25 ms) : 3205, 3296
. : milestone, 3250,
iast_FULL (5.715 ms) : 5658, 5772
. : milestone, 5715,
iast_GLOBAL (3.695 ms) : 3641, 3749
. : milestone, 3695,
profiling (1.918 ms) : 1902, 1935
. : milestone, 1918,
tracing (1.825 ms) : 1810, 1839
. : milestone, 1825,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section baseline
no_agent (17.013 ms) : 16845, 17182
. : milestone, 17013,
appsec (18.363 ms) : 18178, 18548
. : milestone, 18363,
code_origins (17.595 ms) : 17422, 17768
. : milestone, 17595,
iast (18.04 ms) : 17859, 18220
. : milestone, 18040,
profiling (19.788 ms) : 19583, 19993
. : milestone, 19788,
tracing (17.871 ms) : 17694, 18047
. : milestone, 17871,
section candidate
no_agent (18.516 ms) : 18326, 18705
. : milestone, 18516,
appsec (18.505 ms) : 18317, 18693
. : milestone, 18505,
code_origins (17.858 ms) : 17679, 18037
. : milestone, 17858,
iast (17.692 ms) : 17517, 17866
. : milestone, 17692,
profiling (18.582 ms) : 18396, 18768
. : milestone, 18582,
tracing (17.788 ms) : 17611, 17965
. : milestone, 17788,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 2 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section baseline
no_agent (15.636 s) : 15636000, 15636000
. : milestone, 15636000,
appsec (14.849 s) : 14849000, 14849000
. : milestone, 14849000,
iast (18.07 s) : 18070000, 18070000
. : milestone, 18070000,
iast_GLOBAL (17.767 s) : 17767000, 17767000
. : milestone, 17767000,
profiling (14.942 s) : 14942000, 14942000
. : milestone, 14942000,
tracing (14.851 s) : 14851000, 14851000
. : milestone, 14851000,
section candidate
no_agent (15.526 s) : 15526000, 15526000
. : milestone, 15526000,
appsec (14.499 s) : 14499000, 14499000
. : milestone, 14499000,
iast (17.918 s) : 17918000, 17918000
. : milestone, 17918000,
iast_GLOBAL (17.978 s) : 17978000, 17978000
. : milestone, 17978000,
profiling (14.956 s) : 14956000, 14956000
. : milestone, 14956000,
tracing (14.684 s) : 14684000, 14684000
. : milestone, 14684000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.58.0-SNAPSHOT~4b43b45cd9, baseline=1.58.0-SNAPSHOT~ab049bd23d
dateFormat X
axisFormat %s
section baseline
no_agent (1.479 ms) : 1468, 1491
. : milestone, 1479,
appsec (3.727 ms) : 3506, 3948
. : milestone, 3727,
iast (2.218 ms) : 2153, 2283
. : milestone, 2218,
iast_GLOBAL (2.258 ms) : 2194, 2323
. : milestone, 2258,
profiling (2.498 ms) : 2335, 2660
. : milestone, 2498,
tracing (2.066 ms) : 2014, 2117
. : milestone, 2066,
section candidate
no_agent (1.475 ms) : 1463, 1486
. : milestone, 1475,
appsec (3.746 ms) : 3528, 3964
. : milestone, 3746,
iast (2.219 ms) : 2154, 2283
. : milestone, 2219,
iast_GLOBAL (2.277 ms) : 2212, 2342
. : milestone, 2277,
profiling (2.06 ms) : 2008, 2113
. : milestone, 2060,
tracing (2.057 ms) : 2006, 2108
. : milestone, 2057,
|
|
|
||
| private void retransformClasses(List<Class<?>> classesToBeTransformed) { | ||
| int classCount = classesToBeTransformed.size(); | ||
| if (classCount <= 10) { |
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.
Why 10? What the benefit here?
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.
if a retransformation fails it is easier to pinpoint which class is failing that way (individually). here we consider that if we have more than 10 the classes belong to same "family" (here the inner classes).
| } else if (classCount <= 1000) { | ||
| retransformClassesAtOnce(classesToBeTransformed); | ||
| } else { | ||
| throw new IllegalStateException("Too many classes to retransform: " + classCount); |
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.
What happens from the users perspective when there are more than 1,000 classes to transform? Is this raised as an instrumentation error?
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.
yes
What Does This Do
if a source file has a large number of inner classes, putting a line probe will trigger the retransformation of all inner classes individually which can lead to significant overhead (retransformation is Stop-The-World event). The api instrumentation::retransformClasses can take a list of classes that are retransformed in a single STW event which armortized the cost. However we put a hard limit of number of inner classes to avoid long STW event in case of generated code.
Motivation
Additional Notes
Did some tests about the overhead of retransformClasses:
for 100 inner classes
individually: 600ms
batch: 34ms
for 1000 inner classes
individually: 5500ms
batch: 260ms
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-4890