Browse Source

update version of akazawayun.pro (#10231)

* add new test : CSharp/akazawayun.pro

* modify config and code

* add content-type

* update url

* update package version

* add 3 new tests: db、queries、updates

1. add 3 new tests: db、queries、updates;
2. split code to multi files;

* -

* use generated sql instead const string.

* update version

* fix bug of db query

* set port to 8080

* 升级 akazawayun.pro 框架版本到 14

* i forget to update the port change...

* test self whether work fine..

* update nuget version

* why pr failed...

* 不小心多提交了别人的框架...改回

* akazawayun fix bug

* remove db test

there is some error in mysql

* confirmed there is bug in mysql.data 9.5.0

还是用8080端口吧- -b, 都用8080, 改其他的对比测时不方便

* downgrade mysql.data back to 9.4.0

* fix bug of akazawayun.pro

* update version of akazawayun.pro

* update version

* add platform test
AkazawaYun 1 month ago
parent
commit
b965c8bd06

+ 8 - 2
frameworks/CSharp/akazawayun.pro/AkazawaYun.FrameworkBenchmarks.sln → frameworks/CSharp/akazawayun.pro/AkazawaYun.Benchmark.sln

@@ -1,9 +1,11 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 17
-VisualStudioVersion = 17.14.36310.24 d17.14
+VisualStudioVersion = 17.14.36310.24
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AkazawaYun.FrameworkBenchmarks", "src/AkazawaYun.FrameworkBenchmarks.csproj", "{BB5587FE-E4A0-851D-6025-F5FF0EC54525}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AkazawaYun.Benchmark.WebApi", "src\AkazawaYun.Benchmark.WebApi\AkazawaYun.Benchmark.WebApi.csproj", "{BB5587FE-E4A0-851D-6025-F5FF0EC54525}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AkazawaYun.Benchmark.Platform", "src\AkazawaYun.Benchmark.Platform\AkazawaYun.Benchmark.Platform.csproj", "{E7CA7DF7-F4AB-47EC-BF2B-1148058CDF43}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
 		{BB5587FE-E4A0-851D-6025-F5FF0EC54525}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BB5587FE-E4A0-851D-6025-F5FF0EC54525}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{BB5587FE-E4A0-851D-6025-F5FF0EC54525}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E7CA7DF7-F4AB-47EC-BF2B-1148058CDF43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E7CA7DF7-F4AB-47EC-BF2B-1148058CDF43}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E7CA7DF7-F4AB-47EC-BF2B-1148058CDF43}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E7CA7DF7-F4AB-47EC-BF2B-1148058CDF43}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 13 - 0
frameworks/CSharp/akazawayun.pro/akazawayun.pro-platform.dockerfile

@@ -0,0 +1,13 @@
+# 生成
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS publish
+WORKDIR /app
+COPY src/AkazawaYun.Benchmark.Platform .
+RUN dotnet publish -c Release -o /app/publish
+
+# 运行
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS runtime
+WORKDIR /app
+COPY --from=publish /app/publish .
+
+EXPOSE 8080
+ENTRYPOINT ["dotnet", "AkazawaYun.Benchmark.Platform.dll"]

+ 2 - 2
frameworks/CSharp/akazawayun.pro/akazawayun.pro.dockerfile

@@ -1,7 +1,7 @@
 # 生成
 FROM mcr.microsoft.com/dotnet/sdk:9.0 AS publish
 WORKDIR /app
-COPY src .
+COPY src/AkazawaYun.Benchmark.WebApi .
 RUN dotnet publish -c Release -o /app/publish
 
 # 运行
@@ -10,4 +10,4 @@ WORKDIR /app
 COPY --from=publish /app/publish .
 
 EXPOSE 8080
-ENTRYPOINT ["dotnet", "AkazawaYun.FrameworkBenchmarks.dll"]
+ENTRYPOINT ["dotnet", "AkazawaYun.Benchmark.WebApi.dll"]

+ 42 - 26
frameworks/CSharp/akazawayun.pro/benchmark_config.json

@@ -1,28 +1,44 @@
 {
-  "framework": "akazawayun.pro",
-  "tests": [
-    {
-      "default": {
-        "display_name": "akazawayun.pro",
-        "framework": "akazawayun.pro",
-        "webserver": "akazawayun.pro",
-        "plaintext_url": "/plaintext",
-        "json_url": "/json",
-        "db_url": "/db",
-        "query_url": "/queries?queries=",
-        "update_url": "/updates?queries=",
-        "port": 8080,
-        "classification": "Micro",
-        "approach": "Realistic",
-        "platform": ".NET",
-        "language": "C#",
-        "flavor": "CoreCLR",
-        "os": "Linux",
-        "database_os": "Linux",
-        "database": "MySQL",
-        "orm": "Micro",
-        "notes": ""
-      }
-    }
-  ]
+    "framework": "akazawayun.pro",
+    "tests": [
+        {
+            "default": {
+                "display_name": "akazawayun.pro [webapi]",
+                "framework": "akazawayun.pro",
+                "webserver": "akazawayun.pro",
+                "plaintext_url": "/plaintext",
+                "json_url": "/json",
+                "db_url": "/db",
+                "query_url": "/queries?queries=",
+                "update_url": "/updates?queries=",
+                "port": 8080,
+                "classification": "Micro",
+                "approach": "Realistic",
+                "platform": ".NET",
+                "language": "C#",
+                "flavor": "CoreCLR",
+                "os": "Linux",
+                "database_os": "Linux",
+                "database": "MySQL",
+                "orm": "Micro",
+                "notes": ""
+            },
+            "platform": {
+                "display_name": "akazawayun.pro [platform]",
+                "framework": "akazawayun.pro",
+                "webserver": "akazawayun.pro",
+                "plaintext_url": "/plaintext",
+                "json_url": "/json",
+                "port": 8080,
+                "classification": "Platform",
+                "approach": "Realistic",
+                "platform": ".NET",
+                "language": "C#",
+                "flavor": "CoreCLR",
+                "os": "Linux",
+                "database_os": "Linux",
+                "notes": ""
+            }
+        }
+    ]
 }

+ 21 - 0
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.Platform/AkazawaYun.Benchmark.Platform.csproj

@@ -0,0 +1,21 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net9.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+    <EnableSourceGenerator>true</EnableSourceGenerator>
+    <PublishAot>false</PublishAot>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
+    <ServerGarbageCollection>true</ServerGarbageCollection>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="AkazawaYun.PRO" Version="1.14.25.1103" />
+  </ItemGroup>
+
+</Project>

+ 14 - 0
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.Platform/Model.cs

@@ -0,0 +1,14 @@
+#pragma warning disable IDE1006,CS8981
+using System.Text.Json.Serialization;
+
+namespace AkazawaYun.Benchmark.Platform;
+
+
+[JsonSerializable(typeof(JsonModel))]
+public partial class AotJsonContext : JsonSerializerContext { }
+
+
+public class JsonModel
+{
+    public string? message { get; set; }
+}

+ 55 - 0
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.Platform/MyBenchmarkReceptor.cs

@@ -0,0 +1,55 @@
+using AkazawaYun.PRO7;
+using System.Text;
+
+namespace AkazawaYun.Benchmark.Platform;
+
+class MyBenchmarkReceptor : akzWebReceptorBenchmark
+{
+    readonly JsonModel JsonModel;
+    readonly ReadOnlyMemory<byte> JsonContentLength;
+
+
+    public MyBenchmarkReceptor()
+    {
+        JsonModel = new()
+        {
+            message = "Hello, World!"
+        };
+        akzJson.Text2Json(JsonModel, out ReadOnlyMemory<byte> json);
+        JsonContentLength = Encoding.UTF8.GetBytes($"{json.Length}\r\n\r\n");
+    }
+
+
+    public override ValueTask SendPlaintext(IHttpContext http)
+    {
+        return base.SendPlaintext(http);
+    }
+    public override async ValueTask SendJson(IHttpContext http)
+    {
+        await http.Slient.Send(DataJson_OnlyHeaderExceptContentLength);
+        await http.Slient.Send(JsonContentLength);
+        akzJson.Text2Json(JsonModel, out ReadOnlyMemory<byte> json);
+        await http.Slient.Send(json);
+    }
+    public override ValueTask SendDb(IHttpContext http)
+    {
+        throw new NotImplementedException();
+    }
+    public override ValueTask SendQueries(IHttpContext http)
+    {
+        throw new NotImplementedException();
+    }
+    public override ValueTask SendUpdates(IHttpContext http)
+    {
+        throw new NotImplementedException();
+    }
+    public override ValueTask SendCachedQueries(IHttpContext http)
+    {
+        throw new NotImplementedException();
+    }
+    public override ValueTask SendFortunes(IHttpContext http)
+    {
+        throw new NotImplementedException();
+    }
+
+}

+ 37 - 0
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.Platform/Program.cs

@@ -0,0 +1,37 @@
+using AkazawaYun.PRO7;
+
+namespace AkazawaYun.Benchmark.Platform;
+
+class Program
+{
+    static readonly akzWebBuilder builder;
+    const int port = 8080;
+
+    static Program()
+    {
+        akzLog.War("AkazawaYun.PRO 压力测试特供版 ver2025.11.3, 只支持 /plaintext 和 /json");
+        akzJson.Config(null, AotJsonContext.Default);
+        builder = akzWebBuilder.Shared.SetPort(port).SetDev(true)
+            .Add<akzXmlSummary, akzXmlSummary>(() => null)
+            .Add<IWebReceptor, MyBenchmarkReceptor>(() => new MyBenchmarkReceptor())
+            .Add<IWebListener, akzHttpListenerVIBenchmark>(() => new(port)
+            {
+                LogLevel = 0
+            }).Build();
+    }
+    static async Task Main()
+    {
+        await builder.Launch();
+
+        akzLog.Inf("[API SELF-TEST]");
+        string url = $"http://localhost:{port}/plaintext";
+        akzLog.Inf(" REQ URL :" + url);
+        string res = await akzHttpClient.Shared.Get(url).FetchString();
+        akzLog.Inf(" RES LEN :" + res.Length);
+        akzLog.Inf(" RES BODY:" + res);
+        akzLog.Inf("[OK, I WORK FINE]");
+
+        akzLog.Default = akzLog.Output.NoneButWar;
+        await Task.Delay(-1);
+    }
+}

+ 1 - 1
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.FrameworkBenchmarks.csproj → frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/AkazawaYun.Benchmark.WebApi.csproj

@@ -15,7 +15,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="AkazawaYun.PRO" Version="1.14.25.1027" />
+    <PackageReference Include="AkazawaYun.PRO" Version="1.14.25.1103" />
     <PackageReference Include="MySql.Data" Version="9.4.0" />
   </ItemGroup>
 

+ 1 - 1
frameworks/CSharp/akazawayun.pro/src/Model.cs → frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/Model.cs

@@ -2,7 +2,7 @@
 using AkazawaYun.AOT;
 using System.Text.Json.Serialization;
 
-namespace AkazawaYun.FrameworkBenchmarks;
+namespace AkazawaYun.Benchmark.WebApi;
 
 
 [JsonSerializable(typeof(JsonModel))]

+ 1 - 1
frameworks/CSharp/akazawayun.pro/src/Mysql.cs → frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/Mysql.cs

@@ -2,7 +2,7 @@
 using MySql.Data.MySqlClient;
 using System.Data.Common;
 
-namespace AkazawaYun.FrameworkBenchmarks;
+namespace AkazawaYun.Benchmark.WebApi;
 
 class Mysql : akzDbFactory
 {

+ 4 - 2
frameworks/CSharp/akazawayun.pro/src/Program.cs → frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/Program.cs

@@ -3,7 +3,7 @@
 using AkazawaYun.AOT;
 using AkazawaYun.PRO7;
 
-namespace AkazawaYun.FrameworkBenchmarks;
+namespace AkazawaYun.Benchmark.WebApi;
 
 class Program : IPostFunctionWrapper
 {
@@ -14,8 +14,10 @@ class Program : IPostFunctionWrapper
     static Program()
     {
         akzJson.Config(null, AotJsonContext.Default);
-        builder = akzWebBuilder.Shared.SetPort(port)
+        builder = akzWebBuilder.Shared.SetPort(port).SetDev()
+            .Add<akzXmlSummary, akzXmlSummary>(() => null)
             .Build()
+            .Config<IWebListener, akzHttpListenerVBase>(lis => lis.LogLevel = 0)
             .Config<IWebReceptor, akzWebInterceptor>(itc =>
             {
                 itc.ClearInterceptor();

+ 1 - 1
frameworks/CSharp/akazawayun.pro/src/WorldService.cs → frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/WorldService.cs

@@ -1,6 +1,6 @@
 using AkazawaYun.PRO7;
 
-namespace AkazawaYun.FrameworkBenchmarks;
+namespace AkazawaYun.Benchmark.WebApi;
 
 class WorldService
 {