Browse Source

update sisk benchmarks

cypherpotato 6 months ago
parent
commit
429f4b3534

+ 0 - 0
frameworks/CSharp/sisk/.gitignore → frameworks/CSharp/sisk-framework/.gitignore


+ 0 - 0
frameworks/CSharp/sisk/README.md → frameworks/CSharp/sisk-framework/README.md


+ 41 - 0
frameworks/CSharp/sisk-framework/benchmark_config.json

@@ -0,0 +1,41 @@
+{
+    "framework": "sisk",
+    "tests": [
+        {
+            "default": {
+                "plaintext_url": "/plaintext",
+                "json_url": "/json",
+                "port": 8080,
+                "approach": "Realistic",
+                "classification": "Micro",
+                "database": "None",
+                "framework": "Sisk",
+                "language": "C#",
+                "orm": "Raw",
+                "platform": ".NET",
+                "webserver": "HttpListener",
+                "os": "Linux",
+                "database_os": "Linux",
+                "display_name": "Sisk Framework"
+            }
+        },
+        {
+            "cadente": {
+                "plaintext_url": "/plaintext",
+                "json_url": "/json",
+                "port": 8080,
+                "approach": "Realistic",
+                "classification": "Platform",
+                "database": "None",
+                "framework": "Sisk",
+                "language": "C#",
+                "orm": "Raw",
+                "platform": ".NET",
+                "webserver": "Cadente",
+                "os": "Linux",
+                "database_os": "Linux",
+                "display_name": "Sisk Framework (Cadente)"
+            }
+        }
+    ]
+}

+ 28 - 0
frameworks/CSharp/sisk-framework/config.toml

@@ -0,0 +1,28 @@
+[framework]
+name = "sisk"
+
+[main]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Realistic"
+classification = "Micro"
+database = "None"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = ".NET"
+webserver = "HttpListener"
+versus = "None"
+
+[cadente]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Realistic"
+classification = "Platform"
+database = "None"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = ".NET"
+webserver = "Cadente"
+versus = "None"

+ 19 - 0
frameworks/CSharp/sisk-framework/sisk-cadente.dockerfile

@@ -0,0 +1,19 @@
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+WORKDIR /source
+
+# copy csproj and restore as distinct layers
+COPY sisk-cadente/*.csproj .
+RUN dotnet restore -r linux-musl-x64
+
+# copy and publish app and libraries
+COPY sisk-cadente/ .
+RUN dotnet publish -c release -o /app -r linux-musl-x64
+
+# final stage/image
+FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+WORKDIR /app
+COPY --from=build /app .
+
+ENTRYPOINT ["dotnet", "./sisk.dll"]
+
+EXPOSE 8080

+ 36 - 0
frameworks/CSharp/sisk-framework/sisk-cadente/Program.cs

@@ -0,0 +1,36 @@
+using System.Text;
+using System.Text.Json;
+using Sisk.Cadente;
+
+var host = new HttpHost ( 8080, session => {
+    var request = session.Request;
+
+    if (request.Path == "/plaintext") {
+        SerializePlainTextResponse ( session.Response );
+    }
+    else if (request.Path == "/json") {
+        SerializeJsonResponse ( session.Response );
+    }
+    else {
+        session.Response.StatusCode = 404;
+    }
+} );
+
+host.Start ();
+Thread.Sleep ( Timeout.Infinite );
+
+static void SerializePlainTextResponse ( HttpResponse response ) {
+    var contentBytes = Encoding.UTF8.GetBytes ( "Hello, world!" );
+
+    response.Headers.Add ( new HttpHeader ( "Content-Type", "text/plain" ) );
+    response.ResponseStream = new MemoryStream ( contentBytes );
+}
+
+static void SerializeJsonResponse ( HttpResponse response ) {
+    var contentBytes = JsonSerializer.SerializeToUtf8Bytes ( new {
+        message = "Hello, world!"
+    } );
+
+    response.Headers.Add ( new HttpHeader ( "Content-Type", "application/json; charset=utf-8" ) );
+    response.ResponseStream = new MemoryStream ( contentBytes );
+}

+ 15 - 0
frameworks/CSharp/sisk-framework/sisk-cadente/sisk.csproj

@@ -0,0 +1,15 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+	<PropertyGroup>
+		<OutputType>Exe</OutputType>
+		<TargetFramework>net8.0</TargetFramework>
+		<ImplicitUsings>enable</ImplicitUsings>
+		<Nullable>enable</Nullable>
+		<ServerGarbageCollection>true</ServerGarbageCollection>
+	</PropertyGroup>
+
+	<ItemGroup>
+	  <PackageReference Include="Sisk.Cadente" Version="0.1.42-alpha1" />
+	</ItemGroup>
+
+</Project>

+ 0 - 0
frameworks/CSharp/sisk/sisk.dockerfile → frameworks/CSharp/sisk-framework/sisk.dockerfile


+ 22 - 0
frameworks/CSharp/sisk-framework/sisk/Program.cs

@@ -0,0 +1,22 @@
+using System.Net.Http.Json;
+using Sisk.Core.Http;
+using Sisk.Core.Routing;
+
+var app = HttpServer.CreateBuilder ( host => {
+    host.UseListeningPort ( "http://+:8080/" );
+} ).Build ();
+
+app.Router.SetRoute ( RouteMethod.Get, "/plaintext", PlainText );
+app.Router.SetRoute ( RouteMethod.Get, "/json", Json );
+
+app.Start ();
+
+static HttpResponse PlainText ( HttpRequest request ) {
+    return new HttpResponse ( "Hello, world!" );
+}
+
+static HttpResponse Json ( HttpRequest request ) {
+    return new HttpResponse ( JsonContent.Create ( new {
+        message = "Hello, world!"
+    } ) );
+}

+ 1 - 1
frameworks/CSharp/sisk/sisk/sisk.csproj → frameworks/CSharp/sisk-framework/sisk/sisk.csproj

@@ -9,7 +9,7 @@
 	</PropertyGroup>
 
 	<ItemGroup>
-	  <PackageReference Include="Sisk.HttpServer" Version="0.16.2" />
+	  <PackageReference Include="Sisk.HttpServer" Version="1.3.2" />
 	</ItemGroup>
 
 </Project>

+ 0 - 21
frameworks/CSharp/sisk/benchmark_config.json

@@ -1,21 +0,0 @@
-{
-  "framework": "sisk",
-  "tests": [{
-    "default": {
-      "plaintext_url": "/plaintext",
-      "json_url": "/json",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Fullstack",
-      "database": "None",
-      "framework": "Sisk",
-      "language": "C#",
-      "orm": "Raw",
-      "platform": ".NET",
-      "webserver": "Sisk",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Sisk Framework"
-    }
-  }]
-}

+ 0 - 15
frameworks/CSharp/sisk/config.toml

@@ -1,15 +0,0 @@
-[framework]
-name = "sisk"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-approach = "Realistic"
-classification = "Fullstack"
-database = "None"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = ".NET"
-webserver = "Sisk"
-versus = "None"

+ 0 - 26
frameworks/CSharp/sisk/sisk/Program.cs

@@ -1,26 +0,0 @@
-using Sisk.Core.Http;
-using Sisk.Core.Routing;
-using System.Net.Http.Json;
-
-var app = HttpServer.CreateBuilder(host =>
-{
-    host.UseListeningPort("http://+:8080/");
-});
-
-app.Router.SetRoute(RouteMethod.Get, "/plaintext", PlainText);
-app.Router.SetRoute(RouteMethod.Get, "/json", Json);
-
-app.Start();
-
-static HttpResponse PlainText(HttpRequest request)
-{
-    return new HttpResponse().WithContent("Hello, world!");
-}
-
-static HttpResponse Json(HttpRequest request)
-{
-    return new HttpResponse().WithContent(JsonContent.Create(new
-    {
-        message = "Hello, world!"
-    }));
-}