Skip to content

DSM optimizations - major refactoring to get rid of LinkedHashMap #9151

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

kr-igor
Copy link
Contributor

@kr-igor kr-igor commented Jul 10, 2025

This change is aimed to reduce DSM overhead by using a lightweight object instead of linked maps.

Introduced DataStreamsTags and DataStreamsTagsBuild which are now used instead of LinkedHashMap.
Updated all integrations and tests.

My tests show ~10% throughput increase with a significant latency decrease without increasing CPU load.
screenshot_2025-07-11_at_5 58 34___pm

@pr-commenter
Copy link

pr-commenter bot commented Jul 11, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master kr-igor/dsm-optimization-v2
git_commit_date 1752513413 1752533003
git_commit_sha 562e533 47b6142
release_version 1.52.0-SNAPSHOT~562e53388e 1.52.0-SNAPSHOT~47b6142f95
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752534816 1752534816
ci_job_id 1028236859 1028236859
ci_pipeline_id 70524996 70524996
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-b2us2st7 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-b2us2st7 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 42 metrics, 11 unstable metrics.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (995.015 ms) : 0, 995015
Total [baseline] (10.609 s) : 0, 10609332
Agent [candidate] (996.85 ms) : 0, 996850
Total [candidate] (10.665 s) : 0, 10664710
section appsec
Agent [baseline] (1.179 s) : 0, 1178843
Total [baseline] (10.776 s) : 0, 10775554
Agent [candidate] (1.177 s) : 0, 1177083
Total [candidate] (10.762 s) : 0, 10762237
section iast
Agent [baseline] (1.129 s) : 0, 1129038
Total [baseline] (10.824 s) : 0, 10823702
Agent [candidate] (1.129 s) : 0, 1129323
Total [candidate] (10.783 s) : 0, 10783351
section profiling
Agent [baseline] (1.242 s) : 0, 1241514
Total [baseline] (11.048 s) : 0, 11048021
Agent [candidate] (1.244 s) : 0, 1243554
Total [candidate] (10.997 s) : 0, 10997233
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 995.015 ms -
Agent appsec 1.179 s 183.828 ms (18.5%)
Agent iast 1.129 s 134.023 ms (13.5%)
Agent profiling 1.242 s 246.499 ms (24.8%)
Total tracing 10.609 s -
Total appsec 10.776 s 166.221 ms (1.6%)
Total iast 10.824 s 214.37 ms (2.0%)
Total profiling 11.048 s 438.689 ms (4.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 996.85 ms -
Agent appsec 1.177 s 180.232 ms (18.1%)
Agent iast 1.129 s 132.472 ms (13.3%)
Agent profiling 1.244 s 246.703 ms (24.7%)
Total tracing 10.665 s -
Total appsec 10.762 s 97.526 ms (0.9%)
Total iast 10.783 s 118.641 ms (1.1%)
Total profiling 10.997 s 332.523 ms (3.1%)
gantt
    title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (686.409 ms) : 0, 686409
BytebuddyAgent [candidate] (687.548 ms) : 0, 687548
GlobalTracer [baseline] (242.397 ms) : 0, 242397
GlobalTracer [candidate] (242.896 ms) : 0, 242896
AppSec [baseline] (30.362 ms) : 0, 30362
AppSec [candidate] (30.502 ms) : 0, 30502
Debugger [baseline] (5.975 ms) : 0, 5975
Debugger [candidate] (6.068 ms) : 0, 6068
Remote Config [baseline] (673.195 µs) : 0, 673
Remote Config [candidate] (685.373 µs) : 0, 685
Telemetry [baseline] (8.253 ms) : 0, 8253
Telemetry [candidate] (8.253 ms) : 0, 8253
section appsec
BytebuddyAgent [baseline] (711.964 ms) : 0, 711964
BytebuddyAgent [candidate] (711.35 ms) : 0, 711350
GlobalTracer [baseline] (235.945 ms) : 0, 235945
GlobalTracer [candidate] (235.781 ms) : 0, 235781
AppSec [baseline] (171.974 ms) : 0, 171974
AppSec [candidate] (170.955 ms) : 0, 170955
Debugger [baseline] (5.778 ms) : 0, 5778
Debugger [candidate] (5.736 ms) : 0, 5736
Remote Config [baseline] (607.839 µs) : 0, 608
Remote Config [candidate] (602.626 µs) : 0, 603
Telemetry [baseline] (8.063 ms) : 0, 8063
Telemetry [candidate] (8.034 ms) : 0, 8034
IAST [baseline] (23.573 ms) : 0, 23573
IAST [candidate] (23.702 ms) : 0, 23702
section iast
BytebuddyAgent [baseline] (804.377 ms) : 0, 804377
BytebuddyAgent [candidate] (804.002 ms) : 0, 804002
GlobalTracer [baseline] (232.039 ms) : 0, 232039
GlobalTracer [candidate] (232.686 ms) : 0, 232686
AppSec [baseline] (31.135 ms) : 0, 31135
AppSec [candidate] (30.409 ms) : 0, 30409
Debugger [baseline] (6.656 ms) : 0, 6656
Debugger [candidate] (6.581 ms) : 0, 6581
Remote Config [baseline] (576.643 µs) : 0, 577
Remote Config [candidate] (587.16 µs) : 0, 587
Telemetry [baseline] (7.876 ms) : 0, 7876
Telemetry [candidate] (7.875 ms) : 0, 7875
IAST [baseline] (25.631 ms) : 0, 25631
IAST [candidate] (26.42 ms) : 0, 26420
section profiling
BytebuddyAgent [baseline] (675.953 ms) : 0, 675953
BytebuddyAgent [candidate] (676.843 ms) : 0, 676843
GlobalTracer [baseline] (361.181 ms) : 0, 361181
GlobalTracer [candidate] (361.688 ms) : 0, 361688
AppSec [baseline] (33.111 ms) : 0, 33111
AppSec [candidate] (32.48 ms) : 0, 32480
Debugger [baseline] (9.128 ms) : 0, 9128
Debugger [candidate] (11.265 ms) : 0, 11265
Remote Config [baseline] (655.075 µs) : 0, 655
Remote Config [candidate] (669.58 µs) : 0, 670
Telemetry [baseline] (9.469 ms) : 0, 9469
Telemetry [candidate] (8.697 ms) : 0, 8697
ProfilingAgent [baseline] (102.746 ms) : 0, 102746
ProfilingAgent [candidate] (103.21 ms) : 0, 103210
Profiling [baseline] (102.771 ms) : 0, 102771
Profiling [candidate] (103.234 ms) : 0, 103234
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.011 s) : 0, 1010532
Total [baseline] (8.575 s) : 0, 8575015
Agent [candidate] (994.973 ms) : 0, 994973
Total [candidate] (8.565 s) : 0, 8565277
section iast
Agent [baseline] (1.128 s) : 0, 1127716
Total [baseline] (9.305 s) : 0, 9305301
Agent [candidate] (1.13 s) : 0, 1130058
Total [candidate] (9.327 s) : 0, 9326868
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.011 s -
Agent iast 1.128 s 117.184 ms (11.6%)
Total tracing 8.575 s -
Total iast 9.305 s 730.286 ms (8.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 994.973 ms -
Agent iast 1.13 s 135.085 ms (13.6%)
Total tracing 8.565 s -
Total iast 9.327 s 761.591 ms (8.9%)
gantt
    title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (699.096 ms) : 0, 699096
BytebuddyAgent [candidate] (686.619 ms) : 0, 686619
GlobalTracer [baseline] (244.544 ms) : 0, 244544
GlobalTracer [candidate] (242.357 ms) : 0, 242357
AppSec [baseline] (30.722 ms) : 0, 30722
AppSec [candidate] (30.4 ms) : 0, 30400
Debugger [baseline] (6.013 ms) : 0, 6013
Debugger [candidate] (5.995 ms) : 0, 5995
Remote Config [baseline] (698.375 µs) : 0, 698
Remote Config [candidate] (685.15 µs) : 0, 685
Telemetry [baseline] (8.392 ms) : 0, 8392
Telemetry [candidate] (8.204 ms) : 0, 8204
section iast
BytebuddyAgent [baseline] (803.35 ms) : 0, 803350
BytebuddyAgent [candidate] (805.055 ms) : 0, 805055
GlobalTracer [baseline] (231.652 ms) : 0, 231652
GlobalTracer [candidate] (232.759 ms) : 0, 232759
AppSec [baseline] (28.168 ms) : 0, 28168
AppSec [candidate] (29.416 ms) : 0, 29416
Debugger [baseline] (6.526 ms) : 0, 6526
Debugger [candidate] (6.578 ms) : 0, 6578
Remote Config [baseline] (576.812 µs) : 0, 577
Remote Config [candidate] (575.23 µs) : 0, 575
Telemetry [baseline] (7.905 ms) : 0, 7905
Telemetry [candidate] (7.91 ms) : 0, 7910
IAST [baseline] (28.886 ms) : 0, 28886
IAST [candidate] (27.128 ms) : 0, 27128
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master kr-igor/dsm-optimization-v2
git_commit_date 1752513413 1752533003
git_commit_sha 562e533 47b6142
release_version 1.52.0-SNAPSHOT~562e53388e 1.52.0-SNAPSHOT~47b6142f95
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752534502 1752534502
ci_job_id 1028236860 1028236860
ci_pipeline_id 70524996 70524996
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-sr99155c 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-sr99155c 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 2 performance improvements and 3 performance regressions! Performance is the same for 7 metrics, 12 unstable metrics.

scenario Δ mean http_req_duration Δ mean throughput candidate mean http_req_duration candidate mean throughput baseline mean http_req_duration baseline mean throughput
scenario:load:insecure-bank:no_agent:high_load worse
[+87.417µs; +198.028µs] or [+2.074%; +4.699%]
unstable
[-145.406op/s; +75.656op/s] or [-13.359%; +6.951%]
4.357ms 1053.562op/s 4.214ms 1088.438op/s
scenario:load:insecure-bank:iast_GLOBAL:high_load better
[-644.329µs; -259.591µs] or [-6.208%; -2.501%]
unstable
[-29.786op/s; +69.911op/s] or [-6.651%; +15.611%]
9.927ms 467.906op/s 10.379ms 447.844op/s
scenario:load:petclinic:iast:high_load worse
[+1.332ms; +2.188ms] or [+3.034%; +4.985%]
unstable
[-11.590op/s; +3.365op/s] or [-10.876%; +3.158%]
45.665ms 102.450op/s 43.905ms 106.562op/s
scenario:load:petclinic:appsec:high_load worse
[+2.602ms; +3.552ms] or [+5.590%; +7.631%]
unstable
[-13.491op/s; +1.041op/s] or [-13.417%; +1.036%]
49.623ms 94.325op/s 46.546ms 100.550op/s
scenario:load:petclinic:profiling:high_load better
[-2.187ms; -1.202ms] or [-4.386%; -2.411%]
unstable
[-3.720op/s; +10.345op/s] or [-3.963%; +11.020%]
48.159ms 97.188op/s 49.853ms 93.875op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e
    dateFormat X
    axisFormat %s
section baseline
no_agent (37.098 ms) : 36799, 37397
.   : milestone, 37098,
appsec (46.546 ms) : 46112, 46980
.   : milestone, 46546,
code_origins (43.925 ms) : 43548, 44301
.   : milestone, 43925,
iast (43.905 ms) : 43513, 44298
.   : milestone, 43905,
profiling (49.853 ms) : 49401, 50306
.   : milestone, 49853,
tracing (43.615 ms) : 43261, 43969
.   : milestone, 43615,
section candidate
no_agent (36.235 ms) : 35945, 36525
.   : milestone, 36235,
appsec (49.623 ms) : 49174, 50072
.   : milestone, 49623,
code_origins (44.648 ms) : 44262, 45034
.   : milestone, 44648,
iast (45.665 ms) : 45262, 46069
.   : milestone, 45665,
profiling (48.159 ms) : 47696, 48621
.   : milestone, 48159,
tracing (44.294 ms) : 43929, 44659
.   : milestone, 44294,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.098 ms [36.799 ms, 37.397 ms] -
appsec 46.546 ms [46.112 ms, 46.98 ms] 9.449 ms (25.5%)
code_origins 43.925 ms [43.548 ms, 44.301 ms] 6.827 ms (18.4%)
iast 43.905 ms [43.513 ms, 44.298 ms] 6.808 ms (18.4%)
profiling 49.853 ms [49.401 ms, 50.306 ms] 12.756 ms (34.4%)
tracing 43.615 ms [43.261 ms, 43.969 ms] 6.517 ms (17.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.235 ms [35.945 ms, 36.525 ms] -
appsec 49.623 ms [49.174 ms, 50.072 ms] 13.388 ms (36.9%)
code_origins 44.648 ms [44.262 ms, 45.034 ms] 8.412 ms (23.2%)
iast 45.665 ms [45.262 ms, 46.069 ms] 9.43 ms (26.0%)
profiling 48.159 ms [47.696 ms, 48.621 ms] 11.924 ms (32.9%)
tracing 44.294 ms [43.929 ms, 44.659 ms] 8.059 ms (22.2%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.214 ms) : 4163, 4265
.   : milestone, 4214,
iast (9.14 ms) : 8991, 9289
.   : milestone, 9140,
iast_FULL (13.644 ms) : 13374, 13914
.   : milestone, 13644,
iast_GLOBAL (10.379 ms) : 10194, 10565
.   : milestone, 10379,
profiling (8.585 ms) : 8453, 8717
.   : milestone, 8585,
tracing (7.817 ms) : 7706, 7927
.   : milestone, 7817,
section candidate
no_agent (4.357 ms) : 4305, 4409
.   : milestone, 4357,
iast (9.184 ms) : 9032, 9335
.   : milestone, 9184,
iast_FULL (13.792 ms) : 13519, 14065
.   : milestone, 13792,
iast_GLOBAL (9.927 ms) : 9755, 10099
.   : milestone, 9927,
profiling (8.679 ms) : 8543, 8815
.   : milestone, 8679,
tracing (7.647 ms) : 7537, 7757
.   : milestone, 7647,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.214 ms [4.163 ms, 4.265 ms] -
iast 9.14 ms [8.991 ms, 9.289 ms] 4.926 ms (116.9%)
iast_FULL 13.644 ms [13.374 ms, 13.914 ms] 9.43 ms (223.8%)
iast_GLOBAL 10.379 ms [10.194 ms, 10.565 ms] 6.165 ms (146.3%)
profiling 8.585 ms [8.453 ms, 8.717 ms] 4.371 ms (103.7%)
tracing 7.817 ms [7.706 ms, 7.927 ms] 3.602 ms (85.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.357 ms [4.305 ms, 4.409 ms] -
iast 9.184 ms [9.032 ms, 9.335 ms] 4.827 ms (110.8%)
iast_FULL 13.792 ms [13.519 ms, 14.065 ms] 9.435 ms (216.6%)
iast_GLOBAL 9.927 ms [9.755 ms, 10.099 ms] 5.57 ms (127.9%)
profiling 8.679 ms [8.543 ms, 8.815 ms] 4.322 ms (99.2%)
tracing 7.647 ms [7.537 ms, 7.757 ms] 3.29 ms (75.5%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master kr-igor/dsm-optimization-v2
git_commit_date 1752513413 1752533003
git_commit_sha 562e533 47b6142
release_version 1.52.0-SNAPSHOT~562e53388e 1.52.0-SNAPSHOT~47b6142f95
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1752535044 1752535044
ci_job_id 1028236861 1028236861
ci_pipeline_id 70524996 70524996
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-uscnqx6r 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-uscnqx6r 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.471 ms) : 1459, 1482
.   : milestone, 1471,
appsec (2.417 ms) : 2366, 2467
.   : milestone, 2417,
iast (2.193 ms) : 2131, 2256
.   : milestone, 2193,
iast_GLOBAL (2.251 ms) : 2187, 2315
.   : milestone, 2251,
profiling (2.057 ms) : 2005, 2109
.   : milestone, 2057,
tracing (2.023 ms) : 1974, 2072
.   : milestone, 2023,
section candidate
no_agent (1.474 ms) : 1462, 1485
.   : milestone, 1474,
appsec (2.411 ms) : 2361, 2461
.   : milestone, 2411,
iast (2.191 ms) : 2128, 2254
.   : milestone, 2191,
iast_GLOBAL (2.236 ms) : 2173, 2300
.   : milestone, 2236,
profiling (2.068 ms) : 2015, 2121
.   : milestone, 2068,
tracing (2.009 ms) : 1960, 2058
.   : milestone, 2009,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.471 ms [1.459 ms, 1.482 ms] -
appsec 2.417 ms [2.366 ms, 2.467 ms] 946.176 µs (64.3%)
iast 2.193 ms [2.131 ms, 2.256 ms] 722.555 µs (49.1%)
iast_GLOBAL 2.251 ms [2.187 ms, 2.315 ms] 780.034 µs (53.0%)
profiling 2.057 ms [2.005 ms, 2.109 ms] 586.605 µs (39.9%)
tracing 2.023 ms [1.974 ms, 2.072 ms] 552.015 µs (37.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.474 ms [1.462 ms, 1.485 ms] -
appsec 2.411 ms [2.361 ms, 2.461 ms] 937.1 µs (63.6%)
iast 2.191 ms [2.128 ms, 2.254 ms] 717.379 µs (48.7%)
iast_GLOBAL 2.236 ms [2.173 ms, 2.3 ms] 762.42 µs (51.7%)
profiling 2.068 ms [2.015 ms, 2.121 ms] 594.198 µs (40.3%)
tracing 2.009 ms [1.96 ms, 2.058 ms] 535.407 µs (36.3%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~47b6142f95, baseline=1.52.0-SNAPSHOT~562e53388e
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.95 s) : 14950000, 14950000
.   : milestone, 14950000,
appsec (14.774 s) : 14774000, 14774000
.   : milestone, 14774000,
iast (18.553 s) : 18553000, 18553000
.   : milestone, 18553000,
iast_GLOBAL (18.026 s) : 18026000, 18026000
.   : milestone, 18026000,
profiling (15.585 s) : 15585000, 15585000
.   : milestone, 15585000,
tracing (14.931 s) : 14931000, 14931000
.   : milestone, 14931000,
section candidate
no_agent (15.493 s) : 15493000, 15493000
.   : milestone, 15493000,
appsec (14.7 s) : 14700000, 14700000
.   : milestone, 14700000,
iast (18.531 s) : 18531000, 18531000
.   : milestone, 18531000,
iast_GLOBAL (17.952 s) : 17952000, 17952000
.   : milestone, 17952000,
profiling (15.23 s) : 15230000, 15230000
.   : milestone, 15230000,
tracing (14.995 s) : 14995000, 14995000
.   : milestone, 14995000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.95 s [14.95 s, 14.95 s] -
appsec 14.774 s [14.774 s, 14.774 s] -176.0 ms (-1.2%)
iast 18.553 s [18.553 s, 18.553 s] 3.603 s (24.1%)
iast_GLOBAL 18.026 s [18.026 s, 18.026 s] 3.076 s (20.6%)
profiling 15.585 s [15.585 s, 15.585 s] 635.0 ms (4.2%)
tracing 14.931 s [14.931 s, 14.931 s] -19.0 ms (-0.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.493 s [15.493 s, 15.493 s] -
appsec 14.7 s [14.7 s, 14.7 s] -793.0 ms (-5.1%)
iast 18.531 s [18.531 s, 18.531 s] 3.038 s (19.6%)
iast_GLOBAL 17.952 s [17.952 s, 17.952 s] 2.459 s (15.9%)
profiling 15.23 s [15.23 s, 15.23 s] -263.0 ms (-1.7%)
tracing 14.995 s [14.995 s, 14.995 s] -498.0 ms (-3.2%)

@pr-commenter
Copy link

pr-commenter bot commented Jul 11, 2025

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master kr-igor/dsm-optimization-v2
git_commit_date 1752513413 1752533003
git_commit_sha 562e533 47b6142
See matching parameters
Baseline Candidate
ci_job_date 1752534066 1752534066
ci_job_id 1028236864 1028236864
ci_pipeline_id 70524996 70524996
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProduce unsure
[-61123.754op/s; -1404.976op/s] or [-3.339%; -0.077%]
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@kr-igor kr-igor marked this pull request as ready for review July 11, 2025 22:53
@kr-igor kr-igor requested review from a team as code owners July 11, 2025 22:53
@kr-igor kr-igor requested a review from smola July 11, 2025 22:53
Copy link
Contributor

github-actions bot commented Jul 11, 2025

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@pr-commenter
Copy link

pr-commenter bot commented Jul 11, 2025

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master kr-igor/dsm-optimization-v2
git_commit_date 1752513413 1752533003
git_commit_sha 562e533 47b6142
See matching parameters
Baseline Candidate
ci_job_date 1752534099 1752534099
ci_job_id 1028236865 1028236865
ci_pipeline_id 70524996 70524996
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 1 performance regressions! Performance is the same for 2 metrics, 0 unstable metrics.

scenario Δ mean throughput
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume worse
[-11959.916op/s; -3962.056op/s] or [-3.762%; -1.246%]
See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

result.put(DIRECTION_TAG, DIRECTION_OUT);
result.put(TYPE_TAG, "grpc");
return DataStreamsContext.fromTags(result);
return DataStreamsContext.fromTags(
Copy link
Contributor

@dougqh dougqh Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid builder idioms in the critical path. That's still extra allocation that we really don't need.


public DataStreamsTags(DataStreamsTagsBuilder builder) {
this.builder = builder;
this.size =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is introducing a capturing lambda. I think a regular loop would probably be better here.

Comment on lines 93 to 102
processor.process(BUS_TAG, this.builder.bus);
count += 1;
}

if (this.builder.direction == Direction.Inbound) {
count += 1;
processor.process(DIRECTION_TAG, DIRECTION_IN);
} else if (this.builder.direction == Direction.Outbound) {
count += 1;
processor.process(DIRECTION_TAG, DIRECTION_OUT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Just a matter of taste, but probably count++; Would be a better option (here and other similar places)?

Comment on lines 286 to 299
+ ","
+ ", kafkaClusterId='"
+ this.builder.kafkaClusterId
+ ","
+ ", partition='"
+ this.builder.partition
+ ","
+ ", hash="
+ hash
+ ","
+ ", aggregationHash="
+ aggregationHash
+ ","
+ ", size="
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code will produce String with TWO commas. Is that expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right... AI autosuggest :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :), just FYI IDEA has toString() method generation too,

result.put(TYPE_TAG, "grpc");
return result;
private static final DataStreamsTags createServerPathwaySortedTags() {
return new DataStreamsTagsBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can probably still keep these pretty clean without needing a builder. I've put suggestions throughout...

  • createGrpcInbound() <-- bonus, that's cacheable

DataStreamsContext dsmContext = DataStreamsContext.fromTags(getTags(eventBusName));
DataStreamsTags tags =
new DataStreamsTagsBuilder()
.withDirection(DataStreamsTags.Direction.Outbound)
Copy link
Contributor

@dougqh dougqh Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createBusOutbound(eventBusName)

sortedTags.put(TagsProcessor.TOPIC_TAG, bucket);
sortedTags.put(TagsProcessor.TYPE_TAG, "s3");
DataStreamsTags tags =
new DataStreamsTagsBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createS3Outbound(bucket, key)

sortedTags.put(TYPE_TAG, "kinesis");
DataStreamsTags tags =
new DataStreamsTagsBuilder()
.withType("kinesis")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createKinesisInbound(streamArn)


return sortedTags;
private DataStreamsTags getTags(String snsTopicName) {
return new DataStreamsTagsBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createSnsOutbound(snsTopicName)

Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're in refactoring mode, can you have a look (made in another PR if it's easier) to complete the context refactoring?

In short, PathwayContext should not be stored in span data model (DDSpanContext).
Instead, it must be stored with Context as DataStreamsContext and AgentSpan.
You may create a second Context entry if the DataStreamsContext holds different kind of data (or have a different lifecycle) than what PathwayContext should hold.

I already done some refactoring (adding DataStreamsContext, creating a dedicated DSM propagator) but it miss the last step of moving away PathwayContext from span.
Would that be something you could have a look at? Would you like us to pair on this task? The end goal would be to decouple Tracing from DSM. So you can save even more resources.

@@ -89,7 +85,9 @@ private String getTraceContextToInject(
// Inject context
datadog.context.Context context = span;
if (traceConfig().isDataStreamsEnabled()) {
DataStreamsContext dsmContext = DataStreamsContext.fromTags(getTags(eventBusName));
DataStreamsTags tags =
DataStreamsTags.createWithBus("bus", DataStreamsTags.Direction.Outbound, eventBusName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pass "bus" as argument to withBus helper? Is there a case where the value isn't "bus"?

private long completeHash;
private int nonNullSize;

// hash tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably be final
Right now, strictly speaking this probably isn't thread safe

kafkaClusterId != null ? KAFKA_CLUSTER_ID_TAG + ":" + kafkaClusterId : null;
this.partition = partition != null ? PARTITION_TAG + ":" + partition : null;

// hashable tags are 0-4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that should unroll and inline nicely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants