dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

Incorporating TagMap into the tracer

Open dougqh opened this issue 8 months ago • 6 comments
trafficstars

This change reduces the overhead from constructing spans both in terms of CPU and memory.

The biggest gains come when making use of SpanBuilders for both constructing the span and manipulating the tags on the Span. Span creation throughput with SpanBuilders improves by as much as 45%. startSpan methods commonly used in instrumentations improve by around 20%. In applications, real median response time gains are around to 5-10%.

More importantly, these changes reduce the amount of memory consumed by each Span reducing allocation / garbage collection pressure.

In a "real" application, the change is less noticeable when memory is plentiful; however, the difference becomes more pronounced when memory is limited. spring-petclinic shows a 17% throughput improvement relative to the current release when memory is constrained to 192M or 128M. At 96M, the difference is negligible 2-3% gain throughput. At 64M, this change becomes a detriment showing a -5% change in throughput.

What Does This Do

These gains are accomplished by changing how tags are stored to use a new Map (TagMap) that excels at Map-to-Map copies. To fully realize the gain, there's additional work to skip tag interceptors when possible. With these changes, the setting of the shared tags on a Span-s is nearly allocation free.

Motivation

The tracer does some Map operations regularly that regular HashMaps aren't good at.

The primary operation of concern being copying Entry-s from Map to Map where every copied Entry requires allocating a new Entry object in the destination Map.

And secondarily, Builder patterns which use defensive copying but also require in-order processing in the Tracer.

TagMap solves both those problems by using immutable Entry objects. By making the Entry objects immutable, the Entry objects can be freely shared between Map instances and between the Builder and a Map.

Additional Notes

To get the full benefit of this new TagMap, both the source Map and the destination Map need to be TagMap-s and the transfer needs to happen through putAll or the TagMap specific putEntry.

Meaning - that to get a significant gain quite a few files had to be modified

Contributor Checklist

dougqh avatar Mar 19 '25 17:03 dougqh

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1752588642 1752588987
end_time 2025-07-15T14:12:03 2025-07-15T14:17:48
git_branch master dougqh/interceptor-bypass
git_commit_sha b86f4f70d6 148117965e6b3832a810656c9585ca84fd713afd
start_time 2025-07-15T14:10:43 2025-07-15T14:16:28
See matching parameters
Baseline Candidate
ci_job_id 1029219562 1029219562
ci_pipeline_id 70581072 70581072
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1752587968 1752587968

Summary

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

See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-25.473µs; +41.258µs] or [-9.177%; +14.864%]
unstable
[-35.723µs; +56.598µs] or [-11.235%; +17.800%]
unstable
[-45.848µs; +68.842µs] or [-13.767%; +20.671%]
unstable
[-161.049µs; +176.714µs] or [-16.448%; +18.047%]
unstable
[-129.317op/s; +129.342op/s] or [-5.237%; +5.238%]
scenario:basic same same same unstable
[-125.007µs; +31.564µs] or [-16.533%; +4.175%]
unstable
[-241.311op/s; +99.064op/s] or [-8.929%; +3.665%]
scenario:loop same unsure
[-11.660µs; -1.259µs] or [-0.130%; -0.014%]
unsure
[-13.736µs; -2.288µs] or [-0.152%; -0.025%]
same same
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (317.967 µs) : 284, 352
.   : milestone, 318,
basic (276.316 µs) : 270, 283
.   : milestone, 276,
loop (8.965 ms) : 8960, 8969
.   : milestone, 8965,
section candidate
noprobe (328.404 µs) : 276, 381
.   : milestone, 328,
basic (278.719 µs) : 273, 285
.   : milestone, 279,
loop (8.958 ms) : 8953, 8963
.   : milestone, 8958,
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 317.967 µs [284.248 µs, 351.686 µs]
basic 276.316 µs [269.621 µs, 283.011 µs]
loop 8.965 ms [8.96 ms, 8.969 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 328.404 µs [276.201 µs, 380.607 µs]
basic 278.719 µs [272.658 µs, 284.78 µs]
loop 8.958 ms [8.953 ms, 8.963 ms]

pr-commenter[bot] avatar Mar 19 '25 21:03 pr-commenter[bot]

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master dougqh/interceptor-bypass
git_commit_date 1752586391 1752587968
git_commit_sha b86f4f70d6 148117965e
release_version 1.52.0-SNAPSHOT~b86f4f70d6 1.52.0-SNAPSHOT~148117965e
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752589838 1752589838
ci_job_id 1029219546 1029219546
ci_pipeline_id 70581072 70581072
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-4sy9e9e9 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-4sy9e9e9 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 46 metrics, 7 unstable metrics.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.0 s) : 0, 1000399
Total [baseline] (10.685 s) : 0, 10684993
Agent [candidate] (997.628 ms) : 0, 997628
Total [candidate] (10.679 s) : 0, 10678576
section appsec
Agent [baseline] (1.174 s) : 0, 1173501
Total [baseline] (10.749 s) : 0, 10748782
Agent [candidate] (1.175 s) : 0, 1175281
Total [candidate] (10.79 s) : 0, 10789701
section iast
Agent [baseline] (1.131 s) : 0, 1130723
Total [baseline] (10.885 s) : 0, 10884576
Agent [candidate] (1.135 s) : 0, 1134691
Total [candidate] (10.888 s) : 0, 10888315
section profiling
Agent [baseline] (1.248 s) : 0, 1247670
Total [baseline] (10.96 s) : 0, 10960360
Agent [candidate] (1.256 s) : 0, 1255825
Total [candidate] (10.945 s) : 0, 10945382
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.0 s -
Agent appsec 1.174 s 173.102 ms (17.3%)
Agent iast 1.131 s 130.324 ms (13.0%)
Agent profiling 1.248 s 247.272 ms (24.7%)
Total tracing 10.685 s -
Total appsec 10.749 s 63.789 ms (0.6%)
Total iast 10.885 s 199.583 ms (1.9%)
Total profiling 10.96 s 275.367 ms (2.6%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 997.628 ms -
Agent appsec 1.175 s 177.653 ms (17.8%)
Agent iast 1.135 s 137.063 ms (13.7%)
Agent profiling 1.256 s 258.197 ms (25.9%)
Total tracing 10.679 s -
Total appsec 10.79 s 111.126 ms (1.0%)
Total iast 10.888 s 209.74 ms (2.0%)
Total profiling 10.945 s 266.806 ms (2.5%)
gantt
    title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (690.215 ms) : 0, 690215
BytebuddyAgent [candidate] (687.238 ms) : 0, 687238
GlobalTracer [baseline] (243.55 ms) : 0, 243550
GlobalTracer [candidate] (243.831 ms) : 0, 243831
AppSec [baseline] (30.623 ms) : 0, 30623
AppSec [candidate] (30.684 ms) : 0, 30684
Debugger [baseline] (6.073 ms) : 0, 6073
Debugger [candidate] (6.038 ms) : 0, 6038
Remote Config [baseline] (677.245 µs) : 0, 677
Remote Config [candidate] (680.364 µs) : 0, 680
Telemetry [baseline] (8.262 ms) : 0, 8262
Telemetry [candidate] (8.196 ms) : 0, 8196
section appsec
BytebuddyAgent [baseline] (708.53 ms) : 0, 708530
BytebuddyAgent [candidate] (708.455 ms) : 0, 708455
GlobalTracer [baseline] (235.353 ms) : 0, 235353
GlobalTracer [candidate] (236.826 ms) : 0, 236826
IAST [baseline] (23.457 ms) : 0, 23457
IAST [candidate] (23.407 ms) : 0, 23407
AppSec [baseline] (170.982 ms) : 0, 170982
AppSec [candidate] (171.378 ms) : 0, 171378
Debugger [baseline] (5.707 ms) : 0, 5707
Debugger [candidate] (5.756 ms) : 0, 5756
Remote Config [baseline] (594.017 µs) : 0, 594
Remote Config [candidate] (603.263 µs) : 0, 603
Telemetry [baseline] (7.956 ms) : 0, 7956
Telemetry [candidate] (8.049 ms) : 0, 8049
section iast
BytebuddyAgent [baseline] (805.287 ms) : 0, 805287
BytebuddyAgent [candidate] (806.812 ms) : 0, 806812
GlobalTracer [baseline] (232.524 ms) : 0, 232524
GlobalTracer [candidate] (234.683 ms) : 0, 234683
IAST [baseline] (26.495 ms) : 0, 26495
IAST [candidate] (29.091 ms) : 0, 29091
AppSec [baseline] (31.349 ms) : 0, 31349
AppSec [candidate] (28.951 ms) : 0, 28951
Debugger [baseline] (5.69 ms) : 0, 5690
Debugger [candidate] (5.742 ms) : 0, 5742
Remote Config [baseline] (577.435 µs) : 0, 577
Remote Config [candidate] (579.008 µs) : 0, 579
Telemetry [baseline] (7.904 ms) : 0, 7904
Telemetry [candidate] (7.934 ms) : 0, 7934
section profiling
BytebuddyAgent [baseline] (678.856 ms) : 0, 678856
BytebuddyAgent [candidate] (682.998 ms) : 0, 682998
GlobalTracer [baseline] (363.094 ms) : 0, 363094
GlobalTracer [candidate] (365.515 ms) : 0, 365515
AppSec [baseline] (31.98 ms) : 0, 31980
AppSec [candidate] (31.582 ms) : 0, 31582
Debugger [baseline] (11.376 ms) : 0, 11376
Debugger [candidate] (11.46 ms) : 0, 11460
Remote Config [baseline] (660.108 µs) : 0, 660
Remote Config [candidate] (669.187 µs) : 0, 669
Telemetry [baseline] (9.633 ms) : 0, 9633
Telemetry [candidate] (10.274 ms) : 0, 10274
ProfilingAgent [baseline] (103.255 ms) : 0, 103255
ProfilingAgent [candidate] (104.297 ms) : 0, 104297
Profiling [baseline] (103.28 ms) : 0, 103280
Profiling [candidate] (104.322 ms) : 0, 104322
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.003 s) : 0, 1002967
Total [baseline] (8.644 s) : 0, 8644195
Agent [candidate] (1.003 s) : 0, 1003120
Total [candidate] (8.6 s) : 0, 8600021
section iast
Agent [baseline] (1.141 s) : 0, 1140523
Total [baseline] (9.33 s) : 0, 9329840
Agent [candidate] (1.141 s) : 0, 1140885
Total [candidate] (9.334 s) : 0, 9333957
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.003 s -
Agent iast 1.141 s 137.556 ms (13.7%)
Total tracing 8.644 s -
Total iast 9.33 s 685.646 ms (7.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.003 s -
Agent iast 1.141 s 137.765 ms (13.7%)
Total tracing 8.6 s -
Total iast 9.334 s 733.936 ms (8.5%)
gantt
    title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (692.139 ms) : 0, 692139
BytebuddyAgent [candidate] (690.329 ms) : 0, 690329
GlobalTracer [baseline] (244.198 ms) : 0, 244198
GlobalTracer [candidate] (245.136 ms) : 0, 245136
AppSec [baseline] (30.715 ms) : 0, 30715
AppSec [candidate] (30.997 ms) : 0, 30997
Debugger [baseline] (5.994 ms) : 0, 5994
Debugger [candidate] (6.097 ms) : 0, 6097
Remote Config [baseline] (678.101 µs) : 0, 678
Remote Config [candidate] (687.589 µs) : 0, 688
Telemetry [baseline] (8.335 ms) : 0, 8335
Telemetry [candidate] (9.032 ms) : 0, 9032
section iast
BytebuddyAgent [baseline] (812.494 ms) : 0, 812494
BytebuddyAgent [candidate] (811.969 ms) : 0, 811969
GlobalTracer [baseline] (234.303 ms) : 0, 234303
GlobalTracer [candidate] (235.342 ms) : 0, 235342
AppSec [baseline] (30.941 ms) : 0, 30941
AppSec [candidate] (30.032 ms) : 0, 30032
Debugger [baseline] (5.77 ms) : 0, 5770
Debugger [candidate] (5.768 ms) : 0, 5768
Remote Config [baseline] (596.384 µs) : 0, 596
Remote Config [candidate] (584.02 µs) : 0, 584
Telemetry [baseline] (7.952 ms) : 0, 7952
Telemetry [candidate] (7.96 ms) : 0, 7960
IAST [baseline] (27.514 ms) : 0, 27514
IAST [candidate] (28.295 ms) : 0, 28295

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master dougqh/interceptor-bypass
git_commit_date 1752586391 1752587968
git_commit_sha b86f4f70d6 148117965e
release_version 1.52.0-SNAPSHOT~b86f4f70d6 1.52.0-SNAPSHOT~148117965e
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752589599 1752589599
ci_job_id 1029219549 1029219549
ci_pipeline_id 70581072 70581072
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-972opo9b 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-972opo9b 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 1 performance improvements and 2 performance regressions! Performance is the same for 9 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:tracing:high_load better
[-515.235µs; -269.472µs] or [-6.637%; -3.471%]
unstable
[-43.150op/s; +105.400op/s] or [-7.231%; +17.663%]
7.371ms 627.844op/s 7.763ms 596.719op/s
scenario:load:petclinic:iast:high_load worse
[+1.522ms; +2.355ms] or [+3.503%; +5.420%]
unstable
[-12.140op/s; +3.040op/s] or [-11.276%; +2.824%]
45.398ms 103.112op/s 43.459ms 107.662op/s
scenario:load:petclinic:tracing:high_load worse
[+1.323ms; +2.103ms] or [+3.134%; +4.981%]
unstable
[-12.147op/s; +3.447op/s] or [-10.961%; +3.111%]
43.935ms 106.475op/s 42.222ms 110.825op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6
    dateFormat X
    axisFormat %s
section baseline
no_agent (36.464 ms) : 36176, 36752
.   : milestone, 36464,
appsec (47.596 ms) : 47169, 48024
.   : milestone, 47596,
code_origins (45.211 ms) : 44812, 45610
.   : milestone, 45211,
iast (43.459 ms) : 43088, 43829
.   : milestone, 43459,
profiling (48.239 ms) : 47789, 48689
.   : milestone, 48239,
tracing (42.222 ms) : 41874, 42570
.   : milestone, 42222,
section candidate
no_agent (36.432 ms) : 36133, 36732
.   : milestone, 36432,
appsec (47.889 ms) : 47457, 48321
.   : milestone, 47889,
code_origins (45.408 ms) : 45010, 45806
.   : milestone, 45408,
iast (45.398 ms) : 44995, 45800
.   : milestone, 45398,
profiling (47.215 ms) : 46783, 47647
.   : milestone, 47215,
tracing (43.935 ms) : 43559, 44311
.   : milestone, 43935,
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.464 ms [36.176 ms, 36.752 ms] -
appsec 47.596 ms [47.169 ms, 48.024 ms] 11.132 ms (30.5%)
code_origins 45.211 ms [44.812 ms, 45.61 ms] 8.747 ms (24.0%)
iast 43.459 ms [43.088 ms, 43.829 ms] 6.995 ms (19.2%)
profiling 48.239 ms [47.789 ms, 48.689 ms] 11.775 ms (32.3%)
tracing 42.222 ms [41.874 ms, 42.57 ms] 5.758 ms (15.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.432 ms [36.133 ms, 36.732 ms] -
appsec 47.889 ms [47.457 ms, 48.321 ms] 11.457 ms (31.4%)
code_origins 45.408 ms [45.01 ms, 45.806 ms] 8.976 ms (24.6%)
iast 45.398 ms [44.995 ms, 45.8 ms] 8.965 ms (24.6%)
profiling 47.215 ms [46.783 ms, 47.647 ms] 10.783 ms (29.6%)
tracing 43.935 ms [43.559 ms, 44.311 ms] 7.503 ms (20.6%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.391 ms) : 4343, 4440
.   : milestone, 4391,
iast (9.6 ms) : 9442, 9758
.   : milestone, 9600,
iast_FULL (13.801 ms) : 13526, 14076
.   : milestone, 13801,
iast_GLOBAL (10.359 ms) : 10178, 10540
.   : milestone, 10359,
profiling (8.42 ms) : 8275, 8566
.   : milestone, 8420,
tracing (7.763 ms) : 7644, 7883
.   : milestone, 7763,
section candidate
no_agent (4.261 ms) : 4208, 4314
.   : milestone, 4261,
iast (9.43 ms) : 9271, 9590
.   : milestone, 9430,
iast_FULL (14.346 ms) : 14051, 14640
.   : milestone, 14346,
iast_GLOBAL (10.227 ms) : 10049, 10405
.   : milestone, 10227,
profiling (8.418 ms) : 8283, 8553
.   : milestone, 8418,
tracing (7.371 ms) : 7262, 7480
.   : milestone, 7371,
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.391 ms [4.343 ms, 4.44 ms] -
iast 9.6 ms [9.442 ms, 9.758 ms] 5.209 ms (118.6%)
iast_FULL 13.801 ms [13.526 ms, 14.076 ms] 9.41 ms (214.3%)
iast_GLOBAL 10.359 ms [10.178 ms, 10.54 ms] 5.968 ms (135.9%)
profiling 8.42 ms [8.275 ms, 8.566 ms] 4.029 ms (91.8%)
tracing 7.763 ms [7.644 ms, 7.883 ms] 3.372 ms (76.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.261 ms [4.208 ms, 4.314 ms] -
iast 9.43 ms [9.271 ms, 9.59 ms] 5.17 ms (121.3%)
iast_FULL 14.346 ms [14.051 ms, 14.64 ms] 10.085 ms (236.7%)
iast_GLOBAL 10.227 ms [10.049 ms, 10.405 ms] 5.966 ms (140.0%)
profiling 8.418 ms [8.283 ms, 8.553 ms] 4.157 ms (97.6%)
tracing 7.371 ms [7.262 ms, 7.48 ms] 3.11 ms (73.0%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master dougqh/interceptor-bypass
git_commit_date 1752586391 1752587968
git_commit_sha b86f4f70d6 148117965e
release_version 1.52.0-SNAPSHOT~b86f4f70d6 1.52.0-SNAPSHOT~148117965e
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1752590010 1752590010
ci_job_id 1029219552 1029219552
ci_pipeline_id 70581072 70581072
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-2-7omj3y1f 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-2-7omj3y1f 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 biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.493 s) : 15493000, 15493000
.   : milestone, 15493000,
appsec (14.609 s) : 14609000, 14609000
.   : milestone, 14609000,
iast (18.364 s) : 18364000, 18364000
.   : milestone, 18364000,
iast_GLOBAL (17.934 s) : 17934000, 17934000
.   : milestone, 17934000,
profiling (15.234 s) : 15234000, 15234000
.   : milestone, 15234000,
tracing (14.789 s) : 14789000, 14789000
.   : milestone, 14789000,
section candidate
no_agent (15.611 s) : 15611000, 15611000
.   : milestone, 15611000,
appsec (14.758 s) : 14758000, 14758000
.   : milestone, 14758000,
iast (18.114 s) : 18114000, 18114000
.   : milestone, 18114000,
iast_GLOBAL (18.522 s) : 18522000, 18522000
.   : milestone, 18522000,
profiling (15.846 s) : 15846000, 15846000
.   : milestone, 15846000,
tracing (14.723 s) : 14723000, 14723000
.   : milestone, 14723000,
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.493 s [15.493 s, 15.493 s] -
appsec 14.609 s [14.609 s, 14.609 s] -884.0 ms (-5.7%)
iast 18.364 s [18.364 s, 18.364 s] 2.871 s (18.5%)
iast_GLOBAL 17.934 s [17.934 s, 17.934 s] 2.441 s (15.8%)
profiling 15.234 s [15.234 s, 15.234 s] -259.0 ms (-1.7%)
tracing 14.789 s [14.789 s, 14.789 s] -704.0 ms (-4.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.611 s [15.611 s, 15.611 s] -
appsec 14.758 s [14.758 s, 14.758 s] -853.0 ms (-5.5%)
iast 18.114 s [18.114 s, 18.114 s] 2.503 s (16.0%)
iast_GLOBAL 18.522 s [18.522 s, 18.522 s] 2.911 s (18.6%)
profiling 15.846 s [15.846 s, 15.846 s] 235.0 ms (1.5%)
tracing 14.723 s [14.723 s, 14.723 s] -888.0 ms (-5.7%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~148117965e, baseline=1.52.0-SNAPSHOT~b86f4f70d6
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.473 ms) : 1461, 1484
.   : milestone, 1473,
appsec (2.396 ms) : 2346, 2446
.   : milestone, 2396,
iast (2.185 ms) : 2123, 2248
.   : milestone, 2185,
iast_GLOBAL (2.232 ms) : 2169, 2295
.   : milestone, 2232,
profiling (2.035 ms) : 1984, 2085
.   : milestone, 2035,
tracing (2.002 ms) : 1954, 2051
.   : milestone, 2002,
section candidate
no_agent (1.471 ms) : 1460, 1483
.   : milestone, 1471,
appsec (2.397 ms) : 2347, 2447
.   : milestone, 2397,
iast (2.18 ms) : 2117, 2242
.   : milestone, 2180,
iast_GLOBAL (2.234 ms) : 2172, 2297
.   : milestone, 2234,
profiling (2.048 ms) : 1996, 2099
.   : milestone, 2048,
tracing (2.001 ms) : 1953, 2049
.   : milestone, 2001,
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.473 ms [1.461 ms, 1.484 ms] -
appsec 2.396 ms [2.346 ms, 2.446 ms] 923.167 µs (62.7%)
iast 2.185 ms [2.123 ms, 2.248 ms] 712.511 µs (48.4%)
iast_GLOBAL 2.232 ms [2.169 ms, 2.295 ms] 758.785 µs (51.5%)
profiling 2.035 ms [1.984 ms, 2.085 ms] 561.821 µs (38.1%)
tracing 2.002 ms [1.954 ms, 2.051 ms] 529.582 µs (36.0%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.471 ms [1.46 ms, 1.483 ms] -
appsec 2.397 ms [2.347 ms, 2.447 ms] 925.877 µs (62.9%)
iast 2.18 ms [2.117 ms, 2.242 ms] 708.758 µs (48.2%)
iast_GLOBAL 2.234 ms [2.172 ms, 2.297 ms] 763.4 µs (51.9%)
profiling 2.048 ms [1.996 ms, 2.099 ms] 576.604 µs (39.2%)
tracing 2.001 ms [1.953 ms, 2.049 ms] 530.044 µs (36.0%)

pr-commenter[bot] avatar Mar 19 '25 21:03 pr-commenter[bot]

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.

github-actions[bot] avatar Mar 26 '25 16:03 github-actions[bot]

It seems it'd be relatively straightforward to keep track of the count in the map and avoid the O(n) price of computing it (or checking for emptiness), was it a deliberate choice to save to memory of the count and the operations of incrementing/decrementing it ?

vandonr avatar Apr 07 '25 16:04 vandonr

I'll admit that the lack of count support partially is down to laziness so far. I'm happy to try implementing it and then we can measure the impact. I'm not really worried about the extra memory - mostly just the extra code to track it, but I imagine the cost is negligible.

dougqh avatar Apr 09 '25 13:04 dougqh

It seems it'd be relatively straightforward to keep track of the count in the map and avoid the O(n) price of computing it (or checking for emptiness), was it a deliberate choice to save to memory of the count and the operations of incrementing/decrementing it ?

I've gone ahead and added the count support.

In some places updating count is O(n) itself because of needing to traverse the collision chain. In practice, the chain shouldn't be deep and the constant factor is small, so I think it is worthwhile change.

I did rerun my benchmarks and adding count tracking had no real impact overall.

dougqh avatar May 09 '25 14:05 dougqh