Browse Source

Adding EasyRpc (#5605)

* adding benchmark config

* adding benchmark for easyrpc [ci lang CSharp]

* Update README.md

* Update README.md
Ian Johnson 5 years ago
parent
commit
2a3ce4c7f1

+ 10 - 0
frameworks/CSharp/easyrpc/Benchmarks/Benchmarks.csproj

@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="EasyRpc.AspNetCore.Utf8Json" Version="5.0.0-Beta1119" />
+  </ItemGroup>
+</Project>

+ 27 - 0
frameworks/CSharp/easyrpc/Benchmarks/Program.cs

@@ -0,0 +1,27 @@
+namespace Benchmarks
+{
+    using System.IO;
+    using System.Threading.Tasks;
+    using Microsoft.AspNetCore.Hosting;
+    using Microsoft.Extensions.Configuration;
+
+    public class Program
+    {
+        public static async Task Main(string[] args)
+        {
+            var config = new ConfigurationBuilder()
+                .AddEnvironmentVariables(prefix: "ASPNETCORE_")
+                .AddCommandLine(args)
+                .Build();
+
+            var webHost = new WebHostBuilder()
+                .UseContentRoot(Directory.GetCurrentDirectory())
+                .UseConfiguration(config)
+                .UseStartup<Startup>()
+                .UseKestrel()
+                .Build();
+
+            await webHost.RunAsync();
+        }
+    }
+}

+ 28 - 0
frameworks/CSharp/easyrpc/Benchmarks/Startup.cs

@@ -0,0 +1,28 @@
+using EasyRpc.AspNetCore.Serializers;
+using EasyRpc.AspNetCore.Utf8Json;
+
+namespace Benchmarks
+{
+    using EasyRpc.AspNetCore;
+    using Microsoft.AspNetCore.Builder;
+    using Microsoft.Extensions.DependencyInjection;
+
+    public class Startup
+    {
+        public void ConfigureServices(IServiceCollection services)
+        {
+            services.AddRpcServices(registerJsonSerializer: false);
+            services.AddSingleton<IContentSerializer, Utf8JsonContentSerializer>();
+        }
+
+        public void Configure(IApplicationBuilder app)
+        {
+            app.UseRpcServices(api =>
+            {
+                api.GetMethod("/plaintext", () => "Hello, World!").Raw("text/plain");
+
+                api.GetMethod("/json", () => new { message = "Hello, World!" });
+            });
+        }
+    }
+}

+ 26 - 0
frameworks/CSharp/easyrpc/README.md

@@ -0,0 +1,26 @@
+# EasyRpc Tests on Linux
+This includes tests for plaintext and json serialization.
+
+## Infrastructure Software Versions
+
+**Language**
+
+* C# 7.0
+
+**Platforms**
+
+* .NET Core (Windows and Linux)
+
+**Web Servers**
+
+* [Kestrel](https://github.com/aspnet/KestrelHttpServer)
+
+**Web Stack**
+
+* [EasyRpc](https://github.com/ipjohnson/EasyRpc)
+* ASP.NET Core
+
+## Paths & Source for Tests
+
+* [Plaintext](Benchmarks/Startup.cs): "/plaintext"
+* [JSON Serialization](Benchmarks/Startup.cs): "/json"

+ 26 - 0
frameworks/CSharp/easyrpc/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "easyrpc",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Fullstack",
+        "database": "postgres",
+        "framework": "EasyRpc",
+        "language": "CSharp",
+        "flavor": "None",
+        "orm": "Raw",
+        "platform": ".Net",
+        "webserver": "Kestrel",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "EasyRpc",
+        "notes": "",
+        "versus": "aspcore"
+      }
+    }
+  ]
+}

+ 11 - 0
frameworks/CSharp/easyrpc/easyrpc.dockerfile

@@ -0,0 +1,11 @@
+FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
+WORKDIR /app
+COPY Benchmarks .
+RUN dotnet publish -c Release -o out
+
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
+ENV ASPNETCORE_URLS http://+:8080
+WORKDIR /app
+COPY --from=build /app/out ./
+
+ENTRYPOINT ["dotnet", "Benchmarks.dll"]