-
Notifications
You must be signed in to change notification settings - Fork 312
Pool unionmap for log injection #9555
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
base: master
Are you sure you want to change the base?
Conversation
🎯 Code Coverage 🔗 Commit SHA: 7c5a065 | Docs | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 63 metrics, 2 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.018 s) : 0, 1017603
Total [baseline] (8.673 s) : 0, 8673378
Agent [candidate] (1.019 s) : 0, 1019066
Total [candidate] (8.676 s) : 0, 8676113
section iast
Agent [baseline] (1.158 s) : 0, 1158065
Total [baseline] (9.365 s) : 0, 9364963
Agent [candidate] (1.149 s) : 0, 1149036
Total [candidate] (9.273 s) : 0, 9272716
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.469 ms) : 0, 1469
crashtracking [candidate] (1.458 ms) : 0, 1458
BytebuddyAgent [baseline] (692.427 ms) : 0, 692427
BytebuddyAgent [candidate] (693.808 ms) : 0, 693808
GlobalTracer [baseline] (241.628 ms) : 0, 241628
GlobalTracer [candidate] (241.852 ms) : 0, 241852
AppSec [baseline] (32.84 ms) : 0, 32840
AppSec [candidate] (32.726 ms) : 0, 32726
Debugger [baseline] (6.42 ms) : 0, 6420
Debugger [candidate] (6.389 ms) : 0, 6389
Remote Config [baseline] (702.538 µs) : 0, 703
Remote Config [candidate] (701.454 µs) : 0, 701
Telemetry [baseline] (9.253 ms) : 0, 9253
Telemetry [candidate] (9.234 ms) : 0, 9234
Flare Poller [baseline] (11.701 ms) : 0, 11701
Flare Poller [candidate] (11.751 ms) : 0, 11751
section iast
crashtracking [baseline] (1.471 ms) : 0, 1471
crashtracking [candidate] (1.471 ms) : 0, 1471
BytebuddyAgent [baseline] (819.544 ms) : 0, 819544
BytebuddyAgent [candidate] (813.861 ms) : 0, 813861
GlobalTracer [baseline] (232.631 ms) : 0, 232631
GlobalTracer [candidate] (231.243 ms) : 0, 231243
IAST [baseline] (26.89 ms) : 0, 26890
IAST [candidate] (26.211 ms) : 0, 26211
AppSec [baseline] (36.276 ms) : 0, 36276
AppSec [candidate] (35.48 ms) : 0, 35480
Debugger [baseline] (6.206 ms) : 0, 6206
Debugger [candidate] (6.141 ms) : 0, 6141
Remote Config [baseline] (626.64 µs) : 0, 627
Remote Config [candidate] (601.276 µs) : 0, 601
Telemetry [baseline] (8.805 ms) : 0, 8805
Telemetry [candidate] (8.579 ms) : 0, 8579
Flare Poller [baseline] (4.249 ms) : 0, 4249
Flare Poller [candidate] (4.208 ms) : 0, 4208
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.016 s) : 0, 1015627
Total [baseline] (10.673 s) : 0, 10673081
Agent [candidate] (1.014 s) : 0, 1013764
Total [candidate] (10.724 s) : 0, 10723503
section appsec
Agent [baseline] (1.195 s) : 0, 1194869
Total [baseline] (11.092 s) : 0, 11092470
Agent [candidate] (1.19 s) : 0, 1190412
Total [candidate] (11.046 s) : 0, 11045872
section iast
Agent [baseline] (1.159 s) : 0, 1158890
Total [baseline] (11.032 s) : 0, 11032407
Agent [candidate] (1.153 s) : 0, 1152566
Total [candidate] (10.94 s) : 0, 10939981
section profiling
Agent [baseline] (1.163 s) : 0, 1162649
Total [baseline] (11.029 s) : 0, 11028882
Agent [candidate] (1.166 s) : 0, 1166212
Total [candidate] (11.084 s) : 0, 11083539
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.457 ms) : 0, 1457
crashtracking [candidate] (1.46 ms) : 0, 1460
BytebuddyAgent [baseline] (692.553 ms) : 0, 692553
BytebuddyAgent [candidate] (690.997 ms) : 0, 690997
GlobalTracer [baseline] (241.621 ms) : 0, 241621
GlobalTracer [candidate] (241.116 ms) : 0, 241116
AppSec [baseline] (32.859 ms) : 0, 32859
AppSec [candidate] (32.594 ms) : 0, 32594
Debugger [baseline] (6.41 ms) : 0, 6410
Debugger [candidate] (6.402 ms) : 0, 6402
Remote Config [baseline] (765.272 µs) : 0, 765
Remote Config [candidate] (692.014 µs) : 0, 692
Telemetry [baseline] (9.245 ms) : 0, 9245
Telemetry [candidate] (9.118 ms) : 0, 9118
Flare Poller [baseline] (9.505 ms) : 0, 9505
Flare Poller [candidate] (10.226 ms) : 0, 10226
section appsec
crashtracking [baseline] (1.457 ms) : 0, 1457
crashtracking [candidate] (1.455 ms) : 0, 1455
BytebuddyAgent [baseline] (717.551 ms) : 0, 717551
BytebuddyAgent [candidate] (715.333 ms) : 0, 715333
GlobalTracer [baseline] (234.363 ms) : 0, 234363
GlobalTracer [candidate] (234.042 ms) : 0, 234042
IAST [baseline] (24.737 ms) : 0, 24737
IAST [candidate] (24.566 ms) : 0, 24566
AppSec [baseline] (176.45 ms) : 0, 176450
AppSec [candidate] (174.991 ms) : 0, 174991
Debugger [baseline] (6.098 ms) : 0, 6098
Debugger [candidate] (6.066 ms) : 0, 6066
Remote Config [baseline] (658.765 µs) : 0, 659
Remote Config [candidate] (643.689 µs) : 0, 644
Telemetry [baseline] (8.491 ms) : 0, 8491
Telemetry [candidate] (8.381 ms) : 0, 8381
Flare Poller [baseline] (3.95 ms) : 0, 3950
Flare Poller [candidate] (3.926 ms) : 0, 3926
section iast
crashtracking [baseline] (1.471 ms) : 0, 1471
crashtracking [candidate] (1.448 ms) : 0, 1448
BytebuddyAgent [baseline] (820.775 ms) : 0, 820775
BytebuddyAgent [candidate] (816.261 ms) : 0, 816261
GlobalTracer [baseline] (232.756 ms) : 0, 232756
GlobalTracer [candidate] (231.901 ms) : 0, 231901
IAST [baseline] (26.665 ms) : 0, 26665
IAST [candidate] (26.503 ms) : 0, 26503
AppSec [baseline] (35.893 ms) : 0, 35893
AppSec [candidate] (35.734 ms) : 0, 35734
Debugger [baseline] (6.195 ms) : 0, 6195
Debugger [candidate] (6.108 ms) : 0, 6108
Remote Config [baseline] (627.963 µs) : 0, 628
Remote Config [candidate] (601.279 µs) : 0, 601
Telemetry [baseline] (8.801 ms) : 0, 8801
Telemetry [candidate] (8.476 ms) : 0, 8476
Flare Poller [baseline] (4.239 ms) : 0, 4239
Flare Poller [candidate] (4.198 ms) : 0, 4198
section profiling
crashtracking [baseline] (1.43 ms) : 0, 1430
crashtracking [candidate] (1.448 ms) : 0, 1448
BytebuddyAgent [baseline] (721.275 ms) : 0, 721275
BytebuddyAgent [candidate] (723.274 ms) : 0, 723274
GlobalTracer [baseline] (217.291 ms) : 0, 217291
GlobalTracer [candidate] (218.324 ms) : 0, 218324
AppSec [baseline] (33.003 ms) : 0, 33003
AppSec [candidate] (33.363 ms) : 0, 33363
Debugger [baseline] (6.445 ms) : 0, 6445
Debugger [candidate] (6.506 ms) : 0, 6506
Remote Config [baseline] (701.98 µs) : 0, 702
Remote Config [candidate] (702.159 µs) : 0, 702
Telemetry [baseline] (16.804 ms) : 0, 16804
Telemetry [candidate] (16.646 ms) : 0, 16646
Flare Poller [baseline] (4.23 ms) : 0, 4230
Flare Poller [candidate] (4.264 ms) : 0, 4264
ProfilingAgent [baseline] (107.997 ms) : 0, 107997
ProfilingAgent [candidate] (108.043 ms) : 0, 108043
Profiling [baseline] (109.527 ms) : 0, 109527
Profiling [candidate] (109.584 ms) : 0, 109584
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 4 performance regressions! Performance is the same for 6 metrics, 12 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section baseline
no_agent (4.363 ms) : 4308, 4418
. : milestone, 4363,
iast (9.633 ms) : 9477, 9789
. : milestone, 9633,
iast_FULL (14.114 ms) : 13832, 14397
. : milestone, 14114,
iast_GLOBAL (10.323 ms) : 10143, 10503
. : milestone, 10323,
profiling (9.206 ms) : 9058, 9354
. : milestone, 9206,
tracing (8.069 ms) : 7937, 8200
. : milestone, 8069,
section candidate
no_agent (4.291 ms) : 4237, 4345
. : milestone, 4291,
iast (9.59 ms) : 9427, 9753
. : milestone, 9590,
iast_FULL (14.072 ms) : 13784, 14360
. : milestone, 14072,
iast_GLOBAL (10.923 ms) : 10730, 11116
. : milestone, 10923,
profiling (8.724 ms) : 8584, 8865
. : milestone, 8724,
tracing (7.83 ms) : 7717, 7944
. : milestone, 7830,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section baseline
no_agent (36.441 ms) : 36151, 36731
. : milestone, 36441,
appsec (46.753 ms) : 46337, 47170
. : milestone, 46753,
code_origins (45.12 ms) : 44717, 45523
. : milestone, 45120,
iast (44.972 ms) : 44594, 45349
. : milestone, 44972,
profiling (48.103 ms) : 47632, 48574
. : milestone, 48103,
tracing (45.09 ms) : 44699, 45482
. : milestone, 45090,
section candidate
no_agent (38.738 ms) : 38428, 39047
. : milestone, 38738,
appsec (48.273 ms) : 47849, 48696
. : milestone, 48273,
code_origins (44.093 ms) : 43709, 44476
. : milestone, 44093,
iast (43.698 ms) : 43324, 44072
. : milestone, 43698,
profiling (50.201 ms) : 49712, 50690
. : milestone, 50201,
tracing (42.128 ms) : 41768, 42488
. : milestone, 42128,
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.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section baseline
no_agent (14.937 s) : 14937000, 14937000
. : milestone, 14937000,
appsec (15.019 s) : 15019000, 15019000
. : milestone, 15019000,
iast (18.595 s) : 18595000, 18595000
. : milestone, 18595000,
iast_GLOBAL (18.066 s) : 18066000, 18066000
. : milestone, 18066000,
profiling (14.982 s) : 14982000, 14982000
. : milestone, 14982000,
tracing (15.071 s) : 15071000, 15071000
. : milestone, 15071000,
section candidate
no_agent (14.916 s) : 14916000, 14916000
. : milestone, 14916000,
appsec (15.263 s) : 15263000, 15263000
. : milestone, 15263000,
iast (18.491 s) : 18491000, 18491000
. : milestone, 18491000,
iast_GLOBAL (18.184 s) : 18184000, 18184000
. : milestone, 18184000,
profiling (15.03 s) : 15030000, 15030000
. : milestone, 15030000,
tracing (15.149 s) : 15149000, 15149000
. : milestone, 15149000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~7c5a0652b5, baseline=1.55.0-SNAPSHOT~60a3b9d880
dateFormat X
axisFormat %s
section baseline
no_agent (1.489 ms) : 1477, 1501
. : milestone, 1489,
appsec (3.742 ms) : 3523, 3960
. : milestone, 3742,
iast (2.226 ms) : 2162, 2290
. : milestone, 2226,
iast_GLOBAL (2.262 ms) : 2198, 2326
. : milestone, 2262,
profiling (2.507 ms) : 2340, 2675
. : milestone, 2507,
tracing (2.038 ms) : 1988, 2087
. : milestone, 2038,
section candidate
no_agent (1.474 ms) : 1462, 1486
. : milestone, 1474,
appsec (3.695 ms) : 3481, 3908
. : milestone, 3695,
iast (2.207 ms) : 2144, 2271
. : milestone, 2207,
iast_GLOBAL (2.271 ms) : 2207, 2335
. : milestone, 2271,
profiling (2.086 ms) : 2033, 2139
. : milestone, 2086,
tracing (2.039 ms) : 1990, 2089
. : milestone, 2039,
|
61f2c07
to
e60ce1a
Compare
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/log/UnionMap.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@SuppressWarnings({"unchecked"}) | ||
public static <K, V> UnionMap<K, V> create(Map<K, V> primaryMap, Map<K, V> secondaryMap) { |
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.
I think I'd prefer some other name than create, but I'm not sure what that would be.
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.
I changed to obtain
. It looks not so bad for this kind of action
5a47b6f
to
4fb3661
Compare
private Map<K, V> secondaryMap; | ||
private transient Set<Map.Entry<K, V>> entrySet; | ||
private transient volatile boolean deduped; | ||
private static final ThreadLocal<UnionMap<?, ?>> TL = ThreadLocal.withInitial(UnionMap::new); |
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.
question: Is there a common topic with thread local span builders and virtual thread, i.e. should this avoid creating a threadlocal as well with VT. If so shall we extract a "common piece" to handle that.
cc @dougqh.
What Does This Do
UnionMaps are used to provide a multimap view backed on original logger's mdc.
The mdc is used to be bound to a thread locality. In recent heap dumps I noticed that we largely allocate instances of this class. Specifically wrt MDC, those objects can be pooled
Motivation
Additional Notes
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]