Browse Source

beetlex debug plaintext (#5056)

* docker add COMPlus_ReadyToRun variable
update beetlex

* update beetlex, enabled thread queue

* beetlex framework add db and queries cases

* add db code

* change result json data

* update query url

* beetlex framework add fortunes cases

* change Content-Type

* add beetlex core cases

* fix queries cases

* update config

* change try readline

* update benchmark config

* Update README.md

* Update README.md

* change versus property

* beetlex-core update .net core to v3.0

* change beetlex-core project file

* beetlex update raw db class

* beetlex update raw db

* beetlex debug plaintext

* change debug docker file
Henry 5 years ago
parent
commit
13e65f4866

+ 14 - 11
frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs

@@ -50,9 +50,7 @@ namespace PlatformBenchmarks
         public HttpHandler()
         {
             int threads = System.Math.Min(Environment.ProcessorCount, 16);
-            if (Environment.ProcessorCount > 20)
-                threads = Environment.ProcessorCount * 2 / 3;
-            NextQueueGroup = new NextQueueGroup(2);
+            NextQueueGroup = new NextQueueGroup(threads);
           
         }
 
@@ -146,14 +144,19 @@ namespace PlatformBenchmarks
             base.SessionReceive(server, e);
             PipeStream pipeStream = e.Session.Stream.ToPipeStream();
             HttpToken token = (HttpToken)e.Session.Tag;
-            
-            //RequestWork work = new RequestWork();
-            //work.Handler = this;
-            //work.Session = e.Session;
-            //work.Stream = pipeStream;
-            //work.Token = token;
-            //token.NextQueue.Enqueue(work);
-            OnProcess(pipeStream, token, e.Session);
+            if (Program.Debug)
+            {
+                RequestWork work = new RequestWork();
+                work.Handler = this;
+                work.Session = e.Session;
+                work.Stream = pipeStream;
+                work.Token = token;
+                token.NextQueue.Enqueue(work);
+            }
+            else
+            {
+                OnProcess(pipeStream, token, e.Session);
+            }
         }
 
 

+ 2 - 2
frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs

@@ -20,13 +20,13 @@ namespace PlatformBenchmarks
             serverOptions.LogLevel = LogType.Error;
             serverOptions.DefaultListen.Port = 8080;
             serverOptions.Statistical = false;
-            serverOptions.PrivateBufferPool = true;
             serverOptions.BufferSize = 1024 * 4;
             serverOptions.PrivateBufferPool = true;
             serverOptions.MaxConnections = 100000;
-            serverOptions.BufferPoolMaxMemory = 500;
+            serverOptions.BufferPoolMaxMemory = 1000;
             mApiServer = SocketFactory.CreateTcpServer<HttpHandler>(serverOptions);
             mApiServer.Open();
+            mApiServer.Log(LogType.Info,null, $"Debug mode [{Program.Debug}]");
             return Task.CompletedTask;
         }
 

+ 4 - 0
frameworks/CSharp/beetlex/PlatformBenchmarks/Program.cs

@@ -6,8 +6,12 @@ namespace PlatformBenchmarks
 {
     class Program
     {
+
+        public static bool Debug = false;
+
         public static void Main(string[] args)
         {
+            Debug = (args != null && args.Length > 0 && args[0] == "debug");
             new HostBuilder().ConfigureServices(delegate (HostBuilderContext hostContext, IServiceCollection services)
             {
                 services.AddHostedService<HttpServer>();

+ 10 - 0
frameworks/CSharp/beetlex/beetlex-debug.dockerfile

@@ -0,0 +1,10 @@
+FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
+WORKDIR /app
+COPY PlatformBenchmarks .
+RUN dotnet publish -c Release -o out
+
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
+ENV COMPlus_ReadyToRun 0
+WORKDIR /app
+COPY --from=build /app/out ./
+ENTRYPOINT ["dotnet", "PlatformBenchmarks.dll","debug"]

+ 19 - 0
frameworks/CSharp/beetlex/benchmark_config.json

@@ -45,6 +45,25 @@
         "display_name": "beetlex-core",
         "notes": "",
         "versus": "aspcore"
+      },
+      "debug": {
+        "plaintext_url": "/plaintext",
+        "json_url": "/json",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Platform",
+        "database": "Postgres",
+        "framework": "beetlex",
+        "language": "C#",
+        "orm": "Raw",
+        "platform": ".NET",
+        "flavor": "CoreCLR",
+        "webserver": "beetlex",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "beetlex-core",
+        "notes": "",
+        "versus": "aspcore"
       }
     }
   ]