Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds TodosApi app (native AOT "goldilocks" stage 2) #1828

Merged
merged 26 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d473ec9
Add goldilocks stage 2 TodosApp
DamianEdwards Mar 30, 2023
18f67f3
Fix logging configuration & set to publish release
DamianEdwards Mar 30, 2023
e6795f4
Seed database on initialization
DamianEdwards Mar 30, 2023
db3b880
More logging config & remove unneeded code
DamianEdwards Mar 30, 2023
fcd5372
Add health checks
DamianEdwards Mar 30, 2023
c2294df
Add exception handling middleware
DamianEdwards Mar 30, 2023
2c0c161
PR feedback
DamianEdwards Mar 30, 2023
5309681
Ensure file-based config is loaded all the time (needed for JWT)
DamianEdwards Mar 30, 2023
8931a01
PR feedback & cleanup restore warnings
DamianEdwards Mar 30, 2023
519d27e
Update DB health check query & disable PublishAot for now
DamianEdwards Mar 30, 2023
1385ee3
Update Program.cs
DamianEdwards Mar 30, 2023
4b3a834
Update Program.cs
DamianEdwards Mar 30, 2023
c024b14
Update Program.cs
DamianEdwards Mar 30, 2023
8ef37cf
Add stage 2 scenarios to yml files
DamianEdwards Mar 30, 2023
8fbfd62
Update health checks to be more descriptive
DamianEdwards Mar 30, 2023
638fc67
Flow cancellation tokens through to database calls
DamianEdwards Mar 30, 2023
9a60016
Don't fail for bad JWT configuration & manually add authn/z middleware
DamianEdwards Mar 30, 2023
adc3c5c
Remove unused using
DamianEdwards Mar 30, 2023
4b5b37f
Update scenarios/goldilocks.benchmarks.yml
DamianEdwards Mar 31, 2023
6182ed4
Update src/BenchmarksApps/TodosApi/DatabaseHealthCheck.cs
DamianEdwards Mar 31, 2023
fc3b1b2
PR feedback & tweaks
DamianEdwards Mar 31, 2023
fa0d1dd
Add database job definitions for stage 2 aot app
DamianEdwards Mar 31, 2023
4ab5b49
Update goldilocks.benchmarks.yml
DamianEdwards Mar 31, 2023
5978271
Fix compile issue
DamianEdwards Mar 31, 2023
0890252
Update goldilocks.benchmarks.yml
DamianEdwards Mar 31, 2023
4be1491
Don't change todos app table owner on initialization
DamianEdwards Mar 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,26 @@
<MicrosoftEntityFrameworkCoreSqliteVersion50>5.0.17</MicrosoftEntityFrameworkCoreSqliteVersion50>
<MicrosoftEntityFrameworkCoreSqliteVersion60>6.0.14</MicrosoftEntityFrameworkCoreSqliteVersion60>
<MicrosoftEntityFrameworkCoreSqliteVersion80>8.0.0-preview.1.23111.4</MicrosoftEntityFrameworkCoreSqliteVersion80>

<MicrosoftAspNetCoreAppPackageVersion80>8.0.0-preview.3.23177.8</MicrosoftAspNetCoreAppPackageVersion80>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework) == 'netcoreapp2.1'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<MicrosoftAspNetCoreAppPackageVersion>2.1.3</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'netcoreapp2.2'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
<MicrosoftAspNetCoreAppPackageVersion>2.2.0</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'netcoreapp3.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<MicrosoftAspNetCoreAppPackageVersion>3.0.0</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<MicrosoftAspNetCoreAppPackageVersion>3.1.0</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'net6.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<MicrosoftAspNetCoreAppPackageVersion>6.0.14</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'net8.0'">
<MicrosoftAspNetCoreAppPackageVersion>8.0.0-preview.1.23112.2</MicrosoftAspNetCoreAppPackageVersion>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<MicrosoftAspNetCoreAppPackageVersion>$(MicrosoftAspNetCoreAppPackageVersion80)</MicrosoftAspNetCoreAppPackageVersion>
Copy link
Member

Choose a reason for hiding this comment

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

Works, but why treat net8 differently with a separate constant?

Copy link
Member Author

@DamianEdwards DamianEdwards Mar 30, 2023

Choose a reason for hiding this comment

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

I added a net8 variant so it could be referenced elsewhere when a TargetFramework is not passed in from the outside (MSBuild order of evaluation, etc.).

</PropertyGroup>
</Project>
26 changes: 26 additions & 0 deletions build/nativeaot-scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ parameters:
arguments: --scenario basicminimalapipublishaot $(goldilocksJobs) --property scenario=Stage1AotServerGC --property publish=nativeaot --application.packageReferences \"Microsoft.Dotnet.ILCompiler=$(MicrosoftNETCoreAppPackageVersion)\" --application.buildArguments \"/p:ServerGarbageCollection=true\"
condition: 'true'

- displayName: Goldilocks Stage 2 (CoreCLR)
arguments: --scenario todosapivanilla $(goldilocksJobs) --property scenario=Stage2 --property publish=coreclr
condition: 'true'

- displayName: Goldilocks Stage 2 (CoreCLR - Server GC)
arguments: --scenario todosapivanilla $(goldilocksJobs) --property scenario=Stage2ServerGC --property publish=coreclr --application.buildArguments \"/p:ServerGarbageCollection=true\"
condition: 'true'

- displayName: Goldilocks Stage 2 (CoreCLR - PGO)
arguments: --scenario todosapivanilla $(goldilocksJobs) --property scenario=Stage2Pgo --property publish=coreclr --application.environmentVariables DOTNET_TieredPGO=1
condition: Math.round(Date.now() / 43200000) % 6 == 1 # once every 6 half-days (43200000 ms per half-day)

- displayName: Goldilocks Stage 2 (CoreCLR - Trim R2R SingleFile)
arguments: --scenario todosapipublishtrimr2rsinglefile $(goldilocksJobs) --property scenario=Stage2TrimR2RSingleFile --property publish=coreclr
condition: 'true'

- displayName: Goldilocks Stage 2 (NativeAOT - Workstation GC)
# workaround https://github.com/dotnet/runtime/issues/81382 by explicitly referencing a Microsoft.Dotnet.ILCompiler version
arguments: --scenario todosapipublishaot $(goldilocksJobs) --property scenario=Stage2Aot --property publish=nativeaot --application.packageReferences \"Microsoft.Dotnet.ILCompiler=$(MicrosoftNETCoreAppPackageVersion)\"
condition: 'true'

- displayName: Goldilocks Stage 2 (NativeAOT - Server GC)
# workaround https://github.com/dotnet/runtime/issues/81382 by explicitly referencing a Microsoft.Dotnet.ILCompiler version
arguments: --scenario todosapipublishaot $(goldilocksJobs) --property scenario=Stage2AotServerGC --property publish=nativeaot --application.packageReferences \"Microsoft.Dotnet.ILCompiler=$(MicrosoftNETCoreAppPackageVersion)\" --application.buildArguments \"/p:ServerGarbageCollection=true\"
condition: 'true'

- displayName: Goldilocks gRPC Stage 1 (CoreCLR)
arguments: --scenario basicgrpcvanilla $(goldilocksJobs) --property scenario=Stage1Grpc --property publish=coreclr
condition: 'true'
Expand Down
72 changes: 72 additions & 0 deletions scenarios/goldilocks.benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
serverScheme: http
serverPort: 5000
arguments: "--urls {{serverScheme}}://{{serverAddress}}:{{serverPort}}"
todosapiaspnetbenchmarks:
source:
repository: https://github.com/aspnet/benchmarks.git
branchOrCommit: main
project: src/BenchmarksApps/TodosApi/TodosApi.csproj
readyStateText: Application started.
variables:
serverScheme: http
serverPort: 5000
arguments: "--urls {{serverScheme}}://{{serverAddress}}:{{serverPort}}"
basicgrpcaspnetbenchmarks:
source:
repository: https://github.com/aspnet/benchmarks.git
Expand All @@ -42,6 +52,16 @@ jobs:
waitForExit: false
options:
requiredOperatingSystem: linux
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


scenarios:

Expand Down Expand Up @@ -82,6 +102,58 @@ scenarios:
presetHeaders: json
path: /todos

todosapipublishaot:
db:
job: postgresql
application:
job: todosapiaspnetbenchmarks
buildArguments:
- "/p:PublishAot=true"
- "/p:StripSymbols=true"
environmentVariables:
CONNECTIONSTRINGS__TODODB: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
presetHeaders: json
path: /api/todos

todosapipublishtrimr2rsinglefile:
db:
job: postgresql
application:
job: todosapiaspnetbenchmarks
buildArguments:
- "/p:PublishAot=false"
- "/p:PublishTrimmed=true"
- "/p:PublishReadyToRun=true"
- "/p:PublishSingleFile=true"
- "/p:TrimMode=full"
- "/p:EnableRequestDelegateGenerator=true"
environmentVariables:
CONNECTIONSTRINGS__TODODB: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
presetHeaders: json
path: /api/todos

todosapivanilla:
db:
job: postgresql
application:
job: todosapiaspnetbenchmarks
buildArguments:
- "/p:PublishAot=false"
- "/p:EnableRequestDelegateGenerator=false"
environmentVariables:
CONNECTIONSTRINGS__TODODB: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
presetHeaders: json
path: /api/todos

basicgrpcpublishaot:
application:
job: basicgrpcaspnetbenchmarks
Expand Down
13 changes: 10 additions & 3 deletions src/BenchmarksApps.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformBenchmarks", "BenchmarksApps\TechEmpower\PlatformBenchmarks\PlatformBenchmarks.csproj", "{ACA43671-AD28-4F72-AAAB-6C32B388C2F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{689C58F6-8DF0-4565-887F-C9A9BDA757D8}"
ProjectSection(SolutionItems) = preProject
BenchmarksApps\Directory.Build.props = BenchmarksApps\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildPerformance", "BenchmarksApps\BuildPerformance\BuildPerformance.csproj", "{2E953AFB-4900-4B5D-9E78-819E950CD365}"
EndProject
Expand All @@ -52,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TcpEcho", "BenchmarksApps\T
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorUnited", "BenchmarksApps\TechEmpower\BlazorUnited\BlazorUnited.csproj", "{FE3606FF-CBC9-421A-A0B5-836E312E7719}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodosApi", "BenchmarksApps\TodosApi\TodosApi.csproj", "{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_Database|Any CPU = Debug_Database|Any CPU
Expand Down Expand Up @@ -196,6 +195,14 @@ Global
{FE3606FF-CBC9-421A-A0B5-836E312E7719}.Release_Database|Any CPU.Build.0 = Release_Database|Any CPU
{FE3606FF-CBC9-421A-A0B5-836E312E7719}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE3606FF-CBC9-421A-A0B5-836E312E7719}.Release|Any CPU.Build.0 = Release|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Debug_Database|Any CPU.ActiveCfg = Debug_Database|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Debug_Database|Any CPU.Build.0 = Debug_Database|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Release_Database|Any CPU.ActiveCfg = Release_Database|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Release_Database|Any CPU.Build.0 = Release_Database|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E1A1F61-43E4-4629-A25B-7E5FA82697D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 0 additions & 6 deletions src/BenchmarksApps/Directory.Build.props

This file was deleted.

7 changes: 5 additions & 2 deletions src/BenchmarksApps/DistributedCache/DistributedCache.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<MicrosoftAspNetCoreAppPackageVersion Condition="$(MicrosoftAspNetCoreAppPackageVersion) == ''">$(TargetFramework.Substring(3,3)).*</MicrosoftAspNetCoreAppPackageVersion>

<!-- Set package versions to float to latest based on TFM if not defined -->
<MicrosoftNETCoreAppPackageVersion Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftNETCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion Condition="'$(MicrosoftAspNetCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/BenchmarksApps/Mvc/Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

<!-- Set package versions to float to latest based on TFM if not defined -->
<MicrosoftNETCoreAppPackageVersion Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftNETCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion Condition="'$(MicrosoftAspNetCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/BenchmarksApps/SignalR/BenchmarkServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

<!-- Set package versions to float to latest based on TFM if not defined -->
<MicrosoftNETCoreAppPackageVersion Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftNETCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion Condition="'$(MicrosoftAspNetCoreAppPackageVersion)' == '' and '$(TargetFramework)' != ''">$(TargetFramework.Substring(3,3)).*</MicrosoftAspNetCoreAppPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarksApps/StaticFiles/StaticFiles.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading