Browse Source

[genhttp] Update to version 6.2 (#6961)

* Update GenHTTP to version 6.2

* Remove multiplexing for now
Andreas Nägeli 3 years ago
parent
commit
1825d1b410

+ 4 - 4
frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj

@@ -26,11 +26,11 @@
   </ItemGroup>
     
   <ItemGroup>
-    <PackageReference Include="GenHTTP.Core" Version="6.0.0" />
-    <PackageReference Include="GenHTTP.Modules.Razor" Version="6.0.0" />
-    <PackageReference Include="GenHTTP.Modules.Webservices" Version="6.0.0" />
+    <PackageReference Include="GenHTTP.Core" Version="6.2.0" />
+    <PackageReference Include="GenHTTP.Modules.Razor" Version="6.2.0" />
+    <PackageReference Include="GenHTTP.Modules.Webservices" Version="6.2.0" />
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
-    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.1" />
   </ItemGroup>
   
 </Project>

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Model/DatabaseContext.cs

@@ -25,7 +25,7 @@ namespace Benchmarks.Model
         {
             var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
 
-            optionsBuilder.UseNpgsql("Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3");
+            optionsBuilder.UseNpgsql("Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4");
 
             if (!tracking)
             {

+ 4 - 1
frameworks/CSharp/genhttp/Benchmarks/Tests/FortuneHandler.cs

@@ -13,6 +13,7 @@ using GenHTTP.Modules.IO;
 using GenHTTP.Modules.Razor;
 
 using Benchmarks.Model;
+using System.IO;
 
 namespace Benchmarks.Tests
 {
@@ -90,7 +91,9 @@ namespace Benchmarks.Tests
 
         public IEnumerable<ContentElement> GetContent(IRequest request) => Enumerable.Empty<ContentElement>();
 
-        public async ValueTask<string> RenderAsync(TemplateModel model) => await Template.RenderAsync(model);
+        public ValueTask<string> RenderAsync(TemplateModel model) => Template.RenderAsync(model);
+
+        public ValueTask RenderAsync(TemplateModel model, Stream target) => Template.RenderAsync(model, target);
 
         public async ValueTask<IResponse> HandleAsync(IRequest request)
         {

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Tests/QueryResource.cs

@@ -13,7 +13,7 @@ namespace Benchmarks.Tests
 
     public sealed class QueryResource
     {
-        private static Random _Random = new Random();
+        private static readonly Random _Random = new Random();
 
         [ResourceMethod(":queries")]
         public ValueTask<List<World>> GetWorldsFromPath(string queries) => GetWorlds(queries);

+ 12 - 13
frameworks/CSharp/genhttp/genhttp.dockerfile

@@ -1,19 +1,18 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
-WORKDIR /source
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+WORKDIR /app
+COPY Benchmarks .
+RUN dotnet publish -c Release -o out
 
-# copy csproj and restore as distinct layers
-COPY Benchmarks/*.csproj .
-RUN dotnet restore -r linux-musl-x64
+FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runtime
 
-# copy and publish app and libraries
-COPY Benchmarks/ .
-RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
+# Full PGO
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
 
-# final stage/image
-FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine
 WORKDIR /app
-COPY --from=build /app .
+COPY --from=build /app/out ./
 
-ENTRYPOINT ["./Benchmarks"]
+EXPOSE 8080
 
-EXPOSE 8080
+ENTRYPOINT ["dotnet", "Benchmarks.dll"]