Skip to content

Commit 429f4b3

Browse files
committed
update sisk benchmarks
1 parent 758f8f9 commit 429f4b3

File tree

13 files changed

+162
-63
lines changed

13 files changed

+162
-63
lines changed
File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"framework": "sisk",
3+
"tests": [
4+
{
5+
"default": {
6+
"plaintext_url": "/plaintext",
7+
"json_url": "/json",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Micro",
11+
"database": "None",
12+
"framework": "Sisk",
13+
"language": "C#",
14+
"orm": "Raw",
15+
"platform": ".NET",
16+
"webserver": "HttpListener",
17+
"os": "Linux",
18+
"database_os": "Linux",
19+
"display_name": "Sisk Framework"
20+
}
21+
},
22+
{
23+
"cadente": {
24+
"plaintext_url": "/plaintext",
25+
"json_url": "/json",
26+
"port": 8080,
27+
"approach": "Realistic",
28+
"classification": "Platform",
29+
"database": "None",
30+
"framework": "Sisk",
31+
"language": "C#",
32+
"orm": "Raw",
33+
"platform": ".NET",
34+
"webserver": "Cadente",
35+
"os": "Linux",
36+
"database_os": "Linux",
37+
"display_name": "Sisk Framework (Cadente)"
38+
}
39+
}
40+
]
41+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[framework]
2+
name = "sisk"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Micro"
9+
database = "None"
10+
database_os = "Linux"
11+
os = "Linux"
12+
orm = "Raw"
13+
platform = ".NET"
14+
webserver = "HttpListener"
15+
versus = "None"
16+
17+
[cadente]
18+
urls.plaintext = "/plaintext"
19+
urls.json = "/json"
20+
approach = "Realistic"
21+
classification = "Platform"
22+
database = "None"
23+
database_os = "Linux"
24+
os = "Linux"
25+
orm = "Raw"
26+
platform = ".NET"
27+
webserver = "Cadente"
28+
versus = "None"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
WORKDIR /source
3+
4+
# copy csproj and restore as distinct layers
5+
COPY sisk-cadente/*.csproj .
6+
RUN dotnet restore -r linux-musl-x64
7+
8+
# copy and publish app and libraries
9+
COPY sisk-cadente/ .
10+
RUN dotnet publish -c release -o /app -r linux-musl-x64
11+
12+
# final stage/image
13+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
14+
WORKDIR /app
15+
COPY --from=build /app .
16+
17+
ENTRYPOINT ["dotnet", "./sisk.dll"]
18+
19+
EXPOSE 8080
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Text;
2+
using System.Text.Json;
3+
using Sisk.Cadente;
4+
5+
var host = new HttpHost ( 8080, session => {
6+
var request = session.Request;
7+
8+
if (request.Path == "/plaintext") {
9+
SerializePlainTextResponse ( session.Response );
10+
}
11+
else if (request.Path == "/json") {
12+
SerializeJsonResponse ( session.Response );
13+
}
14+
else {
15+
session.Response.StatusCode = 404;
16+
}
17+
} );
18+
19+
host.Start ();
20+
Thread.Sleep ( Timeout.Infinite );
21+
22+
static void SerializePlainTextResponse ( HttpResponse response ) {
23+
var contentBytes = Encoding.UTF8.GetBytes ( "Hello, world!" );
24+
25+
response.Headers.Add ( new HttpHeader ( "Content-Type", "text/plain" ) );
26+
response.ResponseStream = new MemoryStream ( contentBytes );
27+
}
28+
29+
static void SerializeJsonResponse ( HttpResponse response ) {
30+
var contentBytes = JsonSerializer.SerializeToUtf8Bytes ( new {
31+
message = "Hello, world!"
32+
} );
33+
34+
response.Headers.Add ( new HttpHeader ( "Content-Type", "application/json; charset=utf-8" ) );
35+
response.ResponseStream = new MemoryStream ( contentBytes );
36+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<ServerGarbageCollection>true</ServerGarbageCollection>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Sisk.Cadente" Version="0.1.42-alpha1" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Net.Http.Json;
2+
using Sisk.Core.Http;
3+
using Sisk.Core.Routing;
4+
5+
var app = HttpServer.CreateBuilder ( host => {
6+
host.UseListeningPort ( "http://+:8080/" );
7+
} ).Build ();
8+
9+
app.Router.SetRoute ( RouteMethod.Get, "/plaintext", PlainText );
10+
app.Router.SetRoute ( RouteMethod.Get, "/json", Json );
11+
12+
app.Start ();
13+
14+
static HttpResponse PlainText ( HttpRequest request ) {
15+
return new HttpResponse ( "Hello, world!" );
16+
}
17+
18+
static HttpResponse Json ( HttpRequest request ) {
19+
return new HttpResponse ( JsonContent.Create ( new {
20+
message = "Hello, world!"
21+
} ) );
22+
}

frameworks/CSharp/sisk/sisk/sisk.csproj renamed to frameworks/CSharp/sisk-framework/sisk/sisk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Sisk.HttpServer" Version="0.16.2" />
12+
<PackageReference Include="Sisk.HttpServer" Version="1.3.2" />
1313
</ItemGroup>
1414

1515
</Project>

0 commit comments

Comments
 (0)