-
Notifications
You must be signed in to change notification settings - Fork 293
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
Extend NonBlockingSemaphore and make release for 1-permit case atomic #8446
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 5 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.041 s) : 0, 1040507
Total [baseline] (8.695 s) : 0, 8695283
Agent [candidate] (1.043 s) : 0, 1043207
Total [candidate] (8.699 s) : 0, 8699053
section iast
Agent [baseline] (1.178 s) : 0, 1178442
Total [baseline] (9.284 s) : 0, 9283979
Agent [candidate] (1.177 s) : 0, 1176527
Total [candidate] (9.309 s) : 0, 9309496
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.179 s) : 0, 1178632
Total [baseline] (9.215 s) : 0, 9214877
Agent [candidate] (1.171 s) : 0, 1171226
Total [candidate] (9.207 s) : 0, 9207079
section iast_TELEMETRY_OFF
Agent [baseline] (1.165 s) : 0, 1165081
Total [baseline] (9.205 s) : 0, 9205079
Agent [candidate] (1.167 s) : 0, 1167191
Total [candidate] (9.229 s) : 0, 9228771
gantt
title insecure-bank - break down per module: candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (718.069 ms) : 0, 718069
BytebuddyAgent [candidate] (721.27 ms) : 0, 721270
GlobalTracer [baseline] (239.048 ms) : 0, 239048
GlobalTracer [candidate] (240.744 ms) : 0, 240744
AppSec [baseline] (55.669 ms) : 0, 55669
AppSec [candidate] (56.131 ms) : 0, 56131
Remote Config [baseline] (696.674 µs) : 0, 697
Remote Config [candidate] (710.223 µs) : 0, 710
Telemetry [baseline] (12.148 ms) : 0, 12148
Telemetry [candidate] (9.364 ms) : 0, 9364
section iast
BytebuddyAgent [baseline] (842.137 ms) : 0, 842137
BytebuddyAgent [candidate] (840.675 ms) : 0, 840675
GlobalTracer [baseline] (231.044 ms) : 0, 231044
GlobalTracer [candidate] (231.052 ms) : 0, 231052
AppSec [baseline] (57.608 ms) : 0, 57608
AppSec [candidate] (57.443 ms) : 0, 57443
Remote Config [baseline] (632.013 µs) : 0, 632
Remote Config [candidate] (628.971 µs) : 0, 629
Telemetry [baseline] (8.84 ms) : 0, 8840
Telemetry [candidate] (8.779 ms) : 0, 8779
IAST [baseline] (23.126 ms) : 0, 23126
IAST [candidate] (22.9 ms) : 0, 22900
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (842.884 ms) : 0, 842884
BytebuddyAgent [candidate] (836.86 ms) : 0, 836860
GlobalTracer [baseline] (231.071 ms) : 0, 231071
GlobalTracer [candidate] (230.315 ms) : 0, 230315
AppSec [baseline] (57.133 ms) : 0, 57133
AppSec [candidate] (56.906 ms) : 0, 56906
Remote Config [baseline] (627.033 µs) : 0, 627
Remote Config [candidate] (608.083 µs) : 0, 608
Telemetry [baseline] (8.731 ms) : 0, 8731
Telemetry [candidate] (8.722 ms) : 0, 8722
IAST [baseline] (23.083 ms) : 0, 23083
IAST [candidate] (22.854 ms) : 0, 22854
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (832.213 ms) : 0, 832213
BytebuddyAgent [candidate] (833.436 ms) : 0, 833436
GlobalTracer [baseline] (229.181 ms) : 0, 229181
GlobalTracer [candidate] (230.091 ms) : 0, 230091
AppSec [baseline] (54.605 ms) : 0, 54605
AppSec [candidate] (55.589 ms) : 0, 55589
Remote Config [baseline] (616.982 µs) : 0, 617
Remote Config [candidate] (608.498 µs) : 0, 608
Telemetry [baseline] (8.735 ms) : 0, 8735
Telemetry [candidate] (8.627 ms) : 0, 8627
IAST [baseline] (24.798 ms) : 0, 24798
IAST [candidate] (23.828 ms) : 0, 23828
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.037 s) : 0, 1036828
Total [baseline] (10.384 s) : 0, 10384238
Agent [candidate] (1.045 s) : 0, 1045053
Total [candidate] (10.451 s) : 0, 10450876
section appsec
Agent [baseline] (1.187 s) : 0, 1186616
Total [baseline] (10.784 s) : 0, 10784028
Agent [candidate] (1.183 s) : 0, 1182681
Total [candidate] (10.735 s) : 0, 10735049
section iast
Agent [baseline] (1.176 s) : 0, 1176396
Total [baseline] (11.075 s) : 0, 11075482
Agent [candidate] (1.171 s) : 0, 1170711
Total [candidate] (10.963 s) : 0, 10963146
section profiling
Agent [baseline] (1.259 s) : 0, 1258799
Total [baseline] (10.854 s) : 0, 10853785
Agent [candidate] (1.264 s) : 0, 1263647
Total [candidate] (10.884 s) : 0, 10883506
gantt
title petclinic - break down per module: candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (715.188 ms) : 0, 715188
BytebuddyAgent [candidate] (721.175 ms) : 0, 721175
GlobalTracer [baseline] (238.159 ms) : 0, 238159
GlobalTracer [candidate] (240.081 ms) : 0, 240081
AppSec [baseline] (55.578 ms) : 0, 55578
AppSec [candidate] (55.833 ms) : 0, 55833
Remote Config [baseline] (685.059 µs) : 0, 685
Remote Config [candidate] (702.454 µs) : 0, 702
Telemetry [baseline] (12.323 ms) : 0, 12323
Telemetry [candidate] (12.271 ms) : 0, 12271
section appsec
BytebuddyAgent [baseline] (737.495 ms) : 0, 737495
BytebuddyAgent [candidate] (735.338 ms) : 0, 735338
GlobalTracer [baseline] (237.094 ms) : 0, 237094
GlobalTracer [candidate] (235.868 ms) : 0, 235868
AppSec [baseline] (177.292 ms) : 0, 177292
AppSec [candidate] (176.951 ms) : 0, 176951
Remote Config [baseline] (659.782 µs) : 0, 660
Remote Config [candidate] (658.765 µs) : 0, 659
Telemetry [baseline] (8.343 ms) : 0, 8343
Telemetry [candidate] (8.271 ms) : 0, 8271
IAST [baseline] (21.556 ms) : 0, 21556
IAST [candidate] (21.418 ms) : 0, 21418
section iast
BytebuddyAgent [baseline] (840.576 ms) : 0, 840576
BytebuddyAgent [candidate] (836.105 ms) : 0, 836105
GlobalTracer [baseline] (230.895 ms) : 0, 230895
GlobalTracer [candidate] (230.183 ms) : 0, 230183
AppSec [baseline] (57.519 ms) : 0, 57519
AppSec [candidate] (57.303 ms) : 0, 57303
Remote Config [baseline] (617.944 µs) : 0, 618
Remote Config [candidate] (604.673 µs) : 0, 605
Telemetry [baseline] (8.754 ms) : 0, 8754
Telemetry [candidate] (8.7 ms) : 0, 8700
IAST [baseline] (23.031 ms) : 0, 23031
IAST [candidate] (22.843 ms) : 0, 22843
section profiling
ProfilingAgent [baseline] (96.522 ms) : 0, 96522
ProfilingAgent [candidate] (96.814 ms) : 0, 96814
BytebuddyAgent [baseline] (707.154 ms) : 0, 707154
BytebuddyAgent [candidate] (710.845 ms) : 0, 710845
GlobalTracer [baseline] (350.086 ms) : 0, 350086
GlobalTracer [candidate] (351.189 ms) : 0, 351189
AppSec [baseline] (55.208 ms) : 0, 55208
AppSec [candidate] (54.776 ms) : 0, 54776
Remote Config [baseline] (666.287 µs) : 0, 666
Remote Config [candidate] (677.796 µs) : 0, 678
Telemetry [baseline] (8.88 ms) : 0, 8880
Telemetry [candidate] (8.961 ms) : 0, 8961
Profiling [baseline] (96.545 ms) : 0, 96545
Profiling [candidate] (96.838 ms) : 0, 96838
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 13 metrics, 17 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section baseline
no_agent (1.364 ms) : 1343, 1385
. : milestone, 1364,
appsec (1.748 ms) : 1725, 1772
. : milestone, 1748,
appsec_no_iast (1.772 ms) : 1747, 1796
. : milestone, 1772,
code_origins (1.703 ms) : 1670, 1735
. : milestone, 1703,
iast (1.516 ms) : 1492, 1539
. : milestone, 1516,
profiling (1.519 ms) : 1495, 1543
. : milestone, 1519,
tracing (1.477 ms) : 1453, 1501
. : milestone, 1477,
section candidate
no_agent (1.353 ms) : 1333, 1373
. : milestone, 1353,
appsec (1.748 ms) : 1724, 1772
. : milestone, 1748,
appsec_no_iast (1.773 ms) : 1750, 1796
. : milestone, 1773,
code_origins (1.67 ms) : 1636, 1704
. : milestone, 1670,
iast (1.531 ms) : 1508, 1555
. : milestone, 1531,
profiling (1.506 ms) : 1482, 1530
. : milestone, 1506,
tracing (1.466 ms) : 1441, 1491
. : milestone, 1466,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section baseline
no_agent (383.863 µs) : 362, 406
. : milestone, 384,
iast (513.249 µs) : 490, 536
. : milestone, 513,
iast_FULL (732.181 µs) : 710, 754
. : milestone, 732,
iast_GLOBAL (555.27 µs) : 534, 577
. : milestone, 555,
iast_HARDCODED_SECRET_DISABLED (513.202 µs) : 491, 535
. : milestone, 513,
iast_INACTIVE (465.278 µs) : 443, 488
. : milestone, 465,
iast_TELEMETRY_OFF (497.52 µs) : 475, 520
. : milestone, 498,
tracing (462.568 µs) : 441, 484
. : milestone, 463,
section candidate
no_agent (381.979 µs) : 362, 402
. : milestone, 382,
iast (509.537 µs) : 488, 531
. : milestone, 510,
iast_FULL (729.095 µs) : 707, 751
. : milestone, 729,
iast_GLOBAL (563.713 µs) : 541, 587
. : milestone, 564,
iast_HARDCODED_SECRET_DISABLED (521.202 µs) : 498, 544
. : milestone, 521,
iast_INACTIVE (466.372 µs) : 445, 488
. : milestone, 466,
iast_TELEMETRY_OFF (505.665 µs) : 482, 529
. : milestone, 506,
tracing (453.152 µs) : 433, 474
. : milestone, 453,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section baseline
no_agent (1.468 ms) : 1456, 1479
. : milestone, 1468,
appsec (2.358 ms) : 2314, 2401
. : milestone, 2358,
iast (2.112 ms) : 2057, 2168
. : milestone, 2112,
iast_GLOBAL (2.152 ms) : 2097, 2208
. : milestone, 2152,
profiling (1.969 ms) : 1924, 2014
. : milestone, 1969,
tracing (1.934 ms) : 1892, 1977
. : milestone, 1934,
section candidate
no_agent (1.469 ms) : 1457, 1481
. : milestone, 1469,
appsec (2.361 ms) : 2317, 2405
. : milestone, 2361,
iast (2.111 ms) : 2056, 2167
. : milestone, 2111,
iast_GLOBAL (2.152 ms) : 2096, 2208
. : milestone, 2152,
profiling (1.963 ms) : 1920, 2007
. : milestone, 1963,
tracing (1.941 ms) : 1898, 1983
. : milestone, 1941,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~153aaecf0f, baseline=1.47.0-SNAPSHOT~5a2c959566
dateFormat X
axisFormat %s
section baseline
no_agent (15.552 s) : 15552000, 15552000
. : milestone, 15552000,
appsec (15.098 s) : 15098000, 15098000
. : milestone, 15098000,
iast (19.142 s) : 19142000, 19142000
. : milestone, 19142000,
iast_GLOBAL (18.068 s) : 18068000, 18068000
. : milestone, 18068000,
profiling (14.884 s) : 14884000, 14884000
. : milestone, 14884000,
tracing (14.811 s) : 14811000, 14811000
. : milestone, 14811000,
section candidate
no_agent (14.796 s) : 14796000, 14796000
. : milestone, 14796000,
appsec (15.148 s) : 15148000, 15148000
. : milestone, 15148000,
iast (18.41 s) : 18410000, 18410000
. : milestone, 18410000,
iast_GLOBAL (18.076 s) : 18076000, 18076000
. : milestone, 18076000,
profiling (15.196 s) : 15196000, 15196000
. : milestone, 15196000,
tracing (15.111 s) : 15111000, 15111000
. : milestone, 15111000,
|
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.
My 2 cents feedback would be do have Javadoc about this implementation.
What’s different from the JDK Semaphore other than being non-blocking? What’s the difference with the tryAcquire()
method?
It would help with people using it 🙏
3e615a7
to
153aaec
Compare
@PerfectSlayer As discussed offline, this move just inertia as this is what we were using in IAST. For IAST, we have a |
What Does This Do
NonBlockingSemaphore
tointernal-api
.release
for the boolean semaphore truly atomic. By definition, a release there always leads to1
available. While first releasing and then getting the available count will return0
or1
inconsistently.Motivation
NonBlockingSemaphore
was written originally for IAST, but we plan to reuse it in AppSec (#8178), and it may be useful for others.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]