Skip to content
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

[ASM] Fix exception when accessing ReportedExternalWafsRequestHeaders #6030

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NachoEchevarria
Copy link
Contributor

@NachoEchevarria NachoEchevarria commented Sep 13, 2024

Summary of changes

This PR is closely related to this one

In this case, the error is thrown when accessing the key ReportedExternalWafsRequestHeaders

No other httpRequest.Items problematic accesses have been found.

This error can happen only in netcore versions of the framework. When we access httpcontext.Items, the exception is thrown if the key is not found. httpcontext.Items is defined as a IDictionary<object, object>. Usually, it will be a Microsoft.AspNetCore.Http.ItemsDictionary, which does not throw an exception when trying to retrieve a key that is not stored, but other custom implementations such as Dictionary<object, object> will throw it. It seems that in one customer, we are receiving a context in which Items is a Dictionary.

This might be due to custom middlewares, third party extensions, use of custom http contexts, etc.

Reason for change

Implementation details

Test coverage

Other details

@andrewlock
Copy link
Member

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (69ms)  : 67, 71
     .   : milestone, 69,
    master - mean (70ms)  : 67, 74
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (1,114ms)  : 1090, 1138
     .   : milestone, 1114,
    master - mean (1,117ms)  : 1094, 1140
     .   : milestone, 1117,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (109ms)  : 106, 112
     .   : milestone, 109,
    master - mean (108ms)  : 105, 111
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (810ms)  : 798, 822
     .   : milestone, 810,
    master - mean (816ms)  : 802, 831
     .   : milestone, 816,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (92ms)  : 90, 95
     .   : milestone, 92,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (768ms)  : 750, 786
     .   : milestone, 768,
    master - mean (769ms)  : 751, 787
     .   : milestone, 769,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (190ms)  : 187, 194
     .   : milestone, 190,
    master - mean (191ms)  : 187, 195
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (1,197ms)  : 1172, 1223
     .   : milestone, 1197,
    master - mean (1,199ms)  : 1168, 1229
     .   : milestone, 1199,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (278ms)  : 272, 285
     .   : milestone, 278,
    master - mean (276ms)  : 271, 281
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (972ms)  : 950, 995
     .   : milestone, 972,
    master - mean (975ms)  : 955, 994
     .   : milestone, 975,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6030) - mean (265ms)  : 261, 269
     .   : milestone, 265,
    master - mean (265ms)  : 259, 271
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (6030) - mean (952ms)  : 933, 971
     .   : milestone, 952,
    master - mean (948ms)  : 923, 973
     .   : milestone, 948,

Loading

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Sep 13, 2024

Datadog Report

Branch report: nacho/ReportedExternalWafsRequestHeaders
Commit report: 76cef2f
Test service: dd-trace-dotnet

❌ 761 Failed (0 Known Flaky), 366304 Passed, 2000 Skipped, 16h 56m 39.34s Total Time
⌛ 4 Performance Regressions

❌ Failed Tests (761)

This report shows up to 5 failed tests.

  • TestApiSecurityScan - Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled - Details

    Expand for error
     [Test Class Cleanup Failure (Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled)]: System.Net.WebException : Address not available [::1]:38029 (localhost:38029)
     ---- System.Net.Http.HttpRequestException : Address not available [::1]:38029 (localhost:38029)
     -------- System.Net.Sockets.SocketException : Address not available [::1]:38029
    
  • TestApiSecurityScan - Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled - Details

    Expand for error
     [Test Class Cleanup Failure (Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled)]: System.Net.WebException : Address not available Address not available
     ---- System.Net.Http.HttpRequestException : Address not available
     -------- System.Net.Sockets.SocketException : Address not available
    
  • TestApiSecurityScan - Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled

  • TestApiSecurityScan - Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled

  • TestApiSecurityScan - Datadog.Trace.Security.IntegrationTests.ApiSecurity.AspNetCore5ApiSecurityDisabled - Details

    Expand for error
     Couldn't verify the application is ready to receive requests.
    

⌛ Performance Regressions vs Default Branch (4)

  • WriteAndFlushEnrichedTraces - Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark 709.47µs (+142.86µs, +25%) - Details
  • WriteAndFlushEnrichedTraces - Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark 833.61µs (+146.87µs, +21%) - Details
  • WriteAndFlushEnrichedTraces - Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark 961.41µs (+89.52µs, +10%) - Details
  • SendRequest - Benchmarks.Trace.AspNetCoreBenchmark 0s (+0s, +2976%) - Details

@NachoEchevarria NachoEchevarria changed the title Fix [ASM] Fix exception when accessing ReportedExternalWafsRequestHeaders Sep 13, 2024
@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6030 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.151
  • 3 benchmarks are slower, with geometric mean 1.227
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.73μs 42.2ns 260ns 0.0192 0.0077 0 5.43 KB
master StartStopWithChild netcoreapp3.1 10μs 54.6ns 345ns 0.0147 0.0049 0 5.61 KB
master StartStopWithChild net472 16.1μs 52.8ns 204ns 1.03 0.312 0.0961 6.07 KB
#6030 StartStopWithChild net6.0 8.08μs 46.2ns 330ns 0.012 0.00401 0 5.43 KB
#6030 StartStopWithChild netcoreapp3.1 9.67μs 49ns 225ns 0.0239 0.00956 0 5.62 KB
#6030 StartStopWithChild net472 15.9μs 28.9ns 112ns 1.02 0.307 0.0946 6.07 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 475μs 346ns 1.34μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 630μs 268ns 1.04μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 843μs 723ns 2.8μs 0.419 0 0 3.3 KB
#6030 WriteAndFlushEnrichedTraces net6.0 482μs 237ns 918ns 0 0 0 2.7 KB
#6030 WriteAndFlushEnrichedTraces netcoreapp3.1 623μs 446ns 1.67μs 0 0 0 2.7 KB
#6030 WriteAndFlushEnrichedTraces net472 831μs 561ns 2.02μs 0.414 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 195μs 1.06μs 7.09μs 0.191 0 0 18.45 KB
master SendRequest netcoreapp3.1 223μs 1.3μs 11.8μs 0.209 0 0 20.61 KB
master SendRequest net472 0.000119ns 9.03E‑05ns 0.000338ns 0 0 0 0 b
#6030 SendRequest net6.0 196μs 1.13μs 9.21μs 0.191 0 0 18.45 KB
#6030 SendRequest netcoreapp3.1 207μs 741ns 2.77μs 0.206 0 0 20.61 KB
#6030 SendRequest net472 0.0788ns 0.0172ns 0.0942ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6030

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 1.284 552,229.08 709,055.08
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.248 667,804.76 833,146.19

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 555μs 2.68μs 11.7μs 0.571 0 0 41.51 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 3.27μs 13.5μs 0.331 0 0 41.68 KB
master WriteAndFlushEnrichedTraces net472 867μs 4.09μs 15.9μs 8.33 2.5 0.417 53.3 KB
#6030 WriteAndFlushEnrichedTraces net6.0 709μs 1.05μs 3.78μs 0.355 0 0 41.71 KB
#6030 WriteAndFlushEnrichedTraces netcoreapp3.1 834μs 2.84μs 11μs 0.414 0 0 41.86 KB
#6030 WriteAndFlushEnrichedTraces net472 961μs 2.53μs 9.47μs 8.24 2.42 0.484 53.28 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.34μs 2ns 7.74ns 0.014 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.7μs 2.12ns 8.23ns 0.0138 0 0 1.02 KB
master ExecuteNonQuery net472 2.04μs 2.19ns 8.49ns 0.157 0 0 987 B
#6030 ExecuteNonQuery net6.0 1.57μs 23.1ns 231ns 0.0138 0 0 1.02 KB
#6030 ExecuteNonQuery netcoreapp3.1 1.75μs 2.06ns 7.99ns 0.0133 0 0 1.02 KB
#6030 ExecuteNonQuery net472 2μs 1.11ns 4.15ns 0.157 0 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.2μs 1.31ns 4.88ns 0.0138 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.56μs 0.815ns 3.05ns 0.0126 0 0 976 B
master CallElasticsearch net472 2.46μs 1.4ns 5.43ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.22μs 0.651ns 2.52ns 0.0135 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.63μs 0.433ns 1.62ns 0.0138 0 0 1.02 KB
master CallElasticsearchAsync net472 2.64μs 1.15ns 4.3ns 0.166 0 0 1.05 KB
#6030 CallElasticsearch net6.0 1.15μs 0.825ns 3.09ns 0.0138 0 0 976 B
#6030 CallElasticsearch netcoreapp3.1 1.57μs 0.386ns 1.44ns 0.0134 0 0 976 B
#6030 CallElasticsearch net472 2.5μs 1.29ns 4.83ns 0.157 0 0 995 B
#6030 CallElasticsearchAsync net6.0 1.28μs 0.608ns 2.27ns 0.0134 0 0 952 B
#6030 CallElasticsearchAsync netcoreapp3.1 1.67μs 0.691ns 2.68ns 0.0141 0 0 1.02 KB
#6030 CallElasticsearchAsync net472 2.59μs 1.34ns 5.2ns 0.167 0 0 1.05 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.23μs 1.18ns 4.24ns 0.0136 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.69μs 0.791ns 3.07ns 0.0125 0 0 952 B
master ExecuteAsync net472 1.79μs 0.646ns 2.5ns 0.145 0 0 915 B
#6030 ExecuteAsync net6.0 1.26μs 0.858ns 3.32ns 0.0132 0 0 952 B
#6030 ExecuteAsync netcoreapp3.1 1.66μs 1.28ns 4.95ns 0.0131 0 0 952 B
#6030 ExecuteAsync net472 1.8μs 0.777ns 2.91ns 0.145 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.13μs 1.64ns 6.12ns 0.031 0 0 2.22 KB
master SendAsync netcoreapp3.1 5.16μs 2.53ns 9.79ns 0.036 0 0 2.76 KB
master SendAsync net472 7.82μs 3.3ns 12.8ns 0.499 0 0 3.15 KB
#6030 SendAsync net6.0 4.14μs 2.67ns 9.64ns 0.0311 0 0 2.22 KB
#6030 SendAsync netcoreapp3.1 5.15μs 1.86ns 7.19ns 0.0361 0 0 2.76 KB
#6030 SendAsync net472 7.82μs 1.84ns 6.62ns 0.497 0 0 3.15 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.47μs 1.07ns 4.01ns 0.0233 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.15μs 2.9ns 10.5ns 0.0214 0 0 1.64 KB
master EnrichedLog net472 2.49μs 1.14ns 4.27ns 0.249 0 0 1.57 KB
#6030 EnrichedLog net6.0 1.42μs 0.407ns 1.47ns 0.0231 0 0 1.64 KB
#6030 EnrichedLog netcoreapp3.1 2.25μs 1.13ns 4.24ns 0.0224 0 0 1.64 KB
#6030 EnrichedLog net472 2.48μs 1.35ns 5.22ns 0.249 0 0 1.57 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 114μs 115ns 446ns 0.0573 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 117μs 111ns 431ns 0.0591 0 0 4.28 KB
master EnrichedLog net472 144μs 116ns 448ns 0.649 0.216 0 4.46 KB
#6030 EnrichedLog net6.0 114μs 139ns 538ns 0.0566 0 0 4.28 KB
#6030 EnrichedLog netcoreapp3.1 118μs 151ns 586ns 0.0583 0 0 4.28 KB
#6030 EnrichedLog net472 146μs 92.8ns 359ns 0.656 0.219 0 4.46 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.09μs 0.925ns 3.58ns 0.0309 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.26μs 1.13ns 4.22ns 0.0299 0 0 2.2 KB
master EnrichedLog net472 4.81μs 1.13ns 4.4ns 0.319 0 0 2.02 KB
#6030 EnrichedLog net6.0 3.22μs 0.711ns 2.56ns 0.0306 0 0 2.2 KB
#6030 EnrichedLog netcoreapp3.1 4.31μs 1.99ns 7.7ns 0.03 0 0 2.2 KB
#6030 EnrichedLog net472 4.89μs 1.44ns 5.39ns 0.32 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.35μs 1.5ns 5.82ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.78μs 3.01ns 11.7ns 0.0149 0 0 1.14 KB
master SendReceive net472 2.18μs 0.561ns 2.1ns 0.183 0.00109 0 1.16 KB
#6030 SendReceive net6.0 1.36μs 0.733ns 2.84ns 0.0158 0 0 1.14 KB
#6030 SendReceive netcoreapp3.1 1.68μs 0.833ns 3.23ns 0.0153 0 0 1.14 KB
#6030 SendReceive net472 2.04μs 0.798ns 3.09ns 0.183 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.67μs 1.89ns 7.3ns 0.0228 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.77μs 1.64ns 6.36ns 0.0207 0 0 1.65 KB
master EnrichedLog net472 4.4μs 1.2ns 4.48ns 0.323 0 0 2.04 KB
#6030 EnrichedLog net6.0 2.9μs 5.9ns 22.8ns 0.0219 0 0 1.6 KB
#6030 EnrichedLog netcoreapp3.1 3.87μs 1.72ns 6.66ns 0.0226 0 0 1.65 KB
#6030 EnrichedLog net472 4.34μs 1.61ns 6.02ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6030

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.152 543.89 626.57

Faster 🎉 in #6030

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 1.166 908.63 778.94
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.135 547.20 482.05

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 402ns 0.399ns 1.55ns 0.00805 0 0 576 B
master StartFinishSpan netcoreapp3.1 544ns 0.477ns 1.85ns 0.00789 0 0 576 B
master StartFinishSpan net472 671ns 0.473ns 1.71ns 0.0916 0 0 578 B
master StartFinishScope net6.0 548ns 0.31ns 1.2ns 0.00987 0 0 696 B
master StartFinishScope netcoreapp3.1 757ns 0.599ns 2.32ns 0.00933 0 0 696 B
master StartFinishScope net472 909ns 2.01ns 7.77ns 0.104 0 0 658 B
#6030 StartFinishSpan net6.0 398ns 0.37ns 1.43ns 0.00803 0 0 576 B
#6030 StartFinishSpan netcoreapp3.1 627ns 0.579ns 2.24ns 0.00792 0 0 576 B
#6030 StartFinishSpan net472 640ns 0.619ns 2.4ns 0.0917 0 0 578 B
#6030 StartFinishScope net6.0 482ns 0.378ns 1.47ns 0.00987 0 0 696 B
#6030 StartFinishScope netcoreapp3.1 729ns 0.587ns 2.27ns 0.00977 0 0 696 B
#6030 StartFinishScope net472 778ns 1.93ns 7.48ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 662ns 0.895ns 3.46ns 0.00963 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 909ns 0.908ns 3.52ns 0.00909 0 0 696 B
master RunOnMethodBegin net472 1.17μs 0.451ns 1.69ns 0.104 0 0 658 B
#6030 RunOnMethodBegin net6.0 642ns 0.569ns 2.2ns 0.00979 0 0 696 B
#6030 RunOnMethodBegin netcoreapp3.1 990ns 1.12ns 4.33ns 0.00955 0 0 696 B
#6030 RunOnMethodBegin net472 1.08μs 1.68ns 6.51ns 0.105 0 0 658 B

@andrewlock
Copy link
Member

Benchmarks Report for appsec 🐌

Benchmarks for #6030 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.192
  • 2 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 71.8μs 53.6ns 200ns 0.0715 0 0 6.01 KB
master AllCycleSimpleBody netcoreapp3.1 61.9μs 64.5ns 233ns 0.0926 0 0 6.95 KB
master AllCycleSimpleBody net472 48.1μs 59.5ns 231ns 1.32 0 0 8.34 KB
master AllCycleMoreComplexBody net6.0 78.8μs 67.9ns 263ns 0.116 0 0 9.51 KB
master AllCycleMoreComplexBody netcoreapp3.1 68.4μs 74.8ns 290ns 0.137 0 0 10.36 KB
master AllCycleMoreComplexBody net472 55.4μs 60.3ns 234ns 1.88 0.0276 0 11.85 KB
master ObjectExtractorSimpleBody net6.0 148ns 0.203ns 0.786ns 0.00394 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 196ns 0.141ns 0.526ns 0.00368 0 0 272 B
master ObjectExtractorSimpleBody net472 170ns 0.144ns 0.539ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.08μs 1.65ns 6.19ns 0.0524 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.06μs 1.8ns 6.98ns 0.0489 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 4.3μs 2.4ns 9.31ns 0.602 0.00666 0 3.8 KB
#6030 AllCycleSimpleBody net6.0 73.2μs 128ns 495ns 0.0731 0 0 6.01 KB
#6030 AllCycleSimpleBody netcoreapp3.1 62.2μs 82.4ns 319ns 0.0929 0 0 6.95 KB
#6030 AllCycleSimpleBody net472 48.5μs 57.8ns 216ns 1.31 0 0 8.34 KB
#6030 AllCycleMoreComplexBody net6.0 77μs 66.7ns 258ns 0.115 0 0 9.51 KB
#6030 AllCycleMoreComplexBody netcoreapp3.1 70.1μs 67.4ns 234ns 0.14 0 0 10.37 KB
#6030 AllCycleMoreComplexBody net472 55μs 47.2ns 183ns 1.86 0.0274 0 11.85 KB
#6030 ObjectExtractorSimpleBody net6.0 153ns 0.137ns 0.514ns 0.00397 0 0 280 B
#6030 ObjectExtractorSimpleBody netcoreapp3.1 196ns 0.126ns 0.471ns 0.00365 0 0 272 B
#6030 ObjectExtractorSimpleBody net472 173ns 0.245ns 0.95ns 0.0446 0 0 281 B
#6030 ObjectExtractorMoreComplexBody net6.0 3.03μs 0.863ns 3.11ns 0.0529 0 0 3.78 KB
#6030 ObjectExtractorMoreComplexBody netcoreapp3.1 4.08μs 1.9ns 7.09ns 0.0508 0 0 3.69 KB
#6030 ObjectExtractorMoreComplexBody net472 4.3μs 1.05ns 3.95ns 0.602 0.00643 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 36.9μs 19.2ns 74.4ns 0.458 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 54.2μs 43.4ns 168ns 0.433 0 0 32.4 KB
master EncodeArgs net472 65.3μs 21ns 78.7ns 5.15 0.0652 0 32.5 KB
master EncodeLegacyArgs net6.0 76.1μs 407ns 2.3μs 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 107μs 396ns 1.53μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 152μs 79.6ns 308ns 0.303 0 0 2.15 KB
#6030 EncodeArgs net6.0 36.5μs 12ns 45ns 0.456 0 0 32.4 KB
#6030 EncodeArgs netcoreapp3.1 54.3μs 24.6ns 92.2ns 0.434 0 0 32.4 KB
#6030 EncodeArgs net472 65.5μs 22.5ns 84.2ns 5.16 0.0657 0 32.5 KB
#6030 EncodeLegacyArgs net6.0 78μs 60.4ns 234ns 0.0363 0 0 2.14 KB
#6030 EncodeLegacyArgs netcoreapp3.1 106μs 94.2ns 340ns 0 0 0 2.14 KB
#6030 EncodeLegacyArgs net472 152μs 60.6ns 227ns 0.306 0 0 2.15 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 184μs 167ns 649ns 0 0 0 2.42 KB
master RunWafRealisticBenchmark netcoreapp3.1 200μs 281ns 1.09μs 0 0 0 2.37 KB
master RunWafRealisticBenchmark net472 209μs 119ns 460ns 0.314 0 0 2.43 KB
master RunWafRealisticBenchmarkWithAttack net6.0 124μs 145ns 560ns 0 0 0 1.46 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 130μs 104ns 402ns 0 0 0 1.45 KB
master RunWafRealisticBenchmarkWithAttack net472 140μs 56.1ns 217ns 0.209 0 0 1.48 KB
#6030 RunWafRealisticBenchmark net6.0 186μs 109ns 421ns 0 0 0 2.42 KB
#6030 RunWafRealisticBenchmark netcoreapp3.1 196μs 103ns 399ns 0 0 0 2.37 KB
#6030 RunWafRealisticBenchmark net472 208μs 49.6ns 192ns 0.312 0 0 2.43 KB
#6030 RunWafRealisticBenchmarkWithAttack net6.0 123μs 40.1ns 144ns 0 0 0 1.46 KB
#6030 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 130μs 102ns 397ns 0 0 0 1.45 KB
#6030 RunWafRealisticBenchmarkWithAttack net472 141μs 102ns 396ns 0.211 0 0 1.48 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #6030

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 1.192 50,900.00 60,650.00 bimodal

More allocations ⚠️ in #6030

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 256.65 KB 265.75 KB 9.1 KB 3.55%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.8 KB 59.04 KB 1.24 KB 2.15%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 50.8μs 220ns 793ns 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 59.2μs 766ns 7.55μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.1μs 69.3ns 259ns 0 0 0 57.8 KB
master StringConcatAspectBenchmark net6.0 310μs 1.28μs 7.47μs 0 0 0 256.65 KB
master StringConcatAspectBenchmark netcoreapp3.1 332μs 848ns 3.17μs 0 0 0 254.6 KB
master StringConcatAspectBenchmark net472 278μs 6.01μs 59.2μs 0 0 0 278.53 KB
#6030 StringConcatBenchmark net6.0 61.9μs 874ns 8.57μs 0 0 0 43.44 KB
#6030 StringConcatBenchmark netcoreapp3.1 59.1μs 710ns 7.03μs 0 0 0 42.64 KB
#6030 StringConcatBenchmark net472 37.2μs 69.3ns 250ns 0 0 0 59.04 KB
#6030 StringConcatAspectBenchmark net6.0 316μs 1.68μs 9.23μs 0 0 0 265.75 KB
#6030 StringConcatAspectBenchmark netcoreapp3.1 339μs 1.81μs 11.5μs 0 0 0 253.5 KB
#6030 StringConcatAspectBenchmark net472 280μs 6.13μs 59.1μs 0 0 0 278.53 KB

@andrewlock
Copy link
Member

Throughput/Crank Report ⚡

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6030) (10.939M)   : 0, 10939012
    master (11.336M)   : 0, 11336392
    benchmarks/2.9.0 (11.235M)   : 0, 11234930

    section Automatic
    This PR (6030) (7.379M)   : 0, 7379069
    master (7.351M)   : 0, 7351044
    benchmarks/2.9.0 (7.902M)   : 0, 7901974

    section Trace stats
    master (7.688M)   : 0, 7687619

    section Manual
    master (11.351M)   : 0, 11350869

    section Manual + Automatic
    This PR (6030) (6.750M)   : 0, 6750224
    master (6.919M)   : 0, 6918538

    section DD_TRACE_ENABLED=0
    master (10.183M)   : 0, 10182992

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6030) (9.501M)   : 0, 9501350
    master (9.672M)   : 0, 9671550
    benchmarks/2.9.0 (9.468M)   : 0, 9467847

    section Automatic
    This PR (6030) (6.707M)   : 0, 6707277
    master (6.571M)   : 0, 6570524

    section Trace stats
    master (6.933M)   : 0, 6933225

    section Manual
    master (9.488M)   : 0, 9488486

    section Manual + Automatic
    This PR (6030) (6.164M)   : 0, 6164001
    master (6.144M)   : 0, 6144406

    section DD_TRACE_ENABLED=0
    master (9.097M)   : 0, 9097269

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6030) (10.110M)   : 0, 10110304
    master (10.183M)   : 0, 10182749
    benchmarks/2.9.0 (10.191M)   : 0, 10191280

    section Automatic
    This PR (6030) (6.947M)   : 0, 6947446
    master (6.729M)   : 0, 6728961
    benchmarks/2.9.0 (7.389M)   : 0, 7388665

    section Trace stats
    master (7.261M)   : 0, 7260544

    section Manual
    master (9.954M)   : 0, 9953893

    section Manual + Automatic
    This PR (6030) (6.433M)   : 0, 6433438
    master (6.241M)   : 0, 6240881

    section DD_TRACE_ENABLED=0
    master (9.195M)   : 0, 9195040

Loading

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.

2 participants