Browse Source

Upgrade aspnetcore to 6.0-rc1 (#6830)

* Upgrade aspnetcore to 6.0-rc1

* Update frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs

Co-authored-by: Layomi Akinrinade <[email protected]>

* Use camel case

* Update csproj files

Co-authored-by: Layomi Akinrinade <[email protected]>
Sébastien Ros 3 years ago
parent
commit
9b2c2e917d
51 changed files with 496 additions and 217 deletions
  1. 31 0
      frameworks/CSharp/aspnetcore/Benchmarks.sln
  2. 4 5
      frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj
  3. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesDapperMiddleware.cs
  4. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesEfMiddleware.cs
  5. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesRawMiddleware.cs
  6. 3 8
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesDapperMiddleware.cs
  7. 3 8
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesEfMiddleware.cs
  8. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesRawMiddleware.cs
  9. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryDapperMiddleware.cs
  10. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryEfMiddleware.cs
  11. 3 7
      frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryRawMiddleware.cs
  12. 5 10
      frameworks/CSharp/aspnetcore/Benchmarks/Startup.cs
  13. 1 1
      frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json
  14. 1 1
      frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.updates.json
  15. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Caching.cs
  16. 1 41
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs
  17. 2 3
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Json.cs
  18. 4 3
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.MultipleQueries.cs
  19. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.SingleQuery.cs
  20. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Updates.cs
  21. 10 8
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs
  22. 0 2
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs
  23. 1 4
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/CachedWorld.cs
  24. 6 9
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs
  25. 7 10
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs
  26. 3 5
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/PlatformBenchmarks.csproj
  27. 17 3
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Program.cs
  28. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/appsettings.postgresql.json
  29. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/appsettings.postgresql.updates.json
  30. 8 2
      frameworks/CSharp/aspnetcore/aspcore-ado-my.dockerfile
  31. 8 2
      frameworks/CSharp/aspnetcore/aspcore-ado-pg-up.dockerfile
  32. 8 2
      frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
  33. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-my.dockerfile
  34. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg-up.dockerfile
  35. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg.dockerfile
  36. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-my.dockerfile
  37. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg-up.dockerfile
  38. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg.dockerfile
  39. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ef-pg.dockerfile
  40. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mvc.dockerfile
  41. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-my.dockerfile
  42. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg-up.dockerfile
  43. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg.dockerfile
  44. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-my.dockerfile
  45. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg-up.dockerfile
  46. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg.dockerfile
  47. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ef-pg.dockerfile
  48. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw-json.dockerfile
  49. 8 2
      frameworks/CSharp/aspnetcore/aspcore-mw.dockerfile
  50. 8 2
      frameworks/CSharp/aspnetcore/aspcore.dockerfile
  51. 203 0
      frameworks/CSharp/aspnetcore/te.benchmarks.yml

+ 31 - 0
frameworks/CSharp/aspnetcore/Benchmarks.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31717.71
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformBenchmarks", "PlatformBenchmarks\PlatformBenchmarks.csproj", "{047A5FF4-56BB-4BEF-9DCF-9B6051365423}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{C65B0C4A-B242-4A03-AC80-4B1DC6C1DF57}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{047A5FF4-56BB-4BEF-9DCF-9B6051365423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{047A5FF4-56BB-4BEF-9DCF-9B6051365423}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{047A5FF4-56BB-4BEF-9DCF-9B6051365423}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{047A5FF4-56BB-4BEF-9DCF-9B6051365423}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C65B0C4A-B242-4A03-AC80-4B1DC6C1DF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C65B0C4A-B242-4A03-AC80-4B1DC6C1DF57}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C65B0C4A-B242-4A03-AC80-4B1DC6C1DF57}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C65B0C4A-B242-4A03-AC80-4B1DC6C1DF57}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {69C5D834-F31B-4F07-97EC-E4DD5AF417DE}
+	EndGlobalSection
+EndGlobal

+ 4 - 5
frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj

@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
   </PropertyGroup>
   </PropertyGroup>
 
 
@@ -12,11 +12,10 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.5" />
-    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.5" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.1.21452.10" />
 
 
     <PackageReference Include="Dapper" Version="2.0.90" />
     <PackageReference Include="Dapper" Version="2.0.90" />
-    <PackageReference Include="MySqlConnector" Version="1.3.2" />
-    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
+    <PackageReference Include="MySqlConnector" Version="1.3.12" />
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-rc.1" />
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesDapperMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleQueriesDapperMiddleware
     public class MultipleQueriesDapperMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryDapper));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryDapper));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -37,7 +33,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var rows = await db.LoadMultipleQueriesRows(count);
                 var rows = await db.LoadMultipleQueriesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesEfMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleQueriesEfMiddleware
     public class MultipleQueriesEfMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryEf));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryEf));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -37,7 +33,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var rows = await db.LoadMultipleQueriesRows(count);
                 var rows = await db.LoadMultipleQueriesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleQueriesRawMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleQueriesRawMiddleware
     public class MultipleQueriesRawMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryRaw));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiQueryRaw));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -37,7 +33,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var rows = await db.LoadMultipleQueriesRows(count);
                 var rows = await db.LoadMultipleQueriesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 8
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesDapperMiddleware.cs

@@ -2,25 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleUpdatesDapperMiddleware
     public class MultipleUpdatesDapperMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateDapper));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateDapper));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
-
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
         public MultipleUpdatesDapperMiddleware(RequestDelegate next)
         public MultipleUpdatesDapperMiddleware(RequestDelegate next)
@@ -37,7 +32,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var rows = await db.LoadMultipleUpdatesRows(count);
                 var rows = await db.LoadMultipleUpdatesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 8
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesEfMiddleware.cs

@@ -2,25 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleUpdatesEfMiddleware
     public class MultipleUpdatesEfMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateEf));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateEf));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
-
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
         public MultipleUpdatesEfMiddleware(RequestDelegate next)
         public MultipleUpdatesEfMiddleware(RequestDelegate next)
@@ -37,7 +32,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var rows = await db.LoadMultipleUpdatesRows(count);
                 var rows = await db.LoadMultipleUpdatesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MultipleUpdatesRawMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class MultipleUpdatesRawMiddleware
     public class MultipleUpdatesRawMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateRaw));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbMultiUpdateRaw));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -37,7 +33,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var rows = await db.LoadMultipleUpdatesRows(count);
                 var rows = await db.LoadMultipleUpdatesRows(count);
 
 
-                var result = JsonConvert.SerializeObject(rows, _jsonSettings);
+                var result = JsonSerializer.Serialize(rows, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryDapperMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class SingleQueryDapperMiddleware
     public class SingleQueryDapperMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryDapper));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryDapper));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -35,7 +31,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var db = httpContext.RequestServices.GetService<DapperDb>();
                 var row = await db.LoadSingleQueryRow();
                 var row = await db.LoadSingleQueryRow();
 
 
-                var result = JsonConvert.SerializeObject(row, _jsonSettings);
+                var result = JsonSerializer.Serialize(row, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryEfMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class SingleQueryEfMiddleware
     public class SingleQueryEfMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryEf));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryEf));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -34,7 +30,7 @@ namespace Benchmarks.Middleware
             {
             {
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var db = httpContext.RequestServices.GetService<EfDb>();
                 var row = await db.LoadSingleQueryRow();
                 var row = await db.LoadSingleQueryRow();
-                var result = JsonConvert.SerializeObject(row, _jsonSettings);
+                var result = JsonSerializer.Serialize(row, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 3 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/SingleQueryRawMiddleware.cs

@@ -2,24 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 
 
 namespace Benchmarks.Middleware
 namespace Benchmarks.Middleware
 {
 {
     public class SingleQueryRawMiddleware
     public class SingleQueryRawMiddleware
     {
     {
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryRaw));
         private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbSingleQueryRaw));
-        private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
-        {
-            ContractResolver = new CamelCasePropertyNamesContractResolver()
-        };
+        private static readonly JsonSerializerOptions _serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
 
 
         private readonly RequestDelegate _next;
         private readonly RequestDelegate _next;
 
 
@@ -35,7 +31,7 @@ namespace Benchmarks.Middleware
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var db = httpContext.RequestServices.GetService<RawDb>();
                 var row = await db.LoadSingleQueryRow();
                 var row = await db.LoadSingleQueryRow();
 
 
-                var result = JsonConvert.SerializeObject(row, _jsonSettings);
+                var result = JsonSerializer.Serialize(row, _serializerOptions);
 
 
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.StatusCode = StatusCodes.Status200OK;
                 httpContext.Response.ContentType = "application/json";
                 httpContext.Response.ContentType = "application/json";

+ 5 - 10
frameworks/CSharp/aspnetcore/Benchmarks/Startup.cs

@@ -1,22 +1,20 @@
 // Copyright (c) .NET Foundation. All rights reserved.
 // Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
-using System;
-using System.Data.Common;
-using System.Data.SqlClient;
-using System.Text.Encodings.Web;
-using System.Text.Unicode;
 using Benchmarks.Configuration;
 using Benchmarks.Configuration;
 using Benchmarks.Data;
 using Benchmarks.Data;
 using Benchmarks.Middleware;
 using Benchmarks.Middleware;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
 using MySqlConnector;
 using MySqlConnector;
 using Npgsql;
 using Npgsql;
+using System;
+using System.Data.Common;
+using System.Text.Encodings.Web;
+using System.Text.Unicode;
 
 
 namespace Benchmarks
 namespace Benchmarks
 {
 {
@@ -106,10 +104,7 @@ namespace Benchmarks
 
 
             if (Scenarios.Any("Mvc"))
             if (Scenarios.Any("Mvc"))
             {
             {
-                var mvcBuilder = services
-                    .AddMvcCore()
-                    .SetCompatibilityVersion(CompatibilityVersion.Latest)
-                    ;
+                var mvcBuilder = services.AddMvcCore();
 
 
                 if (Scenarios.MvcViews || Scenarios.Any("MvcDbFortunes"))
                 if (Scenarios.MvcViews || Scenarios.Any("MvcDbFortunes"))
                 {
                 {

+ 1 - 1
frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json

@@ -1,4 +1,4 @@
 {
 {
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000",
+  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
   "Database": "postgresql"
   "Database": "postgresql"
 }
 }

+ 1 - 1
frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.updates.json

@@ -1,4 +1,4 @@
 {
 {
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000",
+  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
   "Database": "postgresql"
   "Database": "postgresql"
 }
 }

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Caching.cs

@@ -12,7 +12,7 @@ namespace PlatformBenchmarks
     {
     {
         private async Task Caching(PipeWriter pipeWriter, int count)
         private async Task Caching(PipeWriter pipeWriter, int count)
         {
         {
-            OutputMultipleQueries(pipeWriter, await Db.LoadCachedQueries(count));
+            OutputMultipleQueries(pipeWriter, await Db.LoadCachedQueries(count), SerializerContext.CachedWorldArray);
         }
         }
     }
     }
 }
 }

+ 1 - 41
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs

@@ -112,21 +112,10 @@ namespace PlatformBenchmarks
 
 
             if (state == State.StartLine)
             if (state == State.StartLine)
             {
             {
-#if NET5_0
                 if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
                 if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
                 {
                 {
                     state = State.Headers;
                     state = State.Headers;
                 }
                 }
-#else
-                var unconsumedSequence = reader.Sequence.Slice(reader.Position);
-                if (Parser.ParseRequestLine(new ParsingAdapter(this), unconsumedSequence, out var consumed, out _))
-                {
-                    state = State.Headers;
-
-                    var parsedLength = unconsumedSequence.Slice(reader.Position, consumed).Length;
-                    reader.Advance(parsedLength);
-                }
-#endif
             }
             }
 
 
             if (state == State.Headers)
             if (state == State.Headers)
@@ -197,21 +186,10 @@ namespace PlatformBenchmarks
 
 
             if (state == State.StartLine)
             if (state == State.StartLine)
             {
             {
-#if NET5_0
                 if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
                 if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
                 {
                 {
                     state = State.Headers;
                     state = State.Headers;
                 }
                 }
-#else
-                var unconsumedSequence = reader.Sequence.Slice(reader.Position);
-                if (Parser.ParseRequestLine(new ParsingAdapter(this), unconsumedSequence, out var consumed, out _))
-                {
-                    state = State.Headers;
-
-                    var parsedLength = unconsumedSequence.Slice(reader.Position, consumed).Length;
-                    reader.Advance(parsedLength);
-                }
-#endif
             }
             }
 
 
             if (state == State.Headers)
             if (state == State.Headers)
@@ -246,8 +224,6 @@ namespace PlatformBenchmarks
         }
         }
 #endif
 #endif
 
 
-#if NET5_0
-
         public void OnStaticIndexedHeader(int index)
         public void OnStaticIndexedHeader(int index)
         {
         {
         }
         }
@@ -259,17 +235,10 @@ namespace PlatformBenchmarks
         public void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value)
         public void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value)
         {
         {
         }
         }
+
         public void OnHeadersComplete(bool endStream)
         public void OnHeadersComplete(bool endStream)
         {
         {
         }
         }
-#else
-        public void OnHeader(Span<byte> name, Span<byte> value)
-        {
-        }
-        public void OnHeadersComplete()
-        {
-        }
-#endif
 
 
         private static void ThrowUnexpectedEndOfData()
         private static void ThrowUnexpectedEndOfData()
         {
         {
@@ -311,7 +280,6 @@ namespace PlatformBenchmarks
             public ParsingAdapter(BenchmarkApplication requestHandler)
             public ParsingAdapter(BenchmarkApplication requestHandler)
                 => RequestHandler = requestHandler;
                 => RequestHandler = requestHandler;
 
 
-#if NET5_0
             public void OnStaticIndexedHeader(int index) 
             public void OnStaticIndexedHeader(int index) 
                 => RequestHandler.OnStaticIndexedHeader(index);
                 => RequestHandler.OnStaticIndexedHeader(index);
 
 
@@ -326,14 +294,6 @@ namespace PlatformBenchmarks
 
 
             public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
             public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
                 => RequestHandler.OnStartLine(versionAndMethod, targetPath, startLine);
                 => RequestHandler.OnStartLine(versionAndMethod, targetPath, startLine);
-#else
-            public void OnHeader(Span<byte> name, Span<byte> value)
-                => RequestHandler.OnHeader(name, value);
-            public void OnHeadersComplete()
-                => RequestHandler.OnHeadersComplete();
-            public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded)
-                => RequestHandler.OnStartLine(method, version, target, path, query, customMethod, pathEncoded);
-#endif
         }
         }
     }
     }
 }
 }

+ 2 - 3
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Json.cs

@@ -1,7 +1,6 @@
 // Copyright (c) .NET Foundation. All rights reserved.
 // Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
-using System;
 using System.Buffers;
 using System.Buffers;
 using System.Text.Json;
 using System.Text.Json;
 
 
@@ -9,7 +8,7 @@ namespace PlatformBenchmarks
 {
 {
     public partial class BenchmarkApplication
     public partial class BenchmarkApplication
     {
     {
-        private readonly static uint _jsonPayloadSize = (uint)JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerOptions).Length;
+        private readonly static uint _jsonPayloadSize = (uint)JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage).Length;
 
 
         private readonly static AsciiString _jsonPreamble =
         private readonly static AsciiString _jsonPreamble =
             _http11OK +
             _http11OK +
@@ -30,7 +29,7 @@ namespace PlatformBenchmarks
             utf8JsonWriter.Reset(bodyWriter);
             utf8JsonWriter.Reset(bodyWriter);
 
 
             // Body
             // Body
-            JsonSerializer.Serialize<JsonMessage>(utf8JsonWriter, new JsonMessage { message = "Hello, World!" }, SerializerOptions);
+            JsonSerializer.Serialize(utf8JsonWriter, new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage);        
         }
         }
     }
     }
 }
 }

+ 4 - 3
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.MultipleQueries.cs

@@ -5,6 +5,7 @@
 
 
 using System.IO.Pipelines;
 using System.IO.Pipelines;
 using System.Text.Json;
 using System.Text.Json;
+using System.Text.Json.Serialization.Metadata;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
 namespace PlatformBenchmarks
 namespace PlatformBenchmarks
@@ -13,10 +14,10 @@ namespace PlatformBenchmarks
     {
     {
         private async Task MultipleQueries(PipeWriter pipeWriter, int count)
         private async Task MultipleQueries(PipeWriter pipeWriter, int count)
         {
         {
-            OutputMultipleQueries(pipeWriter, await Db.LoadMultipleQueriesRows(count));
+            OutputMultipleQueries(pipeWriter, await Db.LoadMultipleQueriesRows(count), SerializerContext.WorldArray);
         }
         }
 
 
-        private static void OutputMultipleQueries(PipeWriter pipeWriter, World[] rows)
+        private static void OutputMultipleQueries<TWorld>(PipeWriter pipeWriter, TWorld[] rows, JsonTypeInfo<TWorld[]> jsonTypeInfo)
         {
         {
             var writer = GetWriter(pipeWriter, sizeHint: 160 * rows.Length); // in reality it's 152 for one
             var writer = GetWriter(pipeWriter, sizeHint: 160 * rows.Length); // in reality it's 152 for one
 
 
@@ -34,7 +35,7 @@ namespace PlatformBenchmarks
             utf8JsonWriter.Reset(pipeWriter);
             utf8JsonWriter.Reset(pipeWriter);
 
 
             // Body
             // Body
-            JsonSerializer.Serialize<World[]>(utf8JsonWriter, rows, SerializerOptions);
+            JsonSerializer.Serialize<TWorld[]>(utf8JsonWriter, rows, jsonTypeInfo);
 
 
             // Content-Length
             // Content-Length
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.SingleQuery.cs

@@ -34,7 +34,7 @@ namespace PlatformBenchmarks
             utf8JsonWriter.Reset(pipeWriter);
             utf8JsonWriter.Reset(pipeWriter);
 
 
             // Body
             // Body
-            JsonSerializer.Serialize<World>(utf8JsonWriter, row, SerializerOptions);
+            JsonSerializer.Serialize(utf8JsonWriter, row, SerializerContext.World);
 
 
             // Content-Length
             // Content-Length
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Updates.cs

@@ -34,7 +34,7 @@ namespace PlatformBenchmarks
             utf8JsonWriter.Reset(pipeWriter);
             utf8JsonWriter.Reset(pipeWriter);
 
 
             // Body
             // Body
-            JsonSerializer.Serialize<World[]>(utf8JsonWriter, rows, SerializerOptions);
+            JsonSerializer.Serialize( utf8JsonWriter, rows, SerializerContext.WorldArray);
 
 
             // Content-Length
             // Content-Length
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
             lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);

+ 10 - 8
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs

@@ -5,6 +5,7 @@ using System;
 using System.Buffers.Text;
 using System.Buffers.Text;
 using System.IO.Pipelines;
 using System.IO.Pipelines;
 using System.Text.Json;
 using System.Text.Json;
+using System.Text.Json.Serialization;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
 using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
 using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
@@ -35,7 +36,15 @@ namespace PlatformBenchmarks
 
 
         private readonly static AsciiString _plainTextBody = "Hello, World!";
         private readonly static AsciiString _plainTextBody = "Hello, World!";
 
 
-        private static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions();
+        private static readonly JsonContext SerializerContext = JsonContext.Default;
+
+        [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Serialization, PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
+        [JsonSerializable(typeof(JsonMessage))]
+        [JsonSerializable(typeof(CachedWorld[]))]
+        [JsonSerializable(typeof(World[]))]
+        private sealed partial class JsonContext : JsonSerializerContext
+        {
+        }
 
 
         private readonly static AsciiString _fortunesTableStart = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
         private readonly static AsciiString _fortunesTableStart = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
         private readonly static AsciiString _fortunesRowStart = "<tr><td>";
         private readonly static AsciiString _fortunesRowStart = "<tr><td>";
@@ -65,17 +74,10 @@ namespace PlatformBenchmarks
         private RequestType _requestType;
         private RequestType _requestType;
         private int _queries;
         private int _queries;
 
 
-#if NET5_0
         public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
         public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
         {
         {
             _requestType = versionAndMethod.Method == HttpMethod.Get ? GetRequestType(startLine.Slice(targetPath.Offset, targetPath.Length), ref _queries) : RequestType.NotRecognized;
             _requestType = versionAndMethod.Method == HttpMethod.Get ? GetRequestType(startLine.Slice(targetPath.Offset, targetPath.Length), ref _queries) : RequestType.NotRecognized;
         }
         }
-#else
-        public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded)
-        {
-            _requestType = method == HttpMethod.Get ? GetRequestType(path, ref _queries) : RequestType.NotRecognized;
-        }
-#endif
 
 
         private RequestType GetRequestType(ReadOnlySpan<byte> path, ref int queries)
         private RequestType GetRequestType(ReadOnlySpan<byte> path, ref int queries)
         {
         {

+ 0 - 2
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs

@@ -24,7 +24,6 @@ namespace PlatformBenchmarks
                     options.IOQueueCount = threadCount;
                     options.IOQueueCount = threadCount;
                 }
                 }
 
 
-#if NET5_0
                 options.WaitForDataBeforeAllocatingBuffer = false;
                 options.WaitForDataBeforeAllocatingBuffer = false;
                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                 {
                 {
@@ -32,7 +31,6 @@ namespace PlatformBenchmarks
                 }
                 }
 
 
                 Console.WriteLine($"Options: WaitForData={options.WaitForDataBeforeAllocatingBuffer}, PreferInlineScheduling={options.UnsafePreferInlineScheduling}, IOQueue={options.IOQueueCount}");
                 Console.WriteLine($"Options: WaitForData={options.WaitForDataBeforeAllocatingBuffer}, PreferInlineScheduling={options.UnsafePreferInlineScheduling}, IOQueue={options.IOQueueCount}");
-#endif
             });
             });
 
 
             return builder;
             return builder;

+ 1 - 4
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/CachedWorld.cs

@@ -1,17 +1,14 @@
 // Copyright (c) .NET Foundation. All rights reserved.
 // Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
-using System.Runtime.InteropServices;
-
 namespace PlatformBenchmarks
 namespace PlatformBenchmarks
 {
 {
-    public class CachedWorld
+    public sealed class CachedWorld
     {
     {
         public int Id { get; set; }
         public int Id { get; set; }
 
 
         public int RandomNumber { get; set; }
         public int RandomNumber { get; set; }
 
 
-        public static implicit operator World(CachedWorld world) => new World { Id = world.Id, RandomNumber = world.RandomNumber };
         public static implicit operator CachedWorld(World world) => new CachedWorld { Id = world.Id, RandomNumber = world.RandomNumber };
         public static implicit operator CachedWorld(World world) => new CachedWorld { Id = world.Id, RandomNumber = world.RandomNumber };
     }
     }
 }
 }

+ 6 - 9
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs

@@ -67,9 +67,9 @@ namespace PlatformBenchmarks
             return result;
             return result;
         }
         }
 
 
-        public Task<World[]> LoadCachedQueries(int count)
+        public Task<CachedWorld[]> LoadCachedQueries(int count)
         {
         {
-            var result = new World[count];
+            var result = new CachedWorld[count];
             var cacheKeys = _cacheKeys;
             var cacheKeys = _cacheKeys;
             var cache = _cache;
             var cache = _cache;
             var random = _random;
             var random = _random;
@@ -77,11 +77,9 @@ namespace PlatformBenchmarks
             {
             {
                 var id = random.Next(1, 10001);
                 var id = random.Next(1, 10001);
                 var key = cacheKeys[id];
                 var key = cacheKeys[id];
-                var data = cache.Get<CachedWorld>(key);
-
-                if (data != null)
+                if (cache.TryGetValue(key, out object cached))
                 {
                 {
-                    result[i] = data;
+                    result[i] = (CachedWorld)cached;
                 }
                 }
                 else
                 else
                 {
                 {
@@ -91,7 +89,7 @@ namespace PlatformBenchmarks
 
 
             return Task.FromResult(result);
             return Task.FromResult(result);
 
 
-            static async Task<World[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, World[] result)
+            static async Task<CachedWorld[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, CachedWorld[] result)
             {
             {
                 using (var db = new MySqlConnection(rawdb._connectionString))
                 using (var db = new MySqlConnection(rawdb._connectionString))
                 {
                 {
@@ -112,8 +110,7 @@ namespace PlatformBenchmarks
 
 
                         for (; i < result.Length; i++)
                         for (; i < result.Length; i++)
                         {
                         {
-                            var data = await rawdb._cache.GetOrCreateAsync<CachedWorld>(key, create);
-                            result[i] = data;
+                            result[i] = await rawdb._cache.GetOrCreateAsync<CachedWorld>(key, create);
 
 
                             id = rawdb._random.Next(1, 10001);
                             id = rawdb._random.Next(1, 10001);
                             idParameter.Value = id;
                             idParameter.Value = id;

+ 7 - 10
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs

@@ -67,9 +67,9 @@ namespace PlatformBenchmarks
             return result;
             return result;
         }
         }
 
 
-        public Task<World[]> LoadCachedQueries(int count)
+        public Task<CachedWorld[]> LoadCachedQueries(int count)
         {
         {
-            var result = new World[count];
+            var result = new CachedWorld[count];
             var cacheKeys = _cacheKeys;
             var cacheKeys = _cacheKeys;
             var cache = _cache;
             var cache = _cache;
             var random = _random;
             var random = _random;
@@ -77,11 +77,9 @@ namespace PlatformBenchmarks
             {
             {
                 var id = random.Next(1, 10001);
                 var id = random.Next(1, 10001);
                 var key = cacheKeys[id];
                 var key = cacheKeys[id];
-                var data = cache.Get<CachedWorld>(key);
-
-                if (data != null)
+                if (cache.TryGetValue(key, out object cached))
                 {
                 {
-                    result[i] = data;
+                    result[i] = (CachedWorld)cached;
                 }
                 }
                 else
                 else
                 {
                 {
@@ -91,7 +89,7 @@ namespace PlatformBenchmarks
 
 
             return Task.FromResult(result);
             return Task.FromResult(result);
 
 
-            static async Task<World[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, World[] result)
+            static async Task<CachedWorld[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, CachedWorld[] result)
             {
             {
                 using (var db = new NpgsqlConnection(rawdb._connectionString))
                 using (var db = new NpgsqlConnection(rawdb._connectionString))
                 {
                 {
@@ -112,8 +110,7 @@ namespace PlatformBenchmarks
 
 
                         for (; i < result.Length; i++)
                         for (; i < result.Length; i++)
                         {
                         {
-                            var data = await rawdb._cache.GetOrCreateAsync<CachedWorld>(key, create);
-                            result[i] = data;
+                            result[i] = await rawdb._cache.GetOrCreateAsync<CachedWorld>(key, create);
 
 
                             id = rawdb._random.Next(1, 10001);
                             id = rawdb._random.Next(1, 10001);
                             idParameter.TypedValue = id;
                             idParameter.TypedValue = id;
@@ -190,7 +187,7 @@ namespace PlatformBenchmarks
 
 
         public async Task<List<Fortune>> LoadFortunesRows()
         public async Task<List<Fortune>> LoadFortunesRows()
         {
         {
-            var result = new List<Fortune>();
+            var result = new List<Fortune>(20);
 
 
             using (var db = new NpgsqlConnection(_connectionString))
             using (var db = new NpgsqlConnection(_connectionString))
             {
             {

+ 3 - 5
frameworks/CSharp/aspnetcore/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
-
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   </PropertyGroup>
@@ -13,12 +12,11 @@
   </PropertyGroup>
   </PropertyGroup>
   
   
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Condition=" '$(DatabaseProvider)' == 'Npgsql' " Include="Npgsql" Version="5.0.4" />
-    <PackageReference Condition=" '$(DatabaseProvider)' == 'MySqlConnector' " Include="MySqlConnector" Version="1.3.8" />
+    <PackageReference Condition=" '$(DatabaseProvider)' == 'Npgsql' " Include="Npgsql" Version="6.0.0-rc.1" />
+    <PackageReference Condition=" '$(DatabaseProvider)' == 'MySqlConnector' " Include="MySqlConnector" Version="1.3.12" />
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
       <None Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" />
       <None Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   </ItemGroup>
-
 </Project>
 </Project>

+ 17 - 3
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Program.cs

@@ -2,6 +2,8 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
+using System.Net;
+using System.Runtime.InteropServices;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Configuration;
@@ -62,7 +64,7 @@ namespace PlatformBenchmarks
             }
             }
 #endif
 #endif
 
 
-            var host = new WebHostBuilder()
+            var hostBuilder = new WebHostBuilder()
                 .UseBenchmarksConfiguration(config)
                 .UseBenchmarksConfiguration(config)
                 .UseKestrel((context, options) =>
                 .UseKestrel((context, options) =>
                 {
                 {
@@ -73,8 +75,20 @@ namespace PlatformBenchmarks
                         builder.UseHttpApplication<BenchmarkApplication>();
                         builder.UseHttpApplication<BenchmarkApplication>();
                     });
                     });
                 })
                 })
-                .UseStartup<Startup>()
-                .Build();
+                .UseStartup<Startup>();
+
+            hostBuilder.UseSockets(options =>
+            {
+                options.WaitForDataBeforeAllocatingBuffer = false;
+
+                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                {
+                    options.UnsafePreferInlineScheduling = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS") == "1";
+                }
+            });
+
+
+            var host = hostBuilder.Build();
 
 
             return host;
             return host;
         }
         }

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/appsettings.postgresql.json

@@ -1,4 +1,4 @@
 {
 {
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000",
+  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
   "Database": "postgresql"
   "Database": "postgresql"
 }
 }

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/appsettings.postgresql.updates.json

@@ -1,4 +1,4 @@
 {
 {
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000",
+  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",  
   "Database": "postgresql"
   "Database": "postgresql"
 }
 }

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-my.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY PlatformBenchmarks/appsettings.mysql.json ./appsettings.json
 COPY PlatformBenchmarks/appsettings.mysql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-pg-up.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY PlatformBenchmarks/appsettings.postgresql.updates.json ./appsettings.json
 COPY PlatformBenchmarks/appsettings.postgresql.updates.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY PlatformBenchmarks/appsettings.postgresql.json ./appsettings.json
 COPY PlatformBenchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-my.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg-up.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-my.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg-up.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ef-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 
 

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-my.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg-up.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-my.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json
 COPY Benchmarks/appsettings.mysql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg-up.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.updates.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ef-pg.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json
 COPY Benchmarks/appsettings.postgresql.json ./appsettings.json

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-json.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 
 

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore-mw.dockerfile

@@ -1,10 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 
 

+ 8 - 2
frameworks/CSharp/aspnetcore/aspcore.dockerfile

@@ -1,11 +1,17 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.1 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
 ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
+
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 COPY Benchmarks/appsettings.json ./appsettings.json
 COPY Benchmarks/appsettings.json ./appsettings.json

+ 203 - 0
frameworks/CSharp/aspnetcore/te.benchmarks.yml

@@ -0,0 +1,203 @@
+imports:
+  - https://raw.githubusercontent.com/dotnet/crank/main/src/Microsoft.Crank.Jobs.Wrk/wrk.yml
+  - https://github.com/aspnet/Benchmarks/blob/main/scenarios/aspnet.profiles.yml?raw=true
+
+# todo: change repository to TechEmpower
+# todo: change branch to master
+
+jobs:
+  aspnetcore:
+    source:
+      repository: https://github.com/sebastienros/FrameworkBenchmarks.git
+      branchOrCommit: sebros/net60
+      dockerContextDirectory: frameworks/CSharp/aspnetcore/
+    readyStateText: Application started.
+
+  postgresql:
+    source:
+      repository: https://github.com/TechEmpower/FrameworkBenchmarks.git
+      branchOrCommit: master
+      dockerFile: toolset/databases/postgres/postgres.dockerfile
+      dockerImageName: postgres_te
+      dockerContextDirectory: toolset/databases/postgres
+    readyStateText: ready to accept connections
+    noClean: true
+
+  mysql:
+    source:
+      repository: https://github.com/TechEmpower/FrameworkBenchmarks.git
+      branchOrCommit: master
+      dockerFile: toolset/databases/mysql/mysql.dockerfile
+      dockerImageName: mysql_te
+      dockerContextDirectory: toolset/databases/mysql
+    readyStateText: ready for connections
+    noClean: true
+
+scenarios:
+
+  plaintext:
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore.dockerfile
+          dockerImageName: aspcore
+    load:
+      job: wrk
+      variables:
+        presetHeaders: plaintext
+        path: /plaintext
+        pipeline: 16
+        serverPort: 8080
+        connections: 1024
+
+  plaintext_mw:
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-mw.dockerfile
+          dockerImageName: aspcore-mw
+    load:
+      job: wrk
+      variables:
+        presetHeaders: plaintext
+        path: /plaintext
+        pipeline: 16
+        serverPort: 8080
+        connections: 1024
+
+  json:
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore.dockerfile
+          dockerImageName: aspcore
+    load:
+      job: wrk
+      variables:
+        presetHeaders: json
+        path: /json
+        serverPort: 8080
+        connections: 512
+
+  fortunes:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
+          dockerImageName: aspcore-ado-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: html
+        path: /fortunes
+        serverPort: 8080
+        connections: 512
+
+  single_query:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
+          dockerImageName: aspcore-ado-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: json
+        path: /db
+        serverPort: 8080
+  
+  multiple_queries:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
+          dockerImageName: aspcore-ado-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: json
+        path: /queries/20
+        serverPort: 8080
+
+  updates:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-pg-up.dockerfile
+          dockerImageName: aspcore-ado-pg-up
+    load:
+      job: wrk
+      variables:
+        presetHeaders: json
+        path: /updates/20
+        serverPort: 8080
+
+  caching:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
+          dockerImageName: aspcore-ado-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: json
+        path: /cached-worlds/100
+
+  fortunes_mysql:
+    db:
+      job: mysql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-ado-my.dockerfile
+          dockerImageName: aspcore-ado-my
+    load:
+      job: wrk
+      variables:
+        presetHeaders: html
+        path: /fortunes
+        serverPort: 8080
+        connections: 512
+
+  fortunes_mvc_ado_pg:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg.dockerfile
+          dockerImageName: aspcore-mvc-ado-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: html
+        path: /mvc/fortunes/raw
+        serverPort: 8080
+        connections: 512
+
+  fortunes_mvc_ef_pg:
+    db:
+      job: postgresql
+    application:
+      job: aspnetcore
+      source:
+          dockerFile: frameworks/CSharp/aspnetcore/aspcore-mvc-ef-pg.dockerfile
+          dockerImageName: aspcore-mvc-ef-pg
+    load:
+      job: wrk
+      variables:
+        presetHeaders: html
+        path: /mvc/fortunes/ef
+        serverPort: 8080
+        connections: 512