lith 4 years ago
parent
commit
2650847b89

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/AutoPublish.bat

@@ -1,4 +1,4 @@
-echo 'publish Gateway' 
+ 
 dotnet build --configuration Release
 dotnet publish --configuration Release --output bin\CmClient 
  

+ 20 - 20
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/ProgramQps.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Collections.Generic;
 using System.Threading;
 using CLClient.Statistics;
 using Sers.Core.CL.CommunicationManage;
 using Vit.Core.Module.Log;
 using Vit.Core.Util.Pipelines;
 using Vit.Core.Util.Threading;
-using Vit.Extensions;
 
 namespace CLClient
 {
@@ -29,13 +27,9 @@ namespace CLClient
 
             while (true)
             { 
-
                 Thread.Sleep(5000);
             }
 
-
-
-
         }
 
 
@@ -85,8 +79,9 @@ namespace CLClient
 
             if (theadCount >= 0)
             {
+                ///*/
                 var conn = cm.organizeList[0].conn;
-                Action<object, Vit.Core.Util.Pipelines.ByteData> callback = null;
+                Action<object, ByteData> callback = null;
 
                 callback = (sender, data) =>
                 {
@@ -95,25 +90,30 @@ namespace CLClient
                 };
 
 
-                for (int t= theadCount;t>0 ;t-- )
+                for (int t = theadCount; t > 0; t--)
                 {
                     callback(null, new ByteData(buff));
                 }
 
+                /*/
+
+                LongTaskHelp task = new LongTaskHelp();
+                task.threadName = "PressureTest.SendRequest";
+                task.threadCount = theadCount;
+                task.action = () =>
+                {
+
+                    var conn = cm.organizeList[0].conn;
+                    for (; ; )
+                    {
+                        if (conn.SendRequest(new ByteData(buff), out _))
+                            qpsInfo.IncrementRequest();
+                    }
+                };
+                task.Start();
+                //*/
 
-                //LongTaskHelp task = new LongTaskHelp();
-                //task.threadName = "PressureTest.SendRequest";
-                //task.threadCount = theadCount;
-                //task.action = ()=> {
 
-                //    var conn = cm.organizeList[0].conn;
-                //    for (; ; )
-                //    {
-                //        if (conn.SendRequest(buff.BytesToByteData(), out _))
-                //            qpsInfo.IncrementRequest();
-                //    }
-                //};
-                //task.Start();
             }
 
 

+ 2 - 2
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/StartClient.bat

@@ -1,6 +1,6 @@
 
-cd bin\DeliveryClient 
-dotnet DeliveryClient.dll
+cd bin\CmClient
+dotnet CmClient.dll
  
 
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/StartConsole.bat

@@ -1,2 +1,2 @@
-dotnet CLClient.dll
+dotnet CmClient.dll
 pause

+ 2 - 2
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/StartServer.bat

@@ -1,6 +1,6 @@
 
-cd ..\DeliveryServer\bin\DeliveryServer 
-dotnet DeliveryServer.dll
+cd ..\CmServer\bin\CmServer 
+dotnet CmServer.dll
  
 
 

+ 3 - 3
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmClient/appsettings.json

@@ -46,7 +46,7 @@
           /* 在此Assembly中查找builder */
           "assemblyFile": "Sers.CL.Socket.Iocp.dll",
           /* the class of builder in assemblyFile  */
-           "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
+          "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
 
 
           /* (x.2) config */
@@ -136,8 +136,8 @@
 
   "PressureTest": {
     "clientCount": 1,
-    "requestThreadCount":0,
-    "messageThreadCount": 12800,
+    "requestThreadCount": 0,
+    "messageThreadCount": 1,
     "msgLen": 1
   }
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/CmServer/StartConsole.bat

@@ -1,4 +1,4 @@
-dotnet CLServer.dll
+dotnet CmServer.dll
 pause
 
 

+ 5 - 17
dotnet/Library/Sers/Sers.CL/Test/MessageDelivery/DeliveryClient/Program.cs

@@ -53,16 +53,6 @@ namespace DeliveryTest
                 qpsInfo.Start("Msg");
 
                 StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-                //StartClient();
-
 
                 while (true)
                 {
@@ -79,8 +69,8 @@ namespace DeliveryTest
         static string host = "127.0.0.1";
         static int port = 4501;
 
-        static int thread = 1000;
-        static int msgLen = 1;
+        static int thread = 1;
+        static int msgLen = 10;
 
 
 
@@ -104,12 +94,10 @@ namespace DeliveryTest
                {
                    qpsInfo.IncrementRequest();
 
-                   //data[0]++;
-
-                   //data[1] = 10;
                    Thread.Sleep(1);
-                   //SpinWait sw = new SpinWait();
-                   //sw.SpinOnce();
+
+                   //data[0]++;
+                   //data[1] = 10;                 
 
                    var byteData = new Vit.Core.Util.Pipelines.ByteData(data);
                    conn.SendFrameAsync(byteData);

+ 5 - 11
dotnet/Library/Sers/Sers.CL/Test/MessageDelivery/DeliveryServer/Program.cs

@@ -1,8 +1,6 @@
 using CLServer.Statistics;
 using System;
-using System.Collections.Generic;
 using System.Threading;
-using System.Threading.Tasks;
 using Vit.Core.Module.Log;
 
 namespace DeliveryTest
@@ -59,17 +57,13 @@ namespace DeliveryTest
 
                 conn.OnGetFrame = (conn_, data) =>
                 {
-                    //Task.Run(() =>
-                    //{
-                        qpsInfo.IncrementRequest();
+                    qpsInfo.IncrementRequest();
 
+                    //data[0]++;
+                    //data[1] = 5;
 
-                        //data[0]++;
-                        //data[1] = 5;
-                        var byteData = new Vit.Core.Util.Pipelines.ByteData(data);
-
-                        conn_.SendFrameAsync(byteData);
-                    //});
+                    var byteData = new Vit.Core.Util.Pipelines.ByteData(data);
+                    conn_.SendFrameAsync(byteData);
                 };
             };
 

+ 17 - 17
dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Pipelines/ByteData.cs

@@ -26,7 +26,7 @@ namespace Vit.Core.Util.Pipelines
     public class ByteData /*: IEnumerable<ArraySegment<byte>>*/
     {
 
-        public readonly List<ArraySegment<byte>> byteData;
+        public readonly List<ArraySegment<byte>> byteArrayList;
 
         //~ByteData()
         //{
@@ -37,34 +37,34 @@ namespace Vit.Core.Util.Pipelines
 
         public ByteData()
         {
-            byteData = new List<ArraySegment<byte>>();
-            //byteData = ObjectPool<List<ArraySegment<byte>>>.Shared.Pop();
+            byteArrayList = new List<ArraySegment<byte>>();
+            //byteArrayList = ObjectPool<List<ArraySegment<byte>>>.Shared.Pop();
         }
 
         //public ByteData(int capacity)
         //{
-        //    byteData = new List<ArraySegment<byte>>(capacity);
+        //    byteArrayList = new List<ArraySegment<byte>>(capacity);
         //}
 
         public ByteData(ArraySegment<byte> data):this()
         {
-            byteData.Add(data);
+            byteArrayList.Add(data);
         }
 
         public ByteData(byte[] bytes):this(bytes.BytesToArraySegmentByte())
         {     
         }
-        //public ByteData(List<ArraySegment<byte>> byteData)
+        //public ByteData(List<ArraySegment<byte>> byteArrayList)
         //{
-        //    this.byteData = byteData;
+        //    this.byteArrayList = byteArrayList;
         //}
 
 
         #region //implicit
         //[MethodImpl(MethodImplOptions.AggressiveInlining)]
-        //public static implicit operator ByteData(List<ArraySegment<byte>> byteData)
+        //public static implicit operator ByteData(List<ArraySegment<byte>> byteArrayList)
         //{
-        //    return new ByteData(byteData);
+        //    return new ByteData(byteArrayList);
         //}
         #endregion
 
@@ -75,13 +75,13 @@ namespace Vit.Core.Util.Pipelines
 
         #region List
 
-        
+
 
         #region Add
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public ByteData Add(ArraySegment<byte> data)
         {
-            byteData.Add(data);
+            byteArrayList.Add(data);
             return this;
         }
         #endregion 
@@ -92,14 +92,14 @@ namespace Vit.Core.Util.Pipelines
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public void AddRange(IEnumerable<ArraySegment<byte>> collection)
         {
-            byteData.AddRange(collection);
+            byteArrayList.AddRange(collection);
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public void AddRange(ByteData byteData)
         {
-            byteData.AddRange(byteData.byteData);
+            this.byteArrayList.AddRange(byteData.byteArrayList);
         }
         #endregion
 
@@ -109,7 +109,7 @@ namespace Vit.Core.Util.Pipelines
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public void Insert(int index, ArraySegment<byte> item)
         {
-            byteData.Insert(index, item);
+            byteArrayList.Insert(index, item);
         }
         #endregion
 
@@ -161,10 +161,10 @@ namespace Vit.Core.Util.Pipelines
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public int Count()
         {
-            if (byteData.Count == 0) return 0;
+            if (byteArrayList.Count == 0) return 0;
             int count = 0;
 
-            foreach (var item in byteData)
+            foreach (var item in byteArrayList)
             {
                 if (null != item)
                 {
@@ -183,7 +183,7 @@ namespace Vit.Core.Util.Pipelines
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public byte[] ToBytes()
         {
-            return byteData.ByteDataToBytes();
+            return byteArrayList.ByteDataToBytes();
         }
         #endregion