Browse Source

[c#/beetlex] Enabled IOQueues (#6155)

* update beetlex 1.4.3

update beetlex 1.4.3

* 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

* update beetlex to 1.4.0

* update

* beetlex update core 3.1

* [c#/beetlex] add updates cases

* [c#/beetlex] change Server: TFB, change custom connection pool, add update docker

* fix errors

* change pool init

* change connection pool maxsize

* fix fortunes errors

* clear DBRaw _connectionString value.

* [c#beetlex] change update dbconnection pool size

* [c#/beetlex] udpate spanjson to v3.0.1, Npgsql v5.0.0

* [c#/beetlex] add caching sample

* set connectionstring multiplexing

* remove connection multiplexing setting

* [c#/beetlex]change NpgsqlParameter to  NpgsqlParameter<T>

* [c#/beetlex] update dbraw

* [c#/beetlex] change connection string

* [c#/beetlex]  add fortunes cases to core-updb

* update beetlex 1.5.6

* update 5.0.0-alpha1

* update docker file

* Enabled IOQueues

* Set IOQueues debug mode

* update
Henry 4 years ago
parent
commit
2bb1bb6a5b

+ 1 - 38
frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs

@@ -71,7 +71,6 @@ namespace PlatformBenchmarks
             e.Session.Socket.NoDelay = true;
             var token = new HttpToken();
             token.Db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance);
-            token.NextQueue = NextQueueGroup.Next();
             e.Session.Tag = token;
         }
 
@@ -85,29 +84,6 @@ namespace PlatformBenchmarks
             return -1;
 
         }
-
-        class RequestWork : IEventWork
-        {
-            public void Dispose()
-            {
-
-            }
-
-            public PipeStream Stream { get; set; }
-
-            public ISession Session { get; set; }
-
-            public HttpToken Token { get; set; }
-
-            public HttpHandler Handler { get; set; }
-
-            public Task Execute()
-            {
-                Handler.OnProcess(Stream, Token, Session);
-                return Task.CompletedTask;
-            }
-        }
-
         private void OnProcess(PipeStream pipeStream, HttpToken token, ISession sessino)
         {
             var line = _line.AsSpan();
@@ -148,23 +124,10 @@ namespace PlatformBenchmarks
 
         public override void SessionReceive(IServer server, SessionReceiveEventArgs e)
         {
-
             base.SessionReceive(server, e);
             PipeStream pipeStream = e.Session.Stream.ToPipeStream();
             HttpToken token = (HttpToken)e.Session.Tag;
-            if (Program.Debug || Program.UpDB)
-            {
-                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);
-            }
+            OnProcess(pipeStream, token, e.Session);
         }
 
 

+ 11 - 5
frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs

@@ -22,19 +22,25 @@ namespace PlatformBenchmarks
             serverOptions.Statistical = false;
             serverOptions.BufferSize = 1024 * 8;
             serverOptions.BufferPoolMaxMemory = 1000;
-            serverOptions.BufferPoolSize = 1024 * 8;
+            serverOptions.BufferPoolSize = 1024 * 10;
+            if (Program.Debug)
+            {
+                serverOptions.IOQueueEnabled = true;
+                serverOptions.IOQueues = System.Math.Min(Environment.ProcessorCount, 16);
+                serverOptions.SyncAccept = false;
+            }
             ApiServer = SocketFactory.CreateTcpServer<HttpHandler>(serverOptions);
             ApiServer.Open();
             if (!Program.UpDB)
             {
-               RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000";
+                RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000";
                 //RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3";
             }
             else
             {
-               // RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3";
-               RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000";
-            }           
+                // RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3";
+                RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000";
+            }
             ApiServer.Log(LogType.Info, null, $"Debug mode [{Program.Debug}]");
             return Task.CompletedTask;