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] Dont deserialize rcm payloads until they are needed for memory optimization #5296

Merged
merged 5 commits into from
Apr 11, 2024

Conversation

anna-git
Copy link
Contributor

@anna-git anna-git commented Mar 11, 2024

Summary of changes

Make ConfigurationStatus class smaller in memory by not deserializing payloads if ASM is disabled
Only deserialize payloads if necessary. Store payloads for when activation happens.

Reason for change

Configuration status too big in memory when appsec disabled

Implementation details

before
config status master

after
config status branch

Test coverage

Other details

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Mar 11, 2024

Datadog Report

Branch report: anna/asm/rcm-payload-lazy
Commit report: 95d7792
Test service: dd-trace-dotnet

❌ 135 Failed (0 Known Flaky), 330141 Passed, 1498 Skipped, 59m 19.74s Wall Time

❌ Failed Tests (135)

This report shows up to 5 failed tests.

  • TestBlockingAction - Datadog.Trace.Security.IntegrationTests.Rcm.AspNetCore5AsmActionsConfiguration - Details

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5AsmActionsConfiguration.__type=block_request_statusCode=200.received.txt
     Verified: Security.AspNetCore5AsmActionsConfiguration.__type=block_request_statusCode=200.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    
  • TestBlockingAction - Datadog.Trace.Security.IntegrationTests.Rcm.AspNetCore5AsmActionsConfiguration - Details

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.received.txt
     Verified: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    
  • TestBlockingAction - Datadog.Trace.Security.IntegrationTests.Rcm.AspNetCore5AsmActionsConfiguration - Details

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5AsmActionsConfiguration.__type=block_request_statusCode=200.received.txt
     Verified: Security.AspNetCore5AsmActionsConfiguration.__type=block_request_statusCode=200.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    
  • TestBlockingAction - Datadog.Trace.Security.IntegrationTests.Rcm.AspNetCore5AsmActionsConfiguration - Details

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.received.txt
     Verified: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    
  • TestBlockingAction - Datadog.Trace.Security.IntegrationTests.Rcm.AspNetCore5AsmActionsConfiguration - Details

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.received.txt
     Verified: Security.AspNetCore5AsmActionsConfiguration.__type=redirect_request_statusCode=302.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    

@andrewlock
Copy link
Member

andrewlock commented Mar 11, 2024

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 (5296) - mean (75ms)  : 62, 87
     .   : milestone, 75,
    master - mean (74ms)  : 63, 84
     .   : milestone, 74,

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (1,017ms)  : 998, 1036
     .   : milestone, 1017,
    master - mean (1,020ms)  : 999, 1040
     .   : milestone, 1020,

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

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (744ms)  : 729, 758
     .   : milestone, 744,
    master - mean (739ms)  : 724, 755
     .   : milestone, 739,

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

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (694ms)  : 673, 715
     .   : milestone, 694,
    master - mean (696ms)  : 678, 714
     .   : milestone, 696,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5296) - mean (188ms)  : 185, 192
     .   : milestone, 188,
    master - mean (188ms)  : 185, 192
     .   : milestone, 188,

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (1,096ms)  : 1073, 1119
     .   : milestone, 1096,
    master - mean (1,099ms)  : 1080, 1117
     .   : milestone, 1099,

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

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (892ms)  : 869, 916
     .   : milestone, 892,
    master - mean (895ms)  : 877, 914
     .   : milestone, 895,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5296) - mean (260ms)  : 256, 264
     .   : milestone, 260,
    master - mean (261ms)  : 258, 264
     .   : milestone, 261,

    section CallTarget+Inlining+NGEN
    This PR (5296) - mean (872ms)  : 847, 898
     .   : milestone, 872,
    master - mean (883ms)  : 856, 911
     .   : milestone, 883,

Loading

@anna-git anna-git force-pushed the anna/asm/rcm-payload-lazy branch 2 times, most recently from 7f31f2c to 6bc80dd Compare March 26, 2024 10:11
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Mar 26, 2024

Datadog Report

Branch report: anna/asm/rcm-payload-lazy
Commit report: ee10989
Test service: dd-trace-dotnet

✅ 0 Failed, 328069 Passed, 1506 Skipped, 50m 39.29s Wall Time

@andrewlock
Copy link
Member

andrewlock commented Mar 26, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #5296 compared to master:

  • All benchmarks have the same speed
  • 1 benchmarks have fewer 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 8.61μs 43.6ns 214ns 0.0262 0.0131 0 7.54 KB
master StartStopWithChild netcoreapp3.1 10.5μs 53.9ns 259ns 0.0264 0.0105 0 7.63 KB
master StartStopWithChild net472 17μs 64.6ns 250ns 1.35 0.376 0.12 8.07 KB
#5296 StartStopWithChild net6.0 8.57μs 47.4ns 307ns 0.0225 0.009 0 7.53 KB
#5296 StartStopWithChild netcoreapp3.1 10.7μs 53.7ns 234ns 0.032 0.016 0 7.63 KB
#5296 StartStopWithChild net472 16.7μs 39.6ns 148ns 1.34 0.361 0.109 8.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 450μs 449ns 1.74μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 622μs 308ns 1.19μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 818μs 611ns 2.37μs 0.406 0 0 3.3 KB
#5296 WriteAndFlushEnrichedTraces net6.0 458μs 354ns 1.32μs 0 0 0 2.7 KB
#5296 WriteAndFlushEnrichedTraces netcoreapp3.1 643μs 264ns 914ns 0 0 0 2.7 KB
#5296 WriteAndFlushEnrichedTraces net472 817μs 507ns 1.9μs 0.406 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 168μs 290ns 1.12μs 0.17 0 0 18.38 KB
master SendRequest netcoreapp3.1 192μs 301ns 1.17μs 0.191 0 0 20.54 KB
master SendRequest net472 0.000434ns 0.000182ns 0.000657ns 0 0 0 0 b
#5296 SendRequest net6.0 176μs 228ns 883ns 0.175 0 0 18.38 KB
#5296 SendRequest netcoreapp3.1 192μs 232ns 900ns 0.193 0 0 20.54 KB
#5296 SendRequest net472 0.00212ns 0.000606ns 0.00235ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5296

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.96 KB 41.64 KB -324 B -0.77%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 576μs 1.35μs 5.22μs 0.548 0 0 41.84 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 943ns 3.53μs 0.331 0 0 41.96 KB
master WriteAndFlushEnrichedTraces net472 871μs 4.33μs 19.4μs 8.08 2.55 0.425 53.21 KB
#5296 WriteAndFlushEnrichedTraces net6.0 559μs 900ns 3.48μs 0.53 0 0 41.7 KB
#5296 WriteAndFlushEnrichedTraces netcoreapp3.1 666μs 1.47μs 5.68μs 0.336 0 0 41.64 KB
#5296 WriteAndFlushEnrichedTraces net472 850μs 4.03μs 16.6μs 8.3 2.62 0.437 53.24 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.13μs 0.664ns 2.48ns 0.0113 0 0 800 B
master ExecuteNonQuery netcoreapp3.1 1.59μs 0.427ns 1.54ns 0.0104 0 0 800 B
master ExecuteNonQuery net472 1.81μs 0.399ns 1.54ns 0.121 0 0 762 B
#5296 ExecuteNonQuery net6.0 1.1μs 0.346ns 1.34ns 0.0111 0 0 800 B
#5296 ExecuteNonQuery netcoreapp3.1 1.45μs 1.81ns 7.01ns 0.0104 0 0 800 B
#5296 ExecuteNonQuery net472 1.89μs 1.34ns 5.2ns 0.12 0 0 762 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.3μs 0.503ns 1.88ns 0.0143 0 0 1.02 KB
master CallElasticsearch netcoreapp3.1 1.6μs 0.481ns 1.8ns 0.0138 0 0 1.02 KB
master CallElasticsearch net472 2.6μs 1.47ns 5.48ns 0.164 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.46μs 0.873ns 3.27ns 0.0138 0 0 1 KB
master CallElasticsearchAsync netcoreapp3.1 1.68μs 0.739ns 2.86ns 0.0142 0 0 1.07 KB
master CallElasticsearchAsync net472 2.66μs 1.52ns 5.7ns 0.172 0 0 1.09 KB
#5296 CallElasticsearch net6.0 1.3μs 1.94ns 7.52ns 0.0142 0 0 1.02 KB
#5296 CallElasticsearch netcoreapp3.1 1.6μs 0.537ns 1.94ns 0.0136 0 0 1.02 KB
#5296 CallElasticsearch net472 2.67μs 2.33ns 9.01ns 0.164 0 0 1.04 KB
#5296 CallElasticsearchAsync net6.0 1.4μs 0.825ns 3.09ns 0.0135 0 0 1 KB
#5296 CallElasticsearchAsync netcoreapp3.1 1.8μs 1.06ns 3.97ns 0.0144 0 0 1.07 KB
#5296 CallElasticsearchAsync net472 2.62μs 1.79ns 6.94ns 0.173 0 0 1.09 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.33μs 1.33ns 5.15ns 0.0128 0 0 944 B
master ExecuteAsync netcoreapp3.1 1.82μs 0.765ns 2.86ns 0.0126 0 0 944 B
master ExecuteAsync net472 1.96μs 0.502ns 1.88ns 0.144 0 0 907 B
#5296 ExecuteAsync net6.0 1.32μs 1ns 3.74ns 0.0132 0 0 944 B
#5296 ExecuteAsync netcoreapp3.1 1.76μs 0.408ns 1.47ns 0.0124 0 0 944 B
#5296 ExecuteAsync net472 1.96μs 0.691ns 2.58ns 0.144 0 0 907 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.09μs 1.77ns 6.62ns 0.0295 0 0 2.18 KB
master SendAsync netcoreapp3.1 5.05μs 1.98ns 7.4ns 0.0354 0 0 2.71 KB
master SendAsync net472 7.69μs 1.95ns 7.3ns 0.485 0 0 3.07 KB
#5296 SendAsync net6.0 4.28μs 2.89ns 11.2ns 0.0299 0 0 2.18 KB
#5296 SendAsync netcoreapp3.1 5.16μs 13.2ns 49.4ns 0.0358 0 0 2.71 KB
#5296 SendAsync net472 7.79μs 4.67ns 18.1ns 0.486 0 0 3.07 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.6μs 0.901ns 3.49ns 0.0235 0 0 1.68 KB
master EnrichedLog netcoreapp3.1 2.25μs 1.05ns 3.94ns 0.023 0 0 1.68 KB
master EnrichedLog net472 2.7μs 0.736ns 2.55ns 0.255 0 0 1.61 KB
#5296 EnrichedLog net6.0 1.54μs 0.612ns 2.29ns 0.0236 0 0 1.68 KB
#5296 EnrichedLog netcoreapp3.1 2.14μs 0.843ns 3.15ns 0.0226 0 0 1.68 KB
#5296 EnrichedLog net472 2.76μs 2.72ns 10.5ns 0.255 0 0 1.61 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 112μs 86.6ns 336ns 0.0565 0 0 4.26 KB
master EnrichedLog netcoreapp3.1 117μs 103ns 398ns 0.0589 0 0 4.26 KB
master EnrichedLog net472 146μs 83ns 311ns 0.66 0.22 0 4.45 KB
#5296 EnrichedLog net6.0 113μs 110ns 426ns 0.0563 0 0 4.26 KB
#5296 EnrichedLog netcoreapp3.1 118μs 185ns 716ns 0 0 0 4.26 KB
#5296 EnrichedLog net472 146μs 67.1ns 251ns 0.661 0.22 0 4.44 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.02μs 1.18ns 4.56ns 0.0319 0 0 2.24 KB
master EnrichedLog netcoreapp3.1 4.15μs 1.86ns 6.97ns 0.0293 0 0 2.24 KB
master EnrichedLog net472 5.03μs 1.84ns 7.11ns 0.324 0 0 2.05 KB
#5296 EnrichedLog net6.0 3.04μs 1.64ns 6.14ns 0.0305 0 0 2.24 KB
#5296 EnrichedLog netcoreapp3.1 4.33μs 2.33ns 9.04ns 0.0302 0 0 2.24 KB
#5296 EnrichedLog net472 5μs 1.77ns 6.85ns 0.325 0 0 2.05 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.51μs 0.833ns 3.12ns 0.0165 0 0 1.19 KB
master SendReceive netcoreapp3.1 1.81μs 0.705ns 2.64ns 0.0163 0 0 1.19 KB
master SendReceive net472 2.29μs 1.22ns 4.56ns 0.19 0 0 1.2 KB
#5296 SendReceive net6.0 1.42μs 0.669ns 2.5ns 0.0163 0 0 1.19 KB
#5296 SendReceive netcoreapp3.1 1.84μs 0.879ns 3.17ns 0.0165 0 0 1.19 KB
#5296 SendReceive net472 2.31μs 2.31ns 8.96ns 0.189 0.00115 0 1.2 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.63μs 0.715ns 2.58ns 0.0224 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 3.97μs 1.31ns 4.92ns 0.022 0 0 1.63 KB
master EnrichedLog net472 4.56μs 2.37ns 9.16ns 0.319 0 0 2.02 KB
#5296 EnrichedLog net6.0 2.85μs 0.959ns 3.71ns 0.0214 0 0 1.58 KB
#5296 EnrichedLog netcoreapp3.1 4.01μs 2.44ns 9.46ns 0.0219 0 0 1.63 KB
#5296 EnrichedLog net472 4.39μs 3.38ns 13.1ns 0.32 0 0 2.02 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 543ns 0.926ns 3.47ns 0.00789 0 0 568 B
master StartFinishSpan netcoreapp3.1 744ns 1.51ns 5.85ns 0.00758 0 0 568 B
master StartFinishSpan net472 742ns 1.34ns 5.19ns 0.0902 0 0 570 B
master StartFinishScope net6.0 589ns 0.77ns 2.88ns 0.00948 0 0 688 B
master StartFinishScope netcoreapp3.1 832ns 4.19ns 18.7ns 0.00914 0 0 688 B
master StartFinishScope net472 976ns 2.66ns 10.3ns 0.103 0 0 650 B
#5296 StartFinishSpan net6.0 537ns 0.982ns 3.8ns 0.00786 0 0 568 B
#5296 StartFinishSpan netcoreapp3.1 738ns 0.841ns 3.15ns 0.00788 0 0 568 B
#5296 StartFinishSpan net472 757ns 1.45ns 5.63ns 0.0904 0 0 570 B
#5296 StartFinishScope net6.0 541ns 0.795ns 2.97ns 0.00972 0 0 688 B
#5296 StartFinishScope netcoreapp3.1 865ns 0.917ns 3.55ns 0.00927 0 0 688 B
#5296 StartFinishScope net472 979ns 1.9ns 7.36ns 0.103 0 0 650 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 674ns 0.877ns 3.16ns 0.00948 0 0 688 B
master RunOnMethodBegin netcoreapp3.1 957ns 3.5ns 13.6ns 0.00927 0 0 688 B
master RunOnMethodBegin net472 1.05μs 2.65ns 10.3ns 0.103 0 0 650 B
#5296 RunOnMethodBegin net6.0 626ns 1.52ns 5.88ns 0.0097 0 0 688 B
#5296 RunOnMethodBegin netcoreapp3.1 1.05μs 2ns 7.73ns 0.00901 0 0 688 B
#5296 RunOnMethodBegin net472 1.09μs 1.9ns 7.12ns 0.103 0 0 650 B

@andrewlock
Copy link
Member

andrewlock commented Mar 26, 2024

Benchmarks Report for appsec 🐌

Benchmarks for #5296 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.206
  • 1 benchmarks are slower, with geometric mean 1.193
  • 3 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 - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #5296

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody‑net472 1.193 3,753.10 4,476.74

Faster 🎉 in #5296

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑net6.0 1.307 194.63 148.88
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑netcoreapp3.1 1.119 260.82 233.06

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 70.6μs 114ns 442ns 0.0707 0 0 5.99 KB
master AllCycleSimpleBody netcoreapp3.1 62.9μs 82.8ns 321ns 0.0623 0 0 6.93 KB
master AllCycleSimpleBody net472 48.7μs 51.4ns 192ns 1.31 0 0 8.32 KB
master AllCycleMoreComplexBody net6.0 78μs 126ns 490ns 0.117 0 0 9.49 KB
master AllCycleMoreComplexBody netcoreapp3.1 70.1μs 98.8ns 370ns 0.14 0 0 10.35 KB
master AllCycleMoreComplexBody net472 56.2μs 54.1ns 209ns 1.88 0.0281 0 11.83 KB
master ObjectExtractorSimpleBody net6.0 194ns 0.135ns 0.523ns 0.00391 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 261ns 0.143ns 0.553ns 0.00365 0 0 272 B
master ObjectExtractorSimpleBody net472 161ns 0.118ns 0.457ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.07μs 1.98ns 7.39ns 0.0522 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.02μs 2.36ns 8.5ns 0.0489 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.75μs 4.12ns 15.9ns 0.602 0.00565 0 3.8 KB
#5296 AllCycleSimpleBody net6.0 70.9μs 109ns 420ns 0.0707 0 0 5.99 KB
#5296 AllCycleSimpleBody netcoreapp3.1 62.8μs 78.6ns 304ns 0.0936 0 0 6.93 KB
#5296 AllCycleSimpleBody net472 48.6μs 79.7ns 309ns 1.31 0 0 8.32 KB
#5296 AllCycleMoreComplexBody net6.0 76.8μs 165ns 618ns 0.115 0 0 9.49 KB
#5296 AllCycleMoreComplexBody netcoreapp3.1 69.8μs 86.2ns 334ns 0.138 0 0 10.35 KB
#5296 AllCycleMoreComplexBody net472 55.9μs 49.7ns 186ns 1.86 0.0282 0 11.83 KB
#5296 ObjectExtractorSimpleBody net6.0 149ns 0.152ns 0.588ns 0.00392 0 0 280 B
#5296 ObjectExtractorSimpleBody netcoreapp3.1 233ns 0.146ns 0.566ns 0.00367 0 0 272 B
#5296 ObjectExtractorSimpleBody net472 172ns 0.2ns 0.774ns 0.0445 0 0 281 B
#5296 ObjectExtractorMoreComplexBody net6.0 3.01μs 1.84ns 7.13ns 0.053 0 0 3.78 KB
#5296 ObjectExtractorMoreComplexBody netcoreapp3.1 3.91μs 2.34ns 9.07ns 0.049 0 0 3.69 KB
#5296 ObjectExtractorMoreComplexBody net472 4.48μs 1.4ns 5.43ns 0.602 0.00448 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 39.6μs 19.4ns 72.7ns 0.455 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 55.8μs 27.3ns 106ns 0.417 0 0 32.4 KB
master EncodeArgs net472 70.9μs 27.6ns 103ns 5.16 0.0707 0 32.5 KB
master EncodeLegacyArgs net6.0 76.6μs 42.9ns 166ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 109μs 421ns 1.63μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 158μs 106ns 397ns 0.315 0 0 2.15 KB
#5296 EncodeArgs net6.0 40.5μs 23.1ns 89.5ns 0.445 0 0 32.4 KB
#5296 EncodeArgs netcoreapp3.1 55.4μs 19.7ns 76.3ns 0.441 0 0 32.4 KB
#5296 EncodeArgs net472 70.9μs 36.5ns 141ns 5.16 0.0706 0 32.5 KB
#5296 EncodeLegacyArgs net6.0 74.3μs 400ns 2.19μs 0 0 0 2.14 KB
#5296 EncodeLegacyArgs netcoreapp3.1 103μs 56.9ns 205ns 0 0 0 2.14 KB
#5296 EncodeLegacyArgs net472 158μs 93.9ns 364ns 0.316 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 182μs 90.7ns 339ns 0 0 0 2.13 KB
master RunWafRealisticBenchmark netcoreapp3.1 197μs 125ns 467ns 0 0 0 2.1 KB
master RunWafRealisticBenchmark net472 215μs 65.5ns 245ns 0.323 0 0 2.17 KB
master RunWafRealisticBenchmarkWithAttack net6.0 122μs 127ns 476ns 0 0 0 1.37 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 129μs 79.2ns 296ns 0 0 0 1.36 KB
master RunWafRealisticBenchmarkWithAttack net472 141μs 72.4ns 271ns 0.212 0 0 1.39 KB
#5296 RunWafRealisticBenchmark net6.0 181μs 85.1ns 318ns 0 0 0 2.13 KB
#5296 RunWafRealisticBenchmark netcoreapp3.1 196μs 152ns 546ns 0 0 0 2.1 KB
#5296 RunWafRealisticBenchmark net472 215μs 90.2ns 349ns 0.32 0 0 2.17 KB
#5296 RunWafRealisticBenchmarkWithAttack net6.0 122μs 62.5ns 242ns 0 0 0 1.37 KB
#5296 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 130μs 106ns 409ns 0 0 0 1.36 KB
#5296 RunWafRealisticBenchmarkWithAttack net472 142μs 76.6ns 297ns 0.211 0 0 1.39 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #5296

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 1.198 63,800.00 53,250.00 bimodal

More allocations ⚠️ in #5296

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 202.74 KB 213.95 KB 11.21 KB 5.53%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.9 KB 59.04 KB 1.14 KB 1.98%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 202.7 KB 203.93 KB 1.23 KB 0.61%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 64.4μs 783ns 7.83μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 54μs 160ns 553ns 0 0 0 42.64 KB
master StringConcatBenchmark net472 38.5μs 199ns 932ns 0 0 0 57.9 KB
master StringConcatAspectBenchmark net6.0 290μs 1.37μs 8.57μs 0 0 0 202.74 KB
master StringConcatAspectBenchmark netcoreapp3.1 281μs 5.73μs 55.5μs 0 0 0 202.7 KB
master StringConcatAspectBenchmark net472 269μs 5.36μs 52.5μs 0 0 0 221.18 KB
#5296 StringConcatBenchmark net6.0 53.4μs 173ns 601ns 0 0 0 43.44 KB
#5296 StringConcatBenchmark netcoreapp3.1 58.3μs 602ns 5.9μs 0 0 0 42.64 KB
#5296 StringConcatBenchmark net472 38.3μs 109ns 392ns 0 0 0 59.04 KB
#5296 StringConcatAspectBenchmark net6.0 291μs 6.1μs 60μs 0 0 0 213.95 KB
#5296 StringConcatAspectBenchmark netcoreapp3.1 316μs 1.21μs 7.46μs 0 0 0 203.93 KB
#5296 StringConcatAspectBenchmark net472 264μs 5.48μs 52.3μs 0 0 0 221.18 KB

@anna-git anna-git force-pushed the anna/asm/rcm-payload-lazy branch 3 times, most recently from dbc89b9 to aeb9372 Compare March 28, 2024 16:56
@anna-git anna-git marked this pull request as ready for review March 28, 2024 16:57
@anna-git anna-git requested a review from a team as a code owner March 28, 2024 16:57
@andrewlock
Copy link
Member

Throughput/Crank Report:zap:

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 (5296) (11.293M)   : 0, 11293221
    master (11.162M)   : 0, 11161514
    benchmarks/2.9.0 (11.327M)   : 0, 11326637

    section Automatic
    This PR (5296) (7.780M)   : 0, 7779962
    master (7.582M)   : 0, 7581776
    benchmarks/2.9.0 (8.199M)   : 0, 8199353

    section Trace stats
    This PR (5296) (7.986M)   : 0, 7986045
    master (7.813M)   : 0, 7813112

    section Manual
    This PR (5296) (9.691M)   : 0, 9690615
    master (9.672M)   : 0, 9671751

    section Manual + Automatic
    This PR (5296) (7.416M)   : 0, 7415947
    master (5.852M)   : 0, 5852140

    section Version Conflict
    This PR (5296) (6.657M)   : 0, 6656718
    master (6.656M)   : 0, 6655808

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5296) (9.682M)   : 0, 9682433
    master (9.658M)   : 0, 9657835
    benchmarks/2.9.0 (9.520M)   : 0, 9520488

    section Automatic
    This PR (5296) (6.669M)   : 0, 6669110
    master (6.405M)   : 0, 6405145

    section Trace stats
    This PR (5296) (6.862M)   : 0, 6862443
    master (6.843M)   : 0, 6843489

    section Manual
    This PR (5296) (8.463M)   : 0, 8463208
    master (8.442M)   : 0, 8442201

    section Manual + Automatic
    This PR (5296) (6.269M)   : 0, 6268564
    master (6.186M)   : 0, 6185868

    section Version Conflict
    This PR (5296) (5.570M)   : 0, 5569555
    master (5.785M)   : 0, 5785434

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5296) (9.819M)   : 0, 9819378
    benchmarks/2.9.0 (9.798M)   : 0, 9797854

    section Automatic
    This PR (5296) (6.976M)   : 0, 6975824
    benchmarks/2.9.0 (7.323M)   : 0, 7323469

    section Trace stats
    This PR (5296) (7.284M)   : 0, 7283580

    section Manual
    This PR (5296) (8.627M)   : 0, 8627406

    section Manual + Automatic
    This PR (5296) (6.651M)   : 0, 6651180

    section Version Conflict
    This PR (5296) (6.116M)   : 0, 6115670

Loading

@anna-git anna-git force-pushed the anna/asm/rcm-payload-lazy branch 3 times, most recently from 8282643 to 09590ce Compare April 10, 2024 15:10
/// <returns>whether or not there is any change, i.e any update/removal</returns>
public bool StoreLastConfigState(Dictionary<string, List<RemoteConfiguration>> configsByProduct, Dictionary<string, List<RemoteConfigurationPath>>? removedConfigs)
{
_fileUpdates.Clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Is this thread safe? I'm not sure if a lock wouldn't hurt here and in ApplyStoredFiles()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So rcm updates are not multi threaded, everything is pulled on one thread, and sequentially every x seconds

Copy link
Contributor

@daniel-romano-DD daniel-romano-DD left a comment

Choose a reason for hiding this comment

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

LGTM

@anna-git anna-git merged commit c041d45 into master Apr 11, 2024
55 of 58 checks passed
@anna-git anna-git deleted the anna/asm/rcm-payload-lazy branch April 11, 2024 13:09
@github-actions github-actions bot added this to the vNext-v2 milestone Apr 11, 2024
@andrewlock andrewlock added the type:performance Performance, speed, latency, resource usage (CPU, memory) label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:asm type:performance Performance, speed, latency, resource usage (CPU, memory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants