Skip to content

Commit d18e84d

Browse files
feat(csharp/Benchmarks): Add .NET Framework 4.7.2 support with TLS co… (#3682)
This commit enhances the CloudFetch benchmark suite to support testing on .NET Framework 4.7.2, which is the runtime used by Power BI. There are some notable difference in .NET472 vs .NET8.0, one of them is /K4os.Compression.LZ4 use the DefaultArrayPool in .NET472 which has a 1 MB upper limit for array size, where .NET8.0 use the SharedArrayPool which almost have no size limit. Changes: - Add net472 target framework to Benchmarks.csproj - Make Tests project reference conditional (net8.0 only, since Tests doesn't support net472) - Enable TLS 1.2/1.3 in CloudFetchBenchmarkRunner for .NET Framework - Enable TLS 1.2/1.3 in benchmark GlobalSetup for spawned processes These changes are necessary because .NET Framework 4.7.2 doesn't enable modern TLS protocols by default, which are required for Databricks HTTPS connections. This allows accurate performance testing on the Power BI runtime environment (net472 with DefaultArrayPool). Command: ` dotnet run -c Release --project Benchmarks/Benchmarks.csproj --framework net472 CloudFetchBenchmarkRunner` Sample output: | Method | ReadDelayMs | Mean | Min | Max | Median | Peak Memory (MB) | Total Rows | Total Batches | Gen0 | Gen1 | Gen2 | Allocated | |------------------ |------------ |--------:|--------:|--------:|--------:|-----------------:|-----------:|--------------:|------------:|-----------:|-----------:|----------:| | ExecuteLargeQuery | 5 | 9.659 s | 9.016 s | 10.03 s | 9.928 s | 356.38 | 1,439,935 | 740 | 336000.0000 | 57000.0000 | 35000.0000 | 2.73 GB | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
1 parent 5be5ca7 commit d18e84d

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

csharp/Benchmarks/Benchmarks.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net8.0</TargetFrameworks>
5+
<TargetFrameworks Condition="'$(IsWindows)'=='true'">net8.0;net472</TargetFrameworks>
6+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net8.0</TargetFrameworks>
67
<ImplicitUsings>enable</ImplicitUsings>
78
<Nullable>enable</Nullable>
89
<ProcessArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</ProcessArchitecture>

csharp/Benchmarks/CloudFetchBenchmarkRunner.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
using BenchmarkDotNet.Columns;
2020
using BenchmarkDotNet.Configs;
2121
using BenchmarkDotNet.Running;
22+
#if NET472
23+
using System.Net;
24+
#endif
2225

2326
namespace Apache.Arrow.Adbc.Benchmarks
2427
{
@@ -30,6 +33,10 @@ public class CloudFetchBenchmarkRunner
3033
{
3134
public static void Main(string[] args)
3235
{
36+
#if NET472
37+
// Enable TLS 1.2/1.3 for .NET Framework 4.7.2 (required for modern HTTPS endpoints)
38+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | (SecurityProtocolType)3072; // 3072 = Tls13
39+
#endif
3340
// Configure to include the peak memory column and hide confusing error column
3441
var config = DefaultConfig.Instance
3542
.AddColumn(new PeakMemoryColumn())

csharp/Benchmarks/Databricks/CloudFetchRealE2EBenchmark.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
using BenchmarkDotNet.Columns;
3030
using BenchmarkDotNet.Reports;
3131
using BenchmarkDotNet.Running;
32+
#if NET472
33+
using System.Net;
34+
#endif
3235

3336
namespace Apache.Arrow.Adbc.Benchmarks.Databricks
3437
{
@@ -127,6 +130,10 @@ public class CloudFetchRealE2EBenchmark
127130
[GlobalSetup]
128131
public void GlobalSetup()
129132
{
133+
#if NET472
134+
// Enable TLS 1.2/1.3 for .NET Framework 4.7.2 (required for modern HTTPS endpoints)
135+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | (SecurityProtocolType)3072; // 3072 = Tls13
136+
#endif
130137
// Check if Databricks config is available
131138
string? configFile = Environment.GetEnvironmentVariable("DATABRICKS_TEST_CONFIG_FILE");
132139
if (string.IsNullOrEmpty(configFile))

0 commit comments

Comments
 (0)