Avoid Metadata.key allocations on grpc#11351
Conversation
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
BenchmarksStartupParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 11 unstable metrics.
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.094 s) : 0, 1093860
Total [baseline] (11.495 s) : 0, 11495194
Agent [candidate] (1.093 s) : 0, 1092869
Total [candidate] (11.458 s) : 0, 11457666
section appsec
Agent [baseline] (1.305 s) : 0, 1304679
Total [baseline] (11.219 s) : 0, 11218587
Agent [candidate] (1.303 s) : 0, 1303042
Total [candidate] (11.341 s) : 0, 11341118
section iast
Agent [baseline] (1.283 s) : 0, 1282799
Total [baseline] (11.362 s) : 0, 11361597
Agent [candidate] (1.28 s) : 0, 1279934
Total [candidate] (11.313 s) : 0, 11313338
section profiling
Agent [baseline] (1.351 s) : 0, 1351379
Total [baseline] (11.474 s) : 0, 11473679
Agent [candidate] (1.345 s) : 0, 1345472
Total [candidate] (11.445 s) : 0, 11444625
gantt
title petclinic - break down per module: candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.279 ms) : 0, 1279
crashtracking [candidate] (1.272 ms) : 0, 1272
BytebuddyAgent [baseline] (650.451 ms) : 0, 650451
BytebuddyAgent [candidate] (649.612 ms) : 0, 649612
AgentMeter [baseline] (30.546 ms) : 0, 30546
AgentMeter [candidate] (30.519 ms) : 0, 30519
GlobalTracer [baseline] (256.156 ms) : 0, 256156
GlobalTracer [candidate] (255.839 ms) : 0, 255839
AppSec [baseline] (33.717 ms) : 0, 33717
AppSec [candidate] (33.611 ms) : 0, 33611
Debugger [baseline] (64.2 ms) : 0, 64200
Debugger [candidate] (64.362 ms) : 0, 64362
Remote Config [baseline] (635.03 µs) : 0, 635
Remote Config [candidate] (641.102 µs) : 0, 641
Telemetry [baseline] (9.673 ms) : 0, 9673
Telemetry [candidate] (8.889 ms) : 0, 8889
Flare Poller [baseline] (9.809 ms) : 0, 9809
Flare Poller [candidate] (10.647 ms) : 0, 10647
section appsec
crashtracking [baseline] (1.282 ms) : 0, 1282
crashtracking [candidate] (1.269 ms) : 0, 1269
BytebuddyAgent [baseline] (692.784 ms) : 0, 692784
BytebuddyAgent [candidate] (690.781 ms) : 0, 690781
AgentMeter [baseline] (12.558 ms) : 0, 12558
AgentMeter [candidate] (12.516 ms) : 0, 12516
GlobalTracer [baseline] (258.11 ms) : 0, 258110
GlobalTracer [candidate] (258.431 ms) : 0, 258431
IAST [baseline] (25.813 ms) : 0, 25813
IAST [candidate] (25.513 ms) : 0, 25513
AppSec [baseline] (190.793 ms) : 0, 190793
AppSec [candidate] (191.209 ms) : 0, 191209
Debugger [baseline] (67.913 ms) : 0, 67913
Debugger [candidate] (68.003 ms) : 0, 68003
Remote Config [baseline] (622.564 µs) : 0, 623
Remote Config [candidate] (616.883 µs) : 0, 617
Telemetry [baseline] (7.897 ms) : 0, 7897
Telemetry [candidate] (7.937 ms) : 0, 7937
Flare Poller [baseline] (9.43 ms) : 0, 9430
Flare Poller [candidate] (8.847 ms) : 0, 8847
section iast
crashtracking [baseline] (1.282 ms) : 0, 1282
crashtracking [candidate] (1.274 ms) : 0, 1274
BytebuddyAgent [baseline] (845.878 ms) : 0, 845878
BytebuddyAgent [candidate] (843.087 ms) : 0, 843087
AgentMeter [baseline] (12.55 ms) : 0, 12550
AgentMeter [candidate] (11.689 ms) : 0, 11689
GlobalTracer [baseline] (245.15 ms) : 0, 245150
GlobalTracer [candidate] (245.714 ms) : 0, 245714
IAST [baseline] (28.075 ms) : 0, 28075
IAST [candidate] (28.365 ms) : 0, 28365
AppSec [baseline] (33.538 ms) : 0, 33538
AppSec [candidate] (33.484 ms) : 0, 33484
Debugger [baseline] (66.745 ms) : 0, 66745
Debugger [candidate] (66.794 ms) : 0, 66794
Remote Config [baseline] (559.706 µs) : 0, 560
Remote Config [candidate] (558.629 µs) : 0, 559
Telemetry [baseline] (8.194 ms) : 0, 8194
Telemetry [candidate] (8.242 ms) : 0, 8242
Flare Poller [baseline] (3.44 ms) : 0, 3440
Flare Poller [candidate] (3.448 ms) : 0, 3448
section profiling
crashtracking [baseline] (552.24 µs) : 0, 552
crashtracking [candidate] (539.204 µs) : 0, 539
BytebuddyAgent [baseline] (711.432 ms) : 0, 711432
BytebuddyAgent [candidate] (706.727 ms) : 0, 706727
AgentMeter [baseline] (10.533 ms) : 0, 10533
AgentMeter [candidate] (10.709 ms) : 0, 10709
GlobalTracer [baseline] (213.666 ms) : 0, 213666
GlobalTracer [candidate] (213.981 ms) : 0, 213981
AppSec [baseline] (33.131 ms) : 0, 33131
AppSec [candidate] (33.123 ms) : 0, 33123
Debugger [baseline] (69.621 ms) : 0, 69621
Debugger [candidate] (69.523 ms) : 0, 69523
Remote Config [baseline] (615.92 µs) : 0, 616
Remote Config [candidate] (601.229 µs) : 0, 601
Telemetry [baseline] (8.393 ms) : 0, 8393
Telemetry [candidate] (8.337 ms) : 0, 8337
Flare Poller [baseline] (3.712 ms) : 0, 3712
Flare Poller [candidate] (3.784 ms) : 0, 3784
ProfilingAgent [baseline] (93.378 ms) : 0, 93378
ProfilingAgent [candidate] (93.019 ms) : 0, 93019
Profiling [baseline] (93.974 ms) : 0, 93974
Profiling [candidate] (93.599 ms) : 0, 93599
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.098 s) : 0, 1097519
Total [baseline] (9.428 s) : 0, 9428468
Agent [candidate] (1.098 s) : 0, 1097826
Total [candidate] (9.403 s) : 0, 9402637
section iast
Agent [baseline] (1.281 s) : 0, 1280667
Total [baseline] (10.135 s) : 0, 10134532
Agent [candidate] (1.276 s) : 0, 1276439
Total [candidate] (10.127 s) : 0, 10126661
gantt
title insecure-bank - break down per module: candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.276 ms) : 0, 1276
crashtracking [candidate] (1.271 ms) : 0, 1271
BytebuddyAgent [baseline] (653.635 ms) : 0, 653635
BytebuddyAgent [candidate] (652.608 ms) : 0, 652608
AgentMeter [baseline] (30.435 ms) : 0, 30435
AgentMeter [candidate] (30.694 ms) : 0, 30694
GlobalTracer [baseline] (256.174 ms) : 0, 256174
GlobalTracer [candidate] (257.098 ms) : 0, 257098
AppSec [baseline] (33.726 ms) : 0, 33726
AppSec [candidate] (33.702 ms) : 0, 33702
Debugger [baseline] (62.919 ms) : 0, 62919
Debugger [candidate] (63.827 ms) : 0, 63827
Remote Config [baseline] (642.197 µs) : 0, 642
Remote Config [candidate] (646.783 µs) : 0, 647
Telemetry [baseline] (9.796 ms) : 0, 9796
Telemetry [candidate] (9.714 ms) : 0, 9714
Flare Poller [baseline] (11.505 ms) : 0, 11505
Flare Poller [candidate] (10.76 ms) : 0, 10760
section iast
crashtracking [baseline] (1.28 ms) : 0, 1280
crashtracking [candidate] (1.276 ms) : 0, 1276
BytebuddyAgent [baseline] (844.612 ms) : 0, 844612
BytebuddyAgent [candidate] (841.274 ms) : 0, 841274
AgentMeter [baseline] (11.984 ms) : 0, 11984
AgentMeter [candidate] (11.662 ms) : 0, 11662
GlobalTracer [baseline] (245.116 ms) : 0, 245116
GlobalTracer [candidate] (245.251 ms) : 0, 245251
IAST [baseline] (30.217 ms) : 0, 30217
IAST [candidate] (28.258 ms) : 0, 28258
AppSec [baseline] (31.752 ms) : 0, 31752
AppSec [candidate] (33.419 ms) : 0, 33419
Debugger [baseline] (66.165 ms) : 0, 66165
Debugger [candidate] (65.751 ms) : 0, 65751
Remote Config [baseline] (577.163 µs) : 0, 577
Remote Config [candidate] (572.055 µs) : 0, 572
Telemetry [baseline] (8.218 ms) : 0, 8218
Telemetry [candidate] (8.209 ms) : 0, 8209
Flare Poller [baseline] (3.421 ms) : 0, 3421
Flare Poller [candidate] (3.427 ms) : 0, 3427
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.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section baseline
no_agent (19.403 ms) : 19206, 19599
. : milestone, 19403,
appsec (19.008 ms) : 18815, 19202
. : milestone, 19008,
code_origins (18.095 ms) : 17917, 18273
. : milestone, 18095,
iast (17.952 ms) : 17777, 18128
. : milestone, 17952,
profiling (18.225 ms) : 18043, 18406
. : milestone, 18225,
tracing (18.2 ms) : 18022, 18377
. : milestone, 18200,
section candidate
no_agent (18.369 ms) : 18183, 18554
. : milestone, 18369,
appsec (18.666 ms) : 18477, 18854
. : milestone, 18666,
code_origins (17.881 ms) : 17706, 18056
. : milestone, 17881,
iast (18.134 ms) : 17954, 18314
. : milestone, 18134,
profiling (19.251 ms) : 19056, 19445
. : milestone, 19251,
tracing (17.699 ms) : 17523, 17874
. : milestone, 17699,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section baseline
no_agent (1.255 ms) : 1243, 1267
. : milestone, 1255,
iast (3.297 ms) : 3248, 3346
. : milestone, 3297,
iast_FULL (6.26 ms) : 6195, 6325
. : milestone, 6260,
iast_GLOBAL (3.677 ms) : 3619, 3735
. : milestone, 3677,
profiling (2.233 ms) : 2212, 2254
. : milestone, 2233,
tracing (1.97 ms) : 1952, 1987
. : milestone, 1970,
section candidate
no_agent (1.268 ms) : 1255, 1280
. : milestone, 1268,
iast (3.31 ms) : 3268, 3352
. : milestone, 3310,
iast_FULL (5.905 ms) : 5846, 5965
. : milestone, 5905,
iast_GLOBAL (3.704 ms) : 3644, 3764
. : milestone, 3704,
profiling (2.386 ms) : 2361, 2411
. : milestone, 2386,
tracing (1.916 ms) : 1900, 1932
. : milestone, 1916,
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.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section baseline
no_agent (14.93 s) : 14930000, 14930000
. : milestone, 14930000,
appsec (14.942 s) : 14942000, 14942000
. : milestone, 14942000,
iast (18.743 s) : 18743000, 18743000
. : milestone, 18743000,
iast_GLOBAL (18.212 s) : 18212000, 18212000
. : milestone, 18212000,
profiling (14.968 s) : 14968000, 14968000
. : milestone, 14968000,
tracing (15.193 s) : 15193000, 15193000
. : milestone, 15193000,
section candidate
no_agent (15.227 s) : 15227000, 15227000
. : milestone, 15227000,
appsec (15.084 s) : 15084000, 15084000
. : milestone, 15084000,
iast (19.289 s) : 19289000, 19289000
. : milestone, 19289000,
iast_GLOBAL (18.155 s) : 18155000, 18155000
. : milestone, 18155000,
profiling (14.877 s) : 14877000, 14877000
. : milestone, 14877000,
tracing (15.126 s) : 15126000, 15126000
. : milestone, 15126000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.63.0-SNAPSHOT~8e86faff09, baseline=1.63.0-SNAPSHOT~710ca87583
dateFormat X
axisFormat %s
section baseline
no_agent (1.502 ms) : 1490, 1514
. : milestone, 1502,
appsec (3.891 ms) : 3660, 4121
. : milestone, 3891,
iast (2.291 ms) : 2221, 2361
. : milestone, 2291,
iast_GLOBAL (2.337 ms) : 2267, 2408
. : milestone, 2337,
profiling (2.522 ms) : 2310, 2734
. : milestone, 2522,
tracing (2.094 ms) : 2040, 2148
. : milestone, 2094,
section candidate
no_agent (1.498 ms) : 1486, 1510
. : milestone, 1498,
appsec (3.868 ms) : 3647, 4090
. : milestone, 3868,
iast (2.295 ms) : 2225, 2366
. : milestone, 2295,
iast_GLOBAL (2.332 ms) : 2262, 2401
. : milestone, 2332,
profiling (2.516 ms) : 2360, 2672
. : milestone, 2516,
tracing (2.103 ms) : 2049, 2157
. : milestone, 2103,
|
vandonr
left a comment
There was a problem hiding this comment.
looks good, but do you have some metrics showing this improves perf ?
It looks like the code is mostly invoked with static key names, but not all the time ? I guess it's possible to have scenarios where regular swaths of variable keys come and wipe the cache... but then it'd just mostly revert to the previous behavior which was to create keys all the time. So I guess it's fine.
Yep I added the allocation histograms on the PR description. BTW the metadata key objects are immutable but we create bunch of them for each call. Even if it's a small allocation, it's worth not doing it if we can. Also we avoid calling
Normally we are largerly under 32 keys (taking into account datadog and w3c headers). We also have stuff from appsec and potentially the baggage. Having 64 element cache should be enough for nominal cases
Yes in this case all the cache misses will translate in creating a new entry so it will be less effective but it won't break anything |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
af7ee34
into
master
What Does This Do
Avoid allocating a Metadata.Key allocation for each grpc call (it's on the hot path). The keys can be cached in a large enough DDCache
Motivation
Allocation histogram — instrumented vs baseline (JFR captures)
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.