Remove the vendored arraypool eventsource#6398
Conversation
andrewlock
left a comment
There was a problem hiding this comment.
We should make sure we bake these modifications into the vendoring tool in some way. Otherwise they're definitely going to be lost if/when we update the vendored code.
At a minimum, we can exclude the ArrayPoolEventSource file when it's vendored in.
In terms of the other modification, maybe it's best to explicitly exclude those too, and move these to somewhere where it's clear we've modified the original sources (so on an update, you'll need to re-apply the changes etc)
Makes sense, done in 2cb74bb |
Datadog ReportBranch report: ✅ 0 Failed, 451600 Passed, 2759 Skipped, 19h 26m 49.19s Total Time |
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:
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 (6398) - mean (69ms) : 66, 73
. : milestone, 69,
master - mean (69ms) : 66, 71
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (977ms) : 956, 998
. : milestone, 977,
master - mean (976ms) : 948, 1004
. : milestone, 976,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6398) - mean (108ms) : 106, 110
. : milestone, 108,
master - mean (108ms) : 107, 110
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (675ms) : 659, 690
. : milestone, 675,
master - mean (677ms) : 662, 693
. : milestone, 677,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6398) - mean (91ms) : 89, 94
. : milestone, 91,
master - mean (91ms) : 89, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (626ms) : 611, 642
. : milestone, 626,
master - mean (631ms) : 615, 647
. : milestone, 631,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6398) - mean (191ms) : 187, 194
. : milestone, 191,
master - mean (191ms) : 187, 194
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (1,090ms) : 1053, 1126
. : milestone, 1090,
master - mean (1,089ms) : 1061, 1117
. : milestone, 1089,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6398) - mean (276ms) : 271, 281
. : milestone, 276,
master - mean (276ms) : 271, 281
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (868ms) : 841, 895
. : milestone, 868,
master - mean (868ms) : 841, 896
. : milestone, 868,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6398) - mean (266ms) : 262, 271
. : milestone, 266,
master - mean (266ms) : 262, 269
. : milestone, 266,
section CallTarget+Inlining+NGEN
This PR (6398) - mean (844ms) : 811, 878
. : milestone, 844,
master - mean (850ms) : 818, 881
. : milestone, 850,
|
Benchmarks Report for tracer 🐌Benchmarks for #6398 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Slower
|
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 | 1.120 | 1,220.66 | 1,367.22 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.22μs | 1.07ns | 4.13ns | 0.014 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 1.8μs | 0.87ns | 3.37ns | 0.0135 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.13μs | 2.96ns | 11.1ns | 0.157 | 0.00107 | 0 | 987 B |
| #6398 | ExecuteNonQuery |
net6.0 | 1.37μs | 1.74ns | 6.74ns | 0.0143 | 0 | 0 | 1.02 KB |
| #6398 | ExecuteNonQuery |
netcoreapp3.1 | 1.71μs | 1.49ns | 5.77ns | 0.0138 | 0 | 0 | 1.02 KB |
| #6398 | ExecuteNonQuery |
net472 | 1.94μs | 2.3ns | 8.89ns | 0.157 | 0.000967 | 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 | 0.364ns | 1.41ns | 0.0138 | 0 | 0 | 976 B |
| master | CallElasticsearch |
netcoreapp3.1 | 1.57μs | 0.718ns | 2.78ns | 0.0132 | 0 | 0 | 976 B |
| master | CallElasticsearch |
net472 | 2.5μs | 2.23ns | 8.33ns | 0.157 | 0 | 0 | 995 B |
| master | CallElasticsearchAsync |
net6.0 | 1.18μs | 0.475ns | 1.84ns | 0.0135 | 0 | 0 | 952 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 1.73μs | 0.943ns | 3.27ns | 0.0138 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 2.66μs | 2.42ns | 9.38ns | 0.167 | 0 | 0 | 1.05 KB |
| #6398 | CallElasticsearch |
net6.0 | 1.24μs | 0.595ns | 2.31ns | 0.0138 | 0 | 0 | 976 B |
| #6398 | CallElasticsearch |
netcoreapp3.1 | 1.62μs | 0.868ns | 3.25ns | 0.013 | 0 | 0 | 976 B |
| #6398 | CallElasticsearch |
net472 | 2.58μs | 2.89ns | 11.2ns | 0.157 | 0 | 0 | 995 B |
| #6398 | CallElasticsearchAsync |
net6.0 | 1.29μs | 0.542ns | 2.03ns | 0.013 | 0 | 0 | 952 B |
| #6398 | CallElasticsearchAsync |
netcoreapp3.1 | 1.64μs | 2.57ns | 9.97ns | 0.0138 | 0 | 0 | 1.02 KB |
| #6398 | CallElasticsearchAsync |
net472 | 2.75μs | 2.6ns | 10.1ns | 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.16μs | 0.62ns | 2.4ns | 0.0134 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 1.73μs | 0.717ns | 2.78ns | 0.013 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 1.87μs | 0.35ns | 1.35ns | 0.145 | 0 | 0 | 915 B |
| #6398 | ExecuteAsync |
net6.0 | 1.27μs | 0.622ns | 2.41ns | 0.0133 | 0 | 0 | 952 B |
| #6398 | ExecuteAsync |
netcoreapp3.1 | 1.61μs | 1.36ns | 5.09ns | 0.0122 | 0 | 0 | 952 B |
| #6398 | ExecuteAsync |
net472 | 1.8μs | 0.449ns | 1.74ns | 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.55μs | 1.77ns | 6.87ns | 0.0315 | 0 | 0 | 2.31 KB |
| master | SendAsync |
netcoreapp3.1 | 5.21μs | 1.37ns | 5.32ns | 0.0393 | 0 | 0 | 2.85 KB |
| master | SendAsync |
net472 | 7.35μs | 2.75ns | 10.6ns | 0.495 | 0 | 0 | 3.12 KB |
| #6398 | SendAsync |
net6.0 | 4.42μs | 2.77ns | 10.7ns | 0.0312 | 0 | 0 | 2.31 KB |
| #6398 | SendAsync |
netcoreapp3.1 | 5.25μs | 1.13ns | 4.23ns | 0.0393 | 0 | 0 | 2.85 KB |
| #6398 | SendAsync |
net472 | 7.41μs | 1.76ns | 6.83ns | 0.493 | 0 | 0 | 3.12 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.49μs | 2.42ns | 9.37ns | 0.0227 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
netcoreapp3.1 | 2.24μs | 0.95ns | 3.42ns | 0.0223 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
net472 | 2.5μs | 1.65ns | 6.39ns | 0.249 | 0 | 0 | 1.57 KB |
| #6398 | EnrichedLog |
net6.0 | 1.48μs | 0.839ns | 3.02ns | 0.023 | 0 | 0 | 1.64 KB |
| #6398 | EnrichedLog |
netcoreapp3.1 | 2.33μs | 1.27ns | 4.76ns | 0.0224 | 0 | 0 | 1.64 KB |
| #6398 | EnrichedLog |
net472 | 2.5μs | 1.3ns | 4.86ns | 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 | 121μs | 187ns | 726ns | 0 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
netcoreapp3.1 | 123μs | 135ns | 503ns | 0 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
net472 | 151μs | 191ns | 738ns | 0.676 | 0.225 | 0 | 4.46 KB |
| #6398 | EnrichedLog |
net6.0 | 120μs | 155ns | 600ns | 0.0603 | 0 | 0 | 4.28 KB |
| #6398 | EnrichedLog |
netcoreapp3.1 | 124μs | 169ns | 655ns | 0 | 0 | 0 | 4.28 KB |
| #6398 | EnrichedLog |
net472 | 152μs | 174ns | 675ns | 0.683 | 0.228 | 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.02μs | 1.04ns | 4.03ns | 0.03 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
netcoreapp3.1 | 4.34μs | 1.15ns | 4.13ns | 0.0303 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
net472 | 4.98μs | 1.63ns | 6.32ns | 0.319 | 0 | 0 | 2.02 KB |
| #6398 | EnrichedLog |
net6.0 | 3.01μs | 1.14ns | 4.26ns | 0.03 | 0 | 0 | 2.2 KB |
| #6398 | EnrichedLog |
netcoreapp3.1 | 4.26μs | 2.7ns | 10.1ns | 0.0297 | 0 | 0 | 2.2 KB |
| #6398 | EnrichedLog |
net472 | 4.82μs | 3.22ns | 12.5ns | 0.318 | 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.12ns | 4.35ns | 0.0163 | 0 | 0 | 1.14 KB |
| master | SendReceive |
netcoreapp3.1 | 1.8μs | 2.06ns | 7.98ns | 0.0152 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.14μs | 1.71ns | 6.62ns | 0.184 | 0 | 0 | 1.16 KB |
| #6398 | SendReceive |
net6.0 | 1.23μs | 0.854ns | 3.31ns | 0.0161 | 0 | 0 | 1.14 KB |
| #6398 | SendReceive |
netcoreapp3.1 | 1.77μs | 1.17ns | 4.54ns | 0.0156 | 0 | 0 | 1.14 KB |
| #6398 | SendReceive |
net472 | 2.17μs | 1.8ns | 6.97ns | 0.184 | 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.85μs | 1.96ns | 7.6ns | 0.0228 | 0 | 0 | 1.6 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.98μs | 1.25ns | 4.83ns | 0.022 | 0 | 0 | 1.65 KB |
| master | EnrichedLog |
net472 | 4.35μs | 1.7ns | 6.14ns | 0.323 | 0 | 0 | 2.04 KB |
| #6398 | EnrichedLog |
net6.0 | 2.65μs | 1.25ns | 4.82ns | 0.0224 | 0 | 0 | 1.6 KB |
| #6398 | EnrichedLog |
netcoreapp3.1 | 3.96μs | 1.48ns | 5.54ns | 0.0217 | 0 | 0 | 1.65 KB |
| #6398 | EnrichedLog |
net472 | 4.61μs | 4.43ns | 17.2ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6398
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.175
475.80
559.05
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.175 | 475.80 | 559.05 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 393ns | 0.736ns | 2.85ns | 0.00805 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 589ns | 1.02ns | 3.94ns | 0.00795 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 598ns | 1.58ns | 6.12ns | 0.0918 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 475ns | 0.628ns | 2.43ns | 0.00977 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 735ns | 0.963ns | 3.73ns | 0.00951 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 868ns | 2.36ns | 9.14ns | 0.105 | 0 | 0 | 658 B |
| #6398 | StartFinishSpan |
net6.0 | 406ns | 0.604ns | 2.34ns | 0.008 | 0 | 0 | 576 B |
| #6398 | StartFinishSpan |
netcoreapp3.1 | 588ns | 0.635ns | 2.46ns | 0.00758 | 0 | 0 | 576 B |
| #6398 | StartFinishSpan |
net472 | 664ns | 1.18ns | 4.58ns | 0.0918 | 0 | 0 | 578 B |
| #6398 | StartFinishScope |
net6.0 | 558ns | 1.12ns | 4.35ns | 0.00967 | 0 | 0 | 696 B |
| #6398 | StartFinishScope |
netcoreapp3.1 | 781ns | 2.27ns | 8.79ns | 0.00934 | 0 | 0 | 696 B |
| #6398 | StartFinishScope |
net472 | 870ns | 1.64ns | 6.35ns | 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 | 612ns | 1.01ns | 3.9ns | 0.00959 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 868ns | 1.87ns | 7.22ns | 0.0092 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.14μs | 2.3ns | 8.89ns | 0.104 | 0 | 0 | 658 B |
| #6398 | RunOnMethodBegin |
net6.0 | 602ns | 0.649ns | 2.51ns | 0.0097 | 0 | 0 | 696 B |
| #6398 | RunOnMethodBegin |
netcoreapp3.1 | 868ns | 1.61ns | 6.25ns | 0.00947 | 0 | 0 | 696 B |
| #6398 | RunOnMethodBegin |
net472 | 1.09μs | 1.99ns | 7.7ns | 0.104 | 0 | 0 | 658 B |
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 (6398) (11.320M) : 0, 11320064
master (11.222M) : 0, 11221800
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6398) (7.317M) : 0, 7317165
master (7.306M) : 0, 7305807
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.621M) : 0, 7620774
section Manual
master (11.257M) : 0, 11257171
section Manual + Automatic
This PR (6398) (6.770M) : 0, 6769946
master (6.783M) : 0, 6782564
section DD_TRACE_ENABLED=0
master (10.363M) : 0, 10362594
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6398) (9.659M) : 0, 9658530
master (9.664M) : 0, 9664098
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6398) (6.337M) : 0, 6336574
master (6.272M) : 0, 6271501
section Trace stats
master (6.601M) : 0, 6601213
section Manual
master (9.639M) : 0, 9638684
section Manual + Automatic
This PR (6398) (5.893M) : 0, 5893281
master (5.996M) : 0, 5996086
section DD_TRACE_ENABLED=0
master (8.743M) : 0, 8742779
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6398) (10.115M) : 0, 10114882
master (10.051M) : 0, 10050841
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6398) (6.620M) : 0, 6619953
master (6.245M) : 0, 6245212
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (7.094M) : 0, 7093813
section Manual
master (9.987M) : 0, 9987436
section Manual + Automatic
This PR (6398) (6.066M) : 0, 6066232
master (5.990M) : 0, 5990374
section DD_TRACE_ENABLED=0
master (9.233M) : 0, 9232530
|
## Summary of changes Removed `ArrayPoolEventSource`, used internally by the vendored arraypool. ## Reason for change There is a bug in the .NET runtime that can cause a crash when the eventpipes are initialized (through an `EventListener`) at the same time that an `EventSource` is created. We were triggering that bug because we initialize the runtime metrics (which rely on an `EventListener`) and the discovery service (which indirectly uses an array pool) concurrently. Since we don't actually need that `EventSource`, we can just remove it to reduce the risk of crash. ## Implementation details Removed `ArrayPoolEventSource` and the code that depends on it.
Summary of changes
Removed
ArrayPoolEventSource, used internally by the vendored arraypool.Reason for change
There is a bug in the .NET runtime that can cause a crash when the eventpipes are initialized (through an
EventListener) at the same time that anEventSourceis created.We were triggering that bug because we initialize the runtime metrics (which rely on an
EventListener) and the discovery service (which indirectly uses an array pool) concurrently.Since we don't actually need that
EventSource, we can just remove it to reduce the risk of crash.Implementation details
Removed
ArrayPoolEventSourceand the code that depends on it.