Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WebSocket support for Netty #8632

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 36 commits into
base: master
Choose a base branch
from

Conversation

ValentinZakharov
Copy link
Contributor

@ValentinZakharov ValentinZakharov commented Mar 28, 2025

What Does This Do

WebSocket Server instrumentation for Netty, versions 3.8, 4.0 and 4.1+
For the tests, used Netty WebSocket Client with fragmentation support (instead of OkHttp)

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

// Server pipeline handlers
if (handler instanceof HttpServerCodec) {
toAdd = new HttpServerTracingHandler();
toAdd2 = MaybeBlockResponseHandler.INSTANCE;
toAdd3 = new WebSocketServerTracingHandler();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Improvement required - we don't need a WebSocket handler if there is no websocket handshake

@ValentinZakharov ValentinZakharov force-pushed the vzakharov/websockets_netty branch from 86e499d to fad934c Compare March 28, 2025 10:52
@ValentinZakharov ValentinZakharov force-pushed the vzakharov/websockets_netty branch from fad934c to e619f2a Compare March 28, 2025 11:00
@pr-commenter
Copy link

pr-commenter bot commented Mar 28, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master vzakharov/websockets_netty
git_commit_date 1745829707 1745835556
git_commit_sha d306e15 c817fc9
release_version 1.49.0-SNAPSHOT~d306e1530b 1.49.0-SNAPSHOT~c817fc9228
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1745838326 1745838326
ci_job_id 914611982 914611982
ci_pipeline_id 63472151 63472151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zdcpjxrd-project-304-concurrent-1-diw94gwk 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zdcpjxrd-project-304-concurrent-1-diw94gwk 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None
variant iast iast

Summary

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

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.005 s) : 0, 1005343
Total [baseline] (10.495 s) : 0, 10494979
Agent [candidate] (1.012 s) : 0, 1011932
Total [candidate] (10.537 s) : 0, 10536897
section appsec
Agent [baseline] (1.147 s) : 0, 1146764
Total [baseline] (10.673 s) : 0, 10673157
Agent [candidate] (1.15 s) : 0, 1150283
Total [candidate] (10.643 s) : 0, 10642528
section iast
Agent [baseline] (1.144 s) : 0, 1143573
Total [baseline] (10.821 s) : 0, 10820990
Agent [candidate] (1.146 s) : 0, 1146187
Total [candidate] (10.844 s) : 0, 10843774
section profiling
Agent [baseline] (1.254 s) : 0, 1254034
Total [baseline] (10.762 s) : 0, 10762063
Agent [candidate] (1.252 s) : 0, 1252256
Total [candidate] (10.775 s) : 0, 10774634
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.005 s -
Agent appsec 1.147 s 141.421 ms (14.1%)
Agent iast 1.144 s 138.229 ms (13.7%)
Agent profiling 1.254 s 248.691 ms (24.7%)
Total tracing 10.495 s -
Total appsec 10.673 s 178.178 ms (1.7%)
Total iast 10.821 s 326.011 ms (3.1%)
Total profiling 10.762 s 267.085 ms (2.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.012 s -
Agent appsec 1.15 s 138.351 ms (13.7%)
Agent iast 1.146 s 134.255 ms (13.3%)
Agent profiling 1.252 s 240.324 ms (23.7%)
Total tracing 10.537 s -
Total appsec 10.643 s 105.63 ms (1.0%)
Total iast 10.844 s 306.877 ms (2.9%)
Total profiling 10.775 s 237.736 ms (2.3%)
gantt
    title petclinic - break down per module: candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (670.104 ms) : 0, 670104
BytebuddyAgent [candidate] (673.099 ms) : 0, 673099
GlobalTracer [baseline] (240.369 ms) : 0, 240369
GlobalTracer [candidate] (241.787 ms) : 0, 241787
AppSec [baseline] (54.659 ms) : 0, 54659
AppSec [candidate] (55.07 ms) : 0, 55070
Debugger [baseline] (6.154 ms) : 0, 6154
Debugger [candidate] (6.951 ms) : 0, 6951
Remote Config [baseline] (702.336 µs) : 0, 702
Remote Config [candidate] (719.067 µs) : 0, 719
Telemetry [baseline] (9.896 ms) : 0, 9896
Telemetry [candidate] (10.773 ms) : 0, 10773
section appsec
BytebuddyAgent [baseline] (687.043 ms) : 0, 687043
BytebuddyAgent [candidate] (689.38 ms) : 0, 689380
GlobalTracer [baseline] (235.83 ms) : 0, 235830
GlobalTracer [candidate] (236.983 ms) : 0, 236983
IAST [baseline] (21.845 ms) : 0, 21845
IAST [candidate] (21.876 ms) : 0, 21876
AppSec [baseline] (174.928 ms) : 0, 174928
AppSec [candidate] (175.24 ms) : 0, 175240
Debugger [baseline] (5.902 ms) : 0, 5902
Debugger [candidate] (5.889 ms) : 0, 5889
Remote Config [baseline] (632.328 µs) : 0, 632
Remote Config [candidate] (638.997 µs) : 0, 639
Telemetry [baseline] (8.154 ms) : 0, 8154
Telemetry [candidate] (7.762 ms) : 0, 7762
section iast
BytebuddyAgent [baseline] (795.884 ms) : 0, 795884
BytebuddyAgent [candidate] (796.654 ms) : 0, 796654
GlobalTracer [baseline] (231.07 ms) : 0, 231070
GlobalTracer [candidate] (232.011 ms) : 0, 232011
IAST [baseline] (22.818 ms) : 0, 22818
IAST [candidate] (22.995 ms) : 0, 22995
AppSec [baseline] (56.018 ms) : 0, 56018
AppSec [candidate] (56.612 ms) : 0, 56612
Debugger [baseline] (5.844 ms) : 0, 5844
Debugger [candidate] (5.874 ms) : 0, 5874
Remote Config [baseline] (572.076 µs) : 0, 572
Remote Config [candidate] (587.425 µs) : 0, 587
Telemetry [baseline] (7.874 ms) : 0, 7874
Telemetry [candidate] (7.864 ms) : 0, 7864
section profiling
BytebuddyAgent [baseline] (661.715 ms) : 0, 661715
BytebuddyAgent [candidate] (661.929 ms) : 0, 661929
GlobalTracer [baseline] (375.082 ms) : 0, 375082
GlobalTracer [candidate] (374.533 ms) : 0, 374533
AppSec [baseline] (54.374 ms) : 0, 54374
AppSec [candidate] (53.609 ms) : 0, 53609
Debugger [baseline] (6.102 ms) : 0, 6102
Debugger [candidate] (6.08 ms) : 0, 6080
Remote Config [baseline] (649.959 µs) : 0, 650
Remote Config [candidate] (634.575 µs) : 0, 635
Telemetry [baseline] (8.16 ms) : 0, 8160
Telemetry [candidate] (8.174 ms) : 0, 8174
ProfilingAgent [baseline] (97.877 ms) : 0, 97877
ProfilingAgent [candidate] (97.218 ms) : 0, 97218
Profiling [baseline] (97.902 ms) : 0, 97902
Profiling [candidate] (97.242 ms) : 0, 97242
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.003 s) : 0, 1002957
Total [baseline] (8.609 s) : 0, 8608588
Agent [candidate] (1.021 s) : 0, 1021432
Total [candidate] (8.713 s) : 0, 8712640
section iast
Agent [baseline] (1.135 s) : 0, 1134704
Total [baseline] (9.163 s) : 0, 9163263
Agent [candidate] (1.143 s) : 0, 1143044
Total [candidate] (9.231 s) : 0, 9231354
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.138 s) : 0, 1137615
Total [baseline] (9.195 s) : 0, 9195280
Agent [candidate] (1.132 s) : 0, 1131800
Total [candidate] (9.172 s) : 0, 9172056
section iast_TELEMETRY_OFF
Agent [baseline] (1.136 s) : 0, 1136410
Total [baseline] (9.17 s) : 0, 9169790
Agent [candidate] (1.132 s) : 0, 1131669
Total [candidate] (9.223 s) : 0, 9222896
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.003 s -
Agent iast 1.135 s 131.747 ms (13.1%)
Agent iast_HARDCODED_SECRET_DISABLED 1.138 s 134.658 ms (13.4%)
Agent iast_TELEMETRY_OFF 1.136 s 133.453 ms (13.3%)
Total tracing 8.609 s -
Total iast 9.163 s 554.675 ms (6.4%)
Total iast_HARDCODED_SECRET_DISABLED 9.195 s 586.692 ms (6.8%)
Total iast_TELEMETRY_OFF 9.17 s 561.202 ms (6.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.021 s -
Agent iast 1.143 s 121.612 ms (11.9%)
Agent iast_HARDCODED_SECRET_DISABLED 1.132 s 110.368 ms (10.8%)
Agent iast_TELEMETRY_OFF 1.132 s 110.236 ms (10.8%)
Total tracing 8.713 s -
Total iast 9.231 s 518.714 ms (6.0%)
Total iast_HARDCODED_SECRET_DISABLED 9.172 s 459.416 ms (5.3%)
Total iast_TELEMETRY_OFF 9.223 s 510.256 ms (5.9%)
gantt
    title insecure-bank - break down per module: candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (668.327 ms) : 0, 668327
BytebuddyAgent [candidate] (681.693 ms) : 0, 681693
GlobalTracer [baseline] (239.08 ms) : 0, 239080
GlobalTracer [candidate] (242.437 ms) : 0, 242437
AppSec [baseline] (54.776 ms) : 0, 54776
AppSec [candidate] (55.154 ms) : 0, 55154
Debugger [baseline] (6.852 ms) : 0, 6852
Debugger [candidate] (6.223 ms) : 0, 6223
Remote Config [baseline] (712.923 µs) : 0, 713
Remote Config [candidate] (713.327 µs) : 0, 713
Telemetry [baseline] (9.959 ms) : 0, 9959
Telemetry [candidate] (11.514 ms) : 0, 11514
section iast
BytebuddyAgent [baseline] (789.009 ms) : 0, 789009
BytebuddyAgent [candidate] (794.664 ms) : 0, 794664
GlobalTracer [baseline] (229.218 ms) : 0, 229218
GlobalTracer [candidate] (231.302 ms) : 0, 231302
IAST [baseline] (22.828 ms) : 0, 22828
IAST [candidate] (22.825 ms) : 0, 22825
AppSec [baseline] (56.021 ms) : 0, 56021
AppSec [candidate] (56.343 ms) : 0, 56343
Debugger [baseline] (5.808 ms) : 0, 5808
Debugger [candidate] (5.857 ms) : 0, 5857
Remote Config [baseline] (589.811 µs) : 0, 590
Remote Config [candidate] (586.742 µs) : 0, 587
Telemetry [baseline] (7.855 ms) : 0, 7855
Telemetry [candidate] (7.968 ms) : 0, 7968
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (790.213 ms) : 0, 790213
BytebuddyAgent [candidate] (786.419 ms) : 0, 786419
GlobalTracer [baseline] (230.13 ms) : 0, 230130
GlobalTracer [candidate] (229.384 ms) : 0, 229384
IAST [baseline] (22.692 ms) : 0, 22692
IAST [candidate] (22.664 ms) : 0, 22664
AppSec [baseline] (56.744 ms) : 0, 56744
AppSec [candidate] (55.834 ms) : 0, 55834
Debugger [baseline] (5.89 ms) : 0, 5890
Debugger [candidate] (5.813 ms) : 0, 5813
Remote Config [baseline] (593.682 µs) : 0, 594
Remote Config [candidate] (579.622 µs) : 0, 580
Telemetry [baseline] (7.957 ms) : 0, 7957
Telemetry [candidate] (7.833 ms) : 0, 7833
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (789.426 ms) : 0, 789426
BytebuddyAgent [candidate] (784.668 ms) : 0, 784668
GlobalTracer [baseline] (230.4 ms) : 0, 230400
GlobalTracer [candidate] (229.96 ms) : 0, 229960
IAST [baseline] (22.58 ms) : 0, 22580
IAST [candidate] (22.319 ms) : 0, 22319
AppSec [baseline] (56.308 ms) : 0, 56308
AppSec [candidate] (56.97 ms) : 0, 56970
Debugger [baseline] (5.932 ms) : 0, 5932
Debugger [candidate] (5.941 ms) : 0, 5941
Remote Config [baseline] (606.363 µs) : 0, 606
Remote Config [candidate] (598.678 µs) : 0, 599
Telemetry [baseline] (7.731 ms) : 0, 7731
Telemetry [candidate] (7.866 ms) : 0, 7866
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-04-28T10:38:13 2025-04-28T10:45:56
git_branch master vzakharov/websockets_netty
git_commit_date 1745829707 1745835556
git_commit_sha d306e15 c817fc9
release_version 1.49.0-SNAPSHOT~d306e1530b 1.49.0-SNAPSHOT~c817fc9228
start_time 2025-04-28T10:37:59 2025-04-28T10:45:42
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1745837551 1745837551
ci_job_id 914611983 914611983
ci_pipeline_id 63472151 63472151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-hzid5obx-project-304-concurrent-1-ocdww7qr 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-hzid5obx-project-304-concurrent-1-ocdww7qr 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant iast iast

Summary

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

Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.35 ms) : 1330, 1370
.   : milestone, 1350,
appsec (1.729 ms) : 1706, 1753
.   : milestone, 1729,
appsec_no_iast (1.721 ms) : 1697, 1745
.   : milestone, 1721,
code_origins (1.671 ms) : 1641, 1701
.   : milestone, 1671,
iast (1.52 ms) : 1495, 1545
.   : milestone, 1520,
profiling (1.524 ms) : 1498, 1549
.   : milestone, 1524,
tracing (1.486 ms) : 1462, 1511
.   : milestone, 1486,
section candidate
no_agent (1.334 ms) : 1314, 1355
.   : milestone, 1334,
appsec (1.73 ms) : 1706, 1753
.   : milestone, 1730,
appsec_no_iast (1.706 ms) : 1683, 1730
.   : milestone, 1706,
code_origins (1.674 ms) : 1647, 1701
.   : milestone, 1674,
iast (1.519 ms) : 1495, 1543
.   : milestone, 1519,
profiling (1.512 ms) : 1487, 1537
.   : milestone, 1512,
tracing (1.491 ms) : 1467, 1516
.   : milestone, 1491,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.35 ms [1.33 ms, 1.37 ms] -
appsec 1.729 ms [1.706 ms, 1.753 ms] 379.558 µs (28.1%)
appsec_no_iast 1.721 ms [1.697 ms, 1.745 ms] 371.237 µs (27.5%)
code_origins 1.671 ms [1.641 ms, 1.701 ms] 321.118 µs (23.8%)
iast 1.52 ms [1.495 ms, 1.545 ms] 170.06 µs (12.6%)
profiling 1.524 ms [1.498 ms, 1.549 ms] 173.675 µs (12.9%)
tracing 1.486 ms [1.462 ms, 1.511 ms] 136.438 µs (10.1%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.334 ms [1.314 ms, 1.355 ms] -
appsec 1.73 ms [1.706 ms, 1.753 ms] 395.344 µs (29.6%)
appsec_no_iast 1.706 ms [1.683 ms, 1.73 ms] 371.718 µs (27.9%)
code_origins 1.674 ms [1.647 ms, 1.701 ms] 339.791 µs (25.5%)
iast 1.519 ms [1.495 ms, 1.543 ms] 184.745 µs (13.8%)
profiling 1.512 ms [1.487 ms, 1.537 ms] 177.543 µs (13.3%)
tracing 1.491 ms [1.467 ms, 1.516 ms] 156.836 µs (11.8%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b
    dateFormat X
    axisFormat %s
section baseline
no_agent (377.832 µs) : 358, 397
.   : milestone, 378,
iast (522.599 µs) : 500, 545
.   : milestone, 523,
iast_FULL (723.689 µs) : 700, 747
.   : milestone, 724,
iast_GLOBAL (574.544 µs) : 551, 599
.   : milestone, 575,
iast_HARDCODED_SECRET_DISABLED (514.937 µs) : 492, 538
.   : milestone, 515,
iast_INACTIVE (468.729 µs) : 446, 491
.   : milestone, 469,
iast_TELEMETRY_OFF (513.394 µs) : 490, 537
.   : milestone, 513,
tracing (466.215 µs) : 444, 489
.   : milestone, 466,
section candidate
no_agent (379.809 µs) : 360, 400
.   : milestone, 380,
iast (515.034 µs) : 492, 538
.   : milestone, 515,
iast_FULL (728.21 µs) : 705, 751
.   : milestone, 728,
iast_GLOBAL (566.46 µs) : 543, 590
.   : milestone, 566,
iast_HARDCODED_SECRET_DISABLED (513.13 µs) : 490, 537
.   : milestone, 513,
iast_INACTIVE (463.591 µs) : 441, 486
.   : milestone, 464,
iast_TELEMETRY_OFF (499.293 µs) : 476, 522
.   : milestone, 499,
tracing (462.426 µs) : 440, 485
.   : milestone, 462,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 377.832 µs [358.212 µs, 397.451 µs] -
iast 522.599 µs [499.81 µs, 545.388 µs] 144.767 µs (38.3%)
iast_FULL 723.689 µs [700.062 µs, 747.317 µs] 345.858 µs (91.5%)
iast_GLOBAL 574.544 µs [550.524 µs, 598.565 µs] 196.712 µs (52.1%)
iast_HARDCODED_SECRET_DISABLED 514.937 µs [492.203 µs, 537.671 µs] 137.106 µs (36.3%)
iast_INACTIVE 468.729 µs [446.094 µs, 491.364 µs] 90.897 µs (24.1%)
iast_TELEMETRY_OFF 513.394 µs [490.099 µs, 536.688 µs] 135.562 µs (35.9%)
tracing 466.215 µs [443.711 µs, 488.719 µs] 88.383 µs (23.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 379.809 µs [360.018 µs, 399.6 µs] -
iast 515.034 µs [492.321 µs, 537.746 µs] 135.224 µs (35.6%)
iast_FULL 728.21 µs [705.084 µs, 751.336 µs] 348.401 µs (91.7%)
iast_GLOBAL 566.46 µs [543.233 µs, 589.687 µs] 186.651 µs (49.1%)
iast_HARDCODED_SECRET_DISABLED 513.13 µs [489.611 µs, 536.65 µs] 133.321 µs (35.1%)
iast_INACTIVE 463.591 µs [441.478 µs, 485.705 µs] 83.782 µs (22.1%)
iast_TELEMETRY_OFF 499.293 µs [476.303 µs, 522.282 µs] 119.484 µs (31.5%)
tracing 462.426 µs [439.832 µs, 485.02 µs] 82.617 µs (21.8%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master vzakharov/websockets_netty
git_commit_date 1745829707 1745835556
git_commit_sha d306e15 c817fc9
release_version 1.49.0-SNAPSHOT~d306e1530b 1.49.0-SNAPSHOT~c817fc9228
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1745837992 1745837992
ci_job_id 914611985 914611985
ci_pipeline_id 63472151 63472151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-syfpehly-project-304-concurrent-1-vfb99e99 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-syfpehly-project-304-concurrent-1-vfb99e99 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant appsec appsec

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.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.44 s) : 15440000, 15440000
.   : milestone, 15440000,
appsec (15.163 s) : 15163000, 15163000
.   : milestone, 15163000,
iast (18.663 s) : 18663000, 18663000
.   : milestone, 18663000,
iast_GLOBAL (18.35 s) : 18350000, 18350000
.   : milestone, 18350000,
profiling (14.962 s) : 14962000, 14962000
.   : milestone, 14962000,
tracing (15.352 s) : 15352000, 15352000
.   : milestone, 15352000,
section candidate
no_agent (15.2 s) : 15200000, 15200000
.   : milestone, 15200000,
appsec (15.108 s) : 15108000, 15108000
.   : milestone, 15108000,
iast (18.815 s) : 18815000, 18815000
.   : milestone, 18815000,
iast_GLOBAL (18.279 s) : 18279000, 18279000
.   : milestone, 18279000,
profiling (15.656 s) : 15656000, 15656000
.   : milestone, 15656000,
tracing (15.012 s) : 15012000, 15012000
.   : milestone, 15012000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.44 s [15.44 s, 15.44 s] -
appsec 15.163 s [15.163 s, 15.163 s] -277.0 ms (-1.8%)
iast 18.663 s [18.663 s, 18.663 s] 3.223 s (20.9%)
iast_GLOBAL 18.35 s [18.35 s, 18.35 s] 2.91 s (18.8%)
profiling 14.962 s [14.962 s, 14.962 s] -478.0 ms (-3.1%)
tracing 15.352 s [15.352 s, 15.352 s] -88.0 ms (-0.6%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.2 s [15.2 s, 15.2 s] -
appsec 15.108 s [15.108 s, 15.108 s] -92.0 ms (-0.6%)
iast 18.815 s [18.815 s, 18.815 s] 3.615 s (23.8%)
iast_GLOBAL 18.279 s [18.279 s, 18.279 s] 3.079 s (20.3%)
profiling 15.656 s [15.656 s, 15.656 s] 456.0 ms (3.0%)
tracing 15.012 s [15.012 s, 15.012 s] -188.0 ms (-1.2%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.49.0-SNAPSHOT~c817fc9228, baseline=1.49.0-SNAPSHOT~d306e1530b
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.478 ms) : 1466, 1489
.   : milestone, 1478,
appsec (2.393 ms) : 2346, 2441
.   : milestone, 2393,
iast (2.156 ms) : 2098, 2215
.   : milestone, 2156,
iast_GLOBAL (2.215 ms) : 2155, 2275
.   : milestone, 2215,
profiling (2.015 ms) : 1969, 2062
.   : milestone, 2015,
tracing (1.995 ms) : 1949, 2041
.   : milestone, 1995,
section candidate
no_agent (1.48 ms) : 1469, 1492
.   : milestone, 1480,
appsec (2.39 ms) : 2343, 2437
.   : milestone, 2390,
iast (2.166 ms) : 2107, 2225
.   : milestone, 2166,
iast_GLOBAL (2.199 ms) : 2140, 2258
.   : milestone, 2199,
profiling (2.001 ms) : 1955, 2047
.   : milestone, 2001,
tracing (1.99 ms) : 1945, 2036
.   : milestone, 1990,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.478 ms [1.466 ms, 1.489 ms] -
appsec 2.393 ms [2.346 ms, 2.441 ms] 915.692 µs (62.0%)
iast 2.156 ms [2.098 ms, 2.215 ms] 678.857 µs (45.9%)
iast_GLOBAL 2.215 ms [2.155 ms, 2.275 ms] 737.557 µs (49.9%)
profiling 2.015 ms [1.969 ms, 2.062 ms] 537.6 µs (36.4%)
tracing 1.995 ms [1.949 ms, 2.041 ms] 517.465 µs (35.0%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.48 ms [1.469 ms, 1.492 ms] -
appsec 2.39 ms [2.343 ms, 2.437 ms] 909.8 µs (61.5%)
iast 2.166 ms [2.107 ms, 2.225 ms] 685.896 µs (46.3%)
iast_GLOBAL 2.199 ms [2.14 ms, 2.258 ms] 719.011 µs (48.6%)
profiling 2.001 ms [1.955 ms, 2.047 ms] 520.836 µs (35.2%)
tracing 1.99 ms [1.945 ms, 2.036 ms] 510.159 µs (34.5%)

@amarziali amarziali force-pushed the vzakharov/websockets_netty branch from 5870c70 to 1ab91db Compare March 28, 2025 15:27
@ValentinZakharov ValentinZakharov changed the title [WIP] Implemented WebSocket support for Netty 4.1 [WIP] Implemented WebSocket support for Netty Apr 15, 2025
@amarziali amarziali force-pushed the vzakharov/websockets_netty branch from 3357f5c to e816b50 Compare April 16, 2025 13:42
@amarziali amarziali force-pushed the vzakharov/websockets_netty branch from ca61b9e to 5922b70 Compare April 17, 2025 08:21
@pr-commenter
Copy link

pr-commenter bot commented Apr 17, 2025

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1744884666 1744885049
end_time 2025-04-17T10:12:24 2025-04-17T10:18:47
git_branch master vzakharov/websockets_netty
git_commit_sha b00c24e 78e9c9c
start_time 2025-04-17T10:11:07 2025-04-17T10:17:30
See matching parameters
Baseline Candidate
ci_job_id 901086900 901086900
ci_pipeline_id 62479058 62479058
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1744883282 1744883282

Summary

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

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:loop better
[-667.161µs; -653.646µs] or [-6.264%; -6.137%]
better
[-709.060µs; -636.845µs] or [-6.549%; -5.882%]
better
[-701.954µs; -574.902µs] or [-6.429%; -5.265%]
better
[-866.471µs; -492.661µs] or [-7.706%; -4.382%]
better
[+4.728op/s; +6.799op/s] or [+5.177%; +7.445%]
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
[-31.220µs; +20.982µs] or [-11.209%; +7.533%]
unstable
[-45.610µs; +27.969µs] or [-14.270%; +8.751%]
unstable
[-59.552µs; +37.740µs] or [-17.780%; +11.268%]
unstable
[-108.976µs; +93.943µs] or [-18.283%; +15.761%]
same
scenario:basic same same same unstable
[-21.187µs; +39.562µs] or [-4.035%; +7.534%]
unstable
[-161.685op/s; +161.735op/s] or [-6.467%; +6.469%]
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (319.62 µs) : 278, 362
.   : milestone, 320,
basic (311.725 µs) : 302, 321
.   : milestone, 312,
loop (10.827 ms) : 10801, 10853
.   : milestone, 10827,
section candidate
noprobe (310.8 µs) : 284, 337
.   : milestone, 311,
basic (309.257 µs) : 302, 317
.   : milestone, 309,
loop (10.154 ms) : 10114, 10194
.   : milestone, 10154,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 319.62 µs [277.617 µs, 361.624 µs]
basic 311.725 µs [302.354 µs, 321.097 µs]
loop 10.827 ms [10.801 ms, 10.853 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 310.8 µs [284.465 µs, 337.134 µs]
basic 309.257 µs [301.592 µs, 316.923 µs]
loop 10.154 ms [10.114 ms, 10.194 ms]

HttpServerResponseTracingHandler.INSTANCE,
MaybeBlockResponseHandler.INSTANCE);
} else if (handler instanceof WebSocketServerProtocolHandler) {
if (pipeline.get(HttpServerTracingHandler.class) != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

the websocket insturmentation should be disabled by default. I suggest to check also against InstrumenterConfig.isWebsocketTracingEnabled()

NettyPipelineHelper.addHandlerAfter(
pipeline,
"HttpServerRequestTracingHandler#0",
WebSocketServerRequestTracingHandler.INSTANCE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

check if websocket is enabled

NettyPipelineHelper.addHandlerAfter(
pipeline,
"HttpServerResponseTracingHandler#0",
WebSocketServerResponseTracingHandler.INSTANCE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

to be checked if websocket is enabled

NettyPipelineHelper.addHandlerAfter(
pipeline,
"datadog.trace.instrumentation.netty40.server.HttpServerTracingHandler",
new WebSocketServerTracingHandler());
Copy link
Collaborator

Choose a reason for hiding this comment

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

to be added only if websocket tracing is enabled

addHandlerAfter(
pipeline,
"datadog.trace.instrumentation.netty38.server.HttpServerTracingHandler",
new WebSocketServerTracingHandler(contextStore));
Copy link
Collaborator

Choose a reason for hiding this comment

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

to be added only if websocket tracing is enabled

Copy link
Collaborator

@amarziali amarziali left a comment

Choose a reason for hiding this comment

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

The main changes concern the fact the websocket handlers have to be added only if the websocket tracing is enabled. Other than this it looks ok. It would be nice to have another review since I coauthored part of that

@amarziali amarziali changed the title [WIP] Implemented WebSocket support for Netty [WIP]WebSocket support for Netty Apr 17, 2025
@amarziali amarziali added tag: experimental Experimental changes inst: websocket WebSocket Instrumentation labels Apr 17, 2025
@ValentinZakharov ValentinZakharov marked this pull request as ready for review April 28, 2025 12:20
@ValentinZakharov ValentinZakharov requested review from a team as code owners April 28, 2025 12:20
Copy link
Contributor

github-actions bot commented Apr 28, 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
  • Remove the tag from the pull request title

If you need help, please check our contributing guidelines.

@amarziali amarziali removed their request for review April 28, 2025 12:57
@ValentinZakharov ValentinZakharov changed the title [WIP]WebSocket support for Netty WebSocket support for Netty Apr 28, 2025
@Override
void messageReceived(ChannelHandlerContext ctx, MessageEvent msg) throws Exception {
if (msg.getMessage() instanceof HttpRequest) {
def request = msg.getMessage() as HttpRequest

def upgradeHeader = request.headers().get("Upgrade")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the header name be lowercase or capitalized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've checked, internally it's doing case insensitive comparison, during the search, but probably you are right and we might keep low case here for clarity.


@Override
void setSplitChunksAfter(int size) {
// not supported
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not? Is it not needed for testing?

Copy link
Contributor

@ygree ygree left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: websocket WebSocket Instrumentation tag: experimental Experimental changes type: feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants