Эх сурвалжийг харах

update akazawayun.pro version (#10211)

* 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
AkazawaYun 1 сар өмнө
parent
commit
66f404f818

+ 1 - 0
.gitignore

@@ -69,3 +69,4 @@ benchmark.cfg
 
 # python
 .venv/
+frameworks/CSharp/akazawayun.pro/Dockerfile

+ 25 - 0
frameworks/CSharp/akazawayun.pro/AkazawaYun.FrameworkBenchmarks.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36310.24 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AkazawaYun.FrameworkBenchmarks", "src/AkazawaYun.FrameworkBenchmarks.csproj", "{BB5587FE-E4A0-851D-6025-F5FF0EC54525}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{BB5587FE-E4A0-851D-6025-F5FF0EC54525}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{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
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {81EA49A3-BB25-4EC5-B861-02520931CF63}
+	EndGlobalSection
+EndGlobal

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

@@ -9,5 +9,5 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS runtime
 WORKDIR /app
 COPY --from=publish /app/publish .
 
-EXPOSE 2022
+EXPOSE 8080
 ENTRYPOINT ["dotnet", "AkazawaYun.FrameworkBenchmarks.dll"]

+ 6 - 6
frameworks/CSharp/akazawayun.pro/benchmark_config.json

@@ -6,12 +6,12 @@
         "display_name": "akazawayun.pro",
         "framework": "akazawayun.pro",
         "webserver": "akazawayun.pro",
-        "plaintext_url": "/post/plaintext",
-        "json_url": "/post/json",
-        "db_url": "/post/db",
-        "query_url": "/post/queries?queries=",
-        "update_url": "/post/updates?queries=",
-        "port": 2022,
+        "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",

+ 2 - 2
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.FrameworkBenchmarks.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
@@ -15,7 +15,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="AkazawaYun.PRO" Version="1.13.25.816" />
+    <PackageReference Include="AkazawaYun.PRO" Version="1.14.25.1027" />
     <PackageReference Include="MySql.Data" Version="9.4.0" />
   </ItemGroup>
 

+ 25 - 8
frameworks/CSharp/akazawayun.pro/src/Program.cs

@@ -2,9 +2,6 @@
 
 using AkazawaYun.AOT;
 using AkazawaYun.PRO7;
-using AkazawaYun.PRO7.AkazawaYunWebFunctionAOP;
-using AkazawaYun.PRO7.AkazawaYunWebInterceptor;
-using System.Diagnostics.CodeAnalysis;
 
 namespace AkazawaYun.FrameworkBenchmarks;
 
@@ -12,23 +9,25 @@ class Program : IPostFunctionWrapper
 {
     static readonly akzWebBuilder builder;
     static readonly akzDbFactory mysql;
-
+    const int port = 8080;
 
     static Program()
     {
         akzJson.Config(null, AotJsonContext.Default);
-        builder = akzWebBuilder.Shared.SetDefault()
+        builder = akzWebBuilder.Shared.SetPort(port)
             .Build()
             .Config<IWebReceptor, akzWebInterceptor>(itc =>
             {
                 itc.ClearInterceptor();
-                itc.AddInterceptor(new akzWebInterceptorNotOnlyPost());
+                itc.AddInterceptor(new akzWebInterceptorAsPost());
             });
         mysql = new akzDbBuilderII()
-            .SetServer("tfb-database:3306")
+            .SetServer("tfb-database")
             //.SetServer("localhost:3306")
             .SetUser("benchmarkdbuser")
+            //.SetUser("root")
             .SetPwd("benchmarkdbpass")
+            //.SetPwd("123456")
             .SetDatabase("hello_world")
             .SetCharset()
             .SetOtherset()
@@ -37,7 +36,16 @@ class Program : IPostFunctionWrapper
     static async Task Main()
     {
         await builder.Launch();
-        akzLog.Default = akzLog.Output.None;
+
+        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);
     }
 
@@ -91,3 +99,12 @@ class Program : IPostFunctionWrapper
     }
 
 }
+
+public class akzWebInterceptorAsPost : WebInterceptor
+{
+    public override ValueTask<InterceptorHttpRes> Intercept(IHttpContext http)
+    {
+        http.Method = "POST";
+        return InterceptorHttpRes.No();
+    }
+}