Browse Source

ASP.NET Core Use Sockets as default transport for PlatformBenchmarks (#5830)

Ben Adams 5 years ago
parent
commit
7c190dd16a

+ 13 - 9
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs

@@ -19,27 +19,31 @@ namespace PlatformBenchmarks
             // Handle the transport type
             var webHost = builder.GetSetting("KestrelTransport");
 
-            if (string.Equals(webHost, "Sockets", StringComparison.OrdinalIgnoreCase))
+            Console.WriteLine($"Transport: {webHost}");
+
+            if (string.Equals(webHost, "LinuxTransport", StringComparison.OrdinalIgnoreCase))
+            {
+                builder.UseLinuxTransport(options =>
+                {
+                    options.ApplicationSchedulingMode = PipeScheduler.Inline;
+                });
+            }
+            else
             {
                 builder.UseSockets(options =>
                 {
                     if (int.TryParse(builder.GetSetting("threadCount"), out int threadCount))
                     {
-                       options.IOQueueCount = threadCount;
+                        options.IOQueueCount = threadCount;
                     }
 
 #if NETCOREAPP5_0 || NET5_0
                     options.WaitForDataBeforeAllocatingBuffer = false;
+
+                    Console.WriteLine($"Options: WaitForData={options.WaitForDataBeforeAllocatingBuffer}, IOQueue={options.IOQueueCount}");
 #endif
                 });
             }
-            else if (string.Equals(webHost, "LinuxTransport", StringComparison.OrdinalIgnoreCase))
-            {
-                builder.UseLinuxTransport(options =>
-                {
-                    options.ApplicationSchedulingMode = PipeScheduler.Inline;
-                });
-            }
 
             return builder;
         }