Skip to content

Commit

Permalink
Merge branch 'TechEmpower:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cclilshy authored Nov 5, 2024
2 parents 7ee4d23 + d095d80 commit e9457b2
Show file tree
Hide file tree
Showing 104 changed files with 1,341 additions and 741 deletions.
2 changes: 1 addition & 1 deletion frameworks/CSharp/aspnetcore/appsettings.postgresql.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
"ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=512;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4",
"Database": "postgresql"
}
6 changes: 3 additions & 3 deletions frameworks/CSharp/aspnetcore/aspnetcore-aot.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
RUN apt-get update
RUN apt-get -yqq install clang zlib1g-dev
WORKDIR /app
COPY src/Platform .
RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql /p:PublishAot=true /p:OptimizationPreference=Speed /p:GarbageCollectionAdaptationMode=0

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
ENV URLS http://+:8080
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
ENV URLS=http://+:8080

WORKDIR /app
COPY --from=build /app/out ./
Expand Down
7 changes: 5 additions & 2 deletions frameworks/CSharp/aspnetcore/aspnetcore-minimal.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY src/Minimal .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
ENV URLS http://+:8080
ENV DOTNET_GCDynamicAdaptationMode=0
ENV DOTNET_ReadyToRun=0
ENV DOTNET_HillClimbing_Disable=1

WORKDIR /app
COPY --from=build /app/out ./
Expand Down
7 changes: 5 additions & 2 deletions frameworks/CSharp/aspnetcore/aspnetcore-mvc.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY src/Mvc .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
ENV URLS http://+:8080
ENV DOTNET_GCDynamicAdaptationMode=0
ENV DOTNET_ReadyToRun=0
ENV DOTNET_HillClimbing_Disable=1

WORKDIR /app
COPY --from=build /app/out ./
Expand Down
7 changes: 5 additions & 2 deletions frameworks/CSharp/aspnetcore/aspnetcore-mysql.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY src/Platform .
RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
ENV URLS http://+:8080
ENV DOTNET_GCDynamicAdaptationMode=0
ENV DOTNET_ReadyToRun=0
ENV DOTNET_HillClimbing_Disable=1

WORKDIR /app
COPY --from=build /app/out ./
Expand Down
9 changes: 6 additions & 3 deletions frameworks/CSharp/aspnetcore/aspnetcore.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY src/Platform .
RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
ENV URLS http://+:8080
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
ENV URLS=http://+:8080
ENV DOTNET_GCDynamicAdaptationMode=0
ENV DOTNET_ReadyToRun=0
ENV DOTNET_HillClimbing_Disable=1

WORKDIR /app
COPY --from=build /app/out ./
Expand Down
8 changes: 4 additions & 4 deletions frameworks/CSharp/aspnetcore/src/Minimal/Minimal.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<UserSecretsId>38063504-d08c-495a-89c9-daaad2f60f31</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Dapper" Version="2.1.21" />
<PackageReference Include="RazorSlices" Version="0.7.0" />
<PackageReference Include="Npgsql" Version="8.0.5" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="RazorSlices" Version="0.8.1" />
</ItemGroup>

</Project>
14 changes: 6 additions & 8 deletions frameworks/CSharp/aspnetcore/src/Minimal/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// 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.

using System.Text.Encodings.Web;
using System.Text.Unicode;
using Microsoft.AspNetCore.Http.HttpResults;
using RazorSlices;
using Minimal;
using Minimal.Database;
using Minimal.Models;
using System.Text.Encodings.Web;
using System.Text.Unicode;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -36,14 +34,14 @@

app.MapGet("/db", async (Db db) => await db.LoadSingleQueryRow());

var createFortunesTemplate = RazorSlice.ResolveSliceFactory<List<Fortune>>("/Templates/Fortunes.cshtml");
var htmlEncoder = CreateHtmlEncoder();

app.MapGet("/fortunes", async (HttpContext context, Db db) => {
var fortunes = await db.LoadFortunesRows();
var template = (RazorSliceHttpResult<List<Fortune>>)createFortunesTemplate(fortunes);
template.HtmlEncoder = htmlEncoder;
return template;
var result = Results.Extensions.RazorSlice<Minimal.Slices.Fortunes, List<Fortune>>(fortunes);
result.HtmlEncoder = htmlEncoder;
return result;
});

app.MapGet("/queries/{count?}", async (Db db, string? count) => await db.LoadMultipleQueriesRows(count));
Expand Down
6 changes: 3 additions & 3 deletions frameworks/CSharp/aspnetcore/src/Mvc/Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<UserSecretsId>574ff97c-fe74-4b0d-af25-8d7200a036f5</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.2" />
<PackageReference Include="Npgsql" Version="8.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0-rc.2" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions frameworks/CSharp/aspnetcore/src/Platform/Platform.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsTestAssetProject>true</IsTestAssetProject>
<LangVersion>preview</LangVersion>
Expand All @@ -19,9 +19,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="MySqlConnector" Version="2.3.1" />
<PackageReference Include="Dapper" Version="2.1.21" />
<PackageReference Include="Npgsql" Version="8.0.5" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="RazorSlices" Version="0.7.0" Condition="$(PublishAot) != 'true'" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion frameworks/CSharp/aspnetcore/src/Platform/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public static IWebHost BuildWebHost(string[] args)
#if DEBUG
.AddUserSecrets<Program>()
#endif
.AddEnvironmentVariables()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Crystal/kemal/kemal.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM crystallang/crystal:1.12.1
FROM crystallang/crystal:1.14.0

WORKDIR /kemal
COPY views views
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Crystal/kemal/shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ shards:

kemal:
git: https://github.com/kemalcr/kemal.git
version: 1.5.0
version: 1.6.0

pg:
git: https://github.com/will/crystal-pg.git
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Crystal/kemal/shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
version: 0.28.0
kemal:
github: kemalcr/kemal
version: 1.5.0
version: 1.6.0
redis:
github: stefanwille/crystal-redis
version: 2.8.0
Expand Down
4 changes: 2 additions & 2 deletions frameworks/Crystal/lucky/lucky.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM crystallang/crystal:1.12.1
FROM crystallang/crystal:1.14.0

WORKDIR /lucky
COPY shard.lock shard.lock
Expand All @@ -14,7 +14,7 @@ ENV LUCKY_ENV production

RUN shards build bench --release --no-debug

ENV DATABASE_URL postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world?initial_pool_size=56&max_idle_pool_size=56
ENV DATABASE_URL postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world?initial_pool_size=10&max_idle_pool_size=10

EXPOSE 8080

Expand Down
6 changes: 3 additions & 3 deletions frameworks/Crystal/lucky/shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.0
shards:
avram:
git: https://github.com/luckyframework/avram.git
version: 1.2.0
version: 1.3.0

backtracer:
git: https://github.com/sija/backtracer.cr.git
Expand Down Expand Up @@ -30,7 +30,7 @@ shards:

habitat:
git: https://github.com/luckyframework/habitat.git
version: 0.4.8
version: 0.4.9

lucky:
git: https://github.com/luckyframework/lucky.git
Expand Down Expand Up @@ -66,7 +66,7 @@ shards:

splay_tree_map:
git: https://github.com/wyhaines/splay_tree_map.cr.git
version: 0.2.2
version: 0.3.0

wordsmith:
git: https://github.com/luckyframework/wordsmith.git
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Go/goravel/src/gin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang-migrate/migrate/v4 v4.17.1 // indirect
github.com/golang-module/carbon/v2 v2.3.12 // indirect
Expand Down
3 changes: 2 additions & 1 deletion frameworks/Go/goravel/src/gin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@

package io.helidon.benchmark.nima.models;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import jakarta.json.Json;
import jakarta.json.JsonBuilderFactory;

public interface DbRepository {

JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap());

World getWorld(int id);

List<World> getWorlds(int count);

World updateWorld(World world);

List<World> updateWorlds(int count);

List<Fortune> getFortunes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ public List<World> getWorlds(int count) {
}
}

@Override
public World updateWorld(World world) {
try (Connection c = getConnection()) {
return updateWorld(world, c);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
public List<World> updateWorlds(int count) {
try (Connection c = getConnection()) {
Expand Down
Loading

0 comments on commit e9457b2

Please sign in to comment.