lith 4 jaren geleden
bovenliggende
commit
fe5d0bb9b6
27 gewijzigde bestanden met toevoegingen van 605 en 671 verwijderingen
  1. 12 5
      dotnet/Doc/PublishFile/Sers单体压测/ServiceCenter/appsettings.json
  2. 6 2
      dotnet/Gateway/App.Gateway/appsettings.json
  3. 1 1
      dotnet/Gateway/Sers.Gateway/Sers.Gateway/GatewayHelp.cs
  4. 2 2
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/BeforeCallApi/AccountInCookie/AccountInCookie.cs
  5. 4 4
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/BeforeCallApi/Bearer/Bearer.cs
  6. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/LocalApi/StaticFileTransmit/StaticFileMap.cs
  7. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Message/Extensions/ApiMessageExtensions.cs
  8. 35 14
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContextData.cs
  9. 3 3
      dotnet/Library/Sers/Sers.Core/Sers.Core/Util/Consumer/ConsumerFactory.cs
  10. 9 5
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Module.Serialization.Qps/Program.cs
  11. 1 58
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Module.Serialization.Qps/RpcContextData.cs
  12. 4 11
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Module/SerializationTest.cs
  13. 2 2
      dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/byte/BytesExtensions.cs
  14. 1 1
      dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/byte/SpanExtensions.cs
  15. 12 7
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Extensions/ObjectSerializeExtensions.cs
  16. 54 0
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/ISerialization.cs
  17. 3 323
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization.cs
  18. 53 38
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_MessagePack.cs
  19. 319 65
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Newtonsoft.cs
  20. 30 108
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.cs
  21. 0 3
      dotnet/Library/Vit/Vit.WebHost/appsettings.json
  22. 8 4
      dotnet/ServiceCenter/App.Gover.Gateway/appsettings.json
  23. 10 4
      dotnet/ServiceCenter/App.ServiceCenter/appsettings.json
  24. 1 1
      dotnet/ServiceStation/ApiLoader/Sers.Serslot/ExceptionFilter/ExceptionFilter.cs
  25. 11 6
      dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/appsettings.json
  26. 6 2
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/appsettings.json
  27. 16 0
      readme.md

+ 12 - 5
dotnet/Doc/PublishFile/Sers单体压测/ServiceCenter/appsettings.json

@@ -10,7 +10,7 @@
         "requestTimeoutMs": 60000,
 
         /* 后台处理消息的线程个数(单位个,默认2) */
-        "workThreadCount":1,
+        "workThreadCount": 1,
 
         //HeartBeat  
         /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
@@ -37,10 +37,17 @@
           //"host": "127.0.0.1",
           /* 服务端 监听端口号。例如: 4501 */
           "port": 4501
-        }        
+        }
       ]
     },
 
+
+
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
+
     /* LocalApiService 配置,可不指定 */
     "LocalApiService": {
 
@@ -53,7 +60,7 @@
 
       /* 是否 输出本地Api的调用信息到(ApiTrace)Log文件。默认:false */
       "PrintTrace": false,
-     
+
 
 
       /* 默认站点名称,可多个,可不指定 */
@@ -292,8 +299,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
 
     /* 序列化配置,可不指定 */

+ 6 - 2
dotnet/Gateway/App.Gateway/appsettings.json

@@ -31,6 +31,10 @@
     },
 
 
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
     /* ServiceStation配置,可不指定 */
     "ServiceStation": {
 
@@ -162,8 +166,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
 
     /* 序列化配置,可不指定 */

+ 1 - 1
dotnet/Gateway/Sers.Gateway/Sers.Gateway/GatewayHelp.cs

@@ -237,7 +237,7 @@ namespace Sers.Gateway
             return apiRequestMsg;
         }
 
-        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization.Instance.charset);
+        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance.charset);
 
         static readonly string ResponseDefaultContentType = ConfigurationManager.Instance.GetStringByPath("Sers.Gateway.WebHost.ResponseDefaultContentType") ?? Response_ContentType_Json;
         async Task WriteApiReplyMessage(HttpResponse response,ApiMessage apiReply)

+ 2 - 2
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/BeforeCallApi/AccountInCookie/AccountInCookie.cs

@@ -18,7 +18,7 @@ namespace Sers.Core.Module.Api.ApiEvent.BeforeCallApi.AccountInCookie
         {
             public string userToken;
             public string CallerSource;
-            public JObject userInfo;
+            public object userInfo;
         }
 
         SortedDictionary<string, Account> userMap = new SortedDictionary<string, Account>();
@@ -94,7 +94,7 @@ namespace Sers.Core.Module.Api.ApiEvent.BeforeCallApi.AccountInCookie
                     }
                     if (account.userInfo != null)
                     {
-                        rpcData.user=new { account.userInfo };
+                        rpcData.user = new { userInfo = account.userInfo };
                     }
                     requestMessage.rpcContextData_OriData = ArraySegmentByteExtensions.Null;
                 }

+ 4 - 4
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/BeforeCallApi/Bearer/Bearer.cs

@@ -25,10 +25,10 @@ namespace Sers.Core.Module.Api.ApiEvent.BeforeCallApi.Bearer
         string Api_verifyAt;
         string Api_httpMethod;
 
-        ApiReturn<JObject> VerifyAt(string at)
+        ApiReturn<Object> VerifyAt(string at)
         {
             //var arg = "{\"at\":\"" + at + "\"}";
-            return ApiClient.CallRemoteApi<ApiReturn<JObject>>(Api_verifyAt, new { at }, Api_httpMethod);
+            return ApiClient.CallRemoteApi<ApiReturn<Object>>(Api_verifyAt, new { at }, Api_httpMethod);
         }
 
 
@@ -50,7 +50,7 @@ namespace Sers.Core.Module.Api.ApiEvent.BeforeCallApi.Bearer
 
                 if (null != rpcData.user) return;
 
-                ApiReturn<JObject> ret;
+                ApiReturn<Object> ret;
                 using (var rpcContext = new RpcContext())
                 {
                     //RpcContext.Current.rpcData=rpcData;
@@ -60,7 +60,7 @@ namespace Sers.Core.Module.Api.ApiEvent.BeforeCallApi.Bearer
 
                 if (null != ret && ret.success)
                 {
-                    rpcData.user=new { userInfo = ret.data };
+                    rpcData.user = new { userInfo = ret.data };
                     requestMessage.rpcContextData_OriData = ArraySegmentByteExtensions.Null;
                 }
                 #endregion

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/LocalApi/StaticFileTransmit/StaticFileMap.cs

@@ -213,7 +213,7 @@ namespace Sers.Core.Module.Api.LocalApi.StaticFileTransmit
             }
 
             #region 填充文件头
-            headers["Content-Disposition"] = "attachment;filename=" + HttpUtility.UrlEncode(fileName, Vit.Core.Module.Serialization.Serialization.Instance.encoding);
+            headers["Content-Disposition"] = "attachment;filename=" + HttpUtility.UrlEncode(fileName, Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance.encoding);
             headers["Content-Length"] = info.Length.ToString();
             #endregion
 

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Message/Extensions/ApiMessageExtensions.cs

@@ -12,7 +12,7 @@ namespace Vit.Extensions
     {
         #region Init
 
-        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization.Instance.charset);
+        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance.charset);
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static ApiMessage InitAsApiReplyMessageByError(this ApiMessage data, SsError error)

+ 35 - 14
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContextData.cs

@@ -1,35 +1,53 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.CompilerServices;
+using Vit.Core.Module.Serialization;
+using Vit.Core.Util.ComponentModel.SsError;
+using Vit.Core.Util.ConfigurationManager;
+using Vit.Extensions;
 
 namespace Sers.Core.Module.Rpc
 {
     public class RpcContextData
-    { 
+    {
+
+        #region Serialization
+        public static ISerialization Serialization;
+
+        static RpcContextData()
+        {
+            string rpcDataSerializeMode = ConfigurationManager.Instance.GetByPath<string>("Sers.RpcDataSerializeMode")
+                ?? "MessagePack";
+
+            switch (rpcDataSerializeMode) 
+            {
+                case "Newtonsoft": Serialization = Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance; break;
+                case "MessagePack": Serialization = Vit.Core.Module.Serialization.Serialization_MessagePack.Instance; break;
+                case "Text": Serialization = Vit.Core.Module.Serialization.Serialization_Text.Instance; break;
+                default: Serialization = Vit.Core.Module.Serialization.Serialization_Text.Instance; break;
+            }
+        }
+
+        #endregion
+
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public string Serialize()
-        {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.SerializeToString(this);
-            //return Vit.Core.Module.Serialization.Serialization_Text.Instance.SerializeToString(this);        
-            return Vit.Core.Module.Serialization.Serialization_MessagePack.Instance.SerializeToString(this);
+        {     
+            return Serialization.SerializeToString(this);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public byte[] ToBytes() 
         {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.SerializeToBytes(this);
-            //return Vit.Core.Module.Serialization.Serialization_Text.Instance.SerializeToBytes(this);
-            return Vit.Core.Module.Serialization.Serialization_MessagePack.Instance.SerializeToBytes(this);
+            return Serialization.SerializeToBytes(this);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static RpcContextData FromBytes(ReadOnlySpan<byte>data)
+        public static RpcContextData FromBytes(ArraySegment<byte>data)
         {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.DeserializeFromSpan<RpcContextData>(data);
-            //return Vit.Core.Module.Serialization.Serialization_Text.Instance.DeserializeFromSpan<RpcContextData>(data);
-            return Vit.Core.Module.Serialization.Serialization_MessagePack.Instance.DeserializeFromSpan<RpcContextData>(data);
+            return Serialization.DeserializeFromArraySegmentByte<RpcContextData>(data);
         }
 
 
@@ -107,9 +125,12 @@ namespace Sers.Core.Module.Rpc
 
         public object error;
 
-        public object user;
+        //public object user { get; set; }
+
+        object user_;
+        public object user { get => user_?.Serialize(); set => user_ = value; }
+
 
- 
 
     }
 }

+ 3 - 3
dotnet/Library/Sers/Sers.Core/Sers.Core/Util/Consumer/ConsumerFactory.cs

@@ -6,16 +6,16 @@ namespace Sers.Core.Util.Consumer
     {
 
         /// <summary>
-        /// 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock 
+        /// 队列模式。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock 
         /// </summary>
-        public static string consumerType = ConfigurationManager.Instance.GetByPath<string>("Vit.ConsumerType");
+        public static string ConsumerMode = ConfigurationManager.Instance.GetByPath<string>("Vit.ConsumerMode");
 
         public static IConsumer<T> CreateConsumer<T>() 
         {
 
             //return new ConsumerCache<T, Consumer_BlockingCollection<T>>();
             IConsumer<T> consumer;
-            switch (consumerType)
+            switch (ConsumerMode)
             {
                 case "ActionBlock":
                     consumer = new Consumer_ActionBlock<T>();  // 16 16 700万     24 24 900-1000万

+ 9 - 5
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Module.Serialization.Qps/Program.cs

@@ -47,14 +47,16 @@ namespace App
             QpsData qpsInfo = new QpsData(statisticsQps);
             Task.Run(() =>
             {
-                // 4线程 71万
-                // var Instance = Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance;
+                // 4线程 72万(cpu 50%)
+                // 8线程 79万(cpu 86%)
+                //var Instance = Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance;
 
 
-                // 4线程 87万
-                //var Instance = Vit.Core.Module.Serialization.Serialization_Text.Instance;
+                // 4线程 87万(cpu 52%)
+                // 8线程 103万(cpu 95%)
+                // var Instance = Vit.Core.Module.Serialization.Serialization_Text.Instance;
 
-                // 4线程 200万
+                // 4线程 200万(cpu 50%)
                 var Instance = Vit.Core.Module.Serialization.Serialization_MessagePack.Instance;
 
                 while (true)
@@ -69,6 +71,8 @@ namespace App
 
                             var bytes = Instance.SerializeToBytes(data);
 
+                            //var ss = bytes.BytesToString();
+
                             var data2 = Instance.DeserializeFromBytes<RpcContextData>(bytes);
                         }
 

+ 1 - 58
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Module.Serialization.Qps/RpcContextData.cs

@@ -5,64 +5,7 @@ using System.Runtime.CompilerServices;
 namespace Sers.Core.Module.Rpc
 {
     public class RpcContextData
-    {
-       
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public string Serialize()
-        {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.SerializeToString(this);
-            return Vit.Core.Module.Serialization.Serialization_Text.Instance.SerializeToString(this);        
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public byte[] ToBytes() 
-        {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.SerializeToBytes(this);
-            return Vit.Core.Module.Serialization.Serialization_Text.Instance.SerializeToBytes(this);
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static RpcContextData FromBytes(ReadOnlySpan<byte>data)
-        {
-            //return Vit.Core.Module.Serialization.Serialization.Instance.DeserializeFromSpan<RpcContextData>(data);
-            return Vit.Core.Module.Serialization.Serialization_Text.Instance.DeserializeFromSpan<RpcContextData>(data);
-        }
-
-
-        /*
-        {
-        "route": "/DemoStation/v1/api/5/rpc/2",
-        "caller": {
-            "rid": "8320becee0d945e9ab93de6fdac7627a",
-            "callStack": ["xxxx","xxxxxx"],    // parentRequestGuid array
-            "source": "Outside"
-        },
-        "http": {
-            "url": "https://127.0.0.1:6000/DemoStation/v1/api/5/rpc/2?a=1",
-            "method":"GET",
-            "statusCode":400,
-            "protocol":"HTTP/2.0",
-            "headers": {
-                "Cache-Control": "no-cache",
-                "Connection": "keep-alive",
-                "Content-Type": "application/javascript",
-                "Accept": "* / *",
-                "Accept-Encoding": "gzip, deflate",
-                "Authorization": "bearer",
-                "Host": "127.0.0.1:6000",
-                "User-Agent": "PostmanRuntime/7.6.0",
-                "Postman-Token": "78c5a1cb-764f-4e04-b2ae-514924a40d5a"
-            }
-        },
-	    "error":{SsError},
-        "user": {"userInfo":{} }
-    }             
-         
-         */
-
-
-
+    { 
 
 
         public string route;

+ 4 - 11
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Module/SerializationTest.cs

@@ -24,8 +24,7 @@ namespace Vit.Core.MsTest.Module
 
             var modelA = new ModelA { id=1,name = testString, time=DateTime.Now };
 
-            #region (x.1)bytes <--> String
-            Assert.AreEqual(Serialization.Instance.BytesToString(Serialization.Instance.StringToBytes(testString)), testString);
+            #region (x.1)bytes <--> String      
             Assert.AreEqual(testString.StringToBytes().BytesToString(), testString);
             #endregion
 
@@ -40,17 +39,11 @@ namespace Vit.Core.MsTest.Module
             Assert.AreEqual(Serialization.Instance.DeserializeFromBytes<ModelA>(Serialization.Instance.SerializeToBytes(modelA))?.name, testString);
             Assert.AreEqual(modelA.SerializeToBytes().DeserializeFromBytes<ModelA>()?.name, testString);
             #endregion
-
-
-            #region (x.4)object <--> ArraySegmentByte
-            Assert.AreEqual(Serialization.Instance.DeserializeFromArraySegmentByte<ModelA>(Serialization.Instance.SerializeToArraySegmentByte(modelA))?.name, testString);
-            Assert.AreEqual(modelA.SerializeToArraySegmentByte().DeserializeFromArraySegmentByte<ModelA>()?.name, testString);
-            #endregion
+ 
 
             #region (x.5)ConvertBySerialize
             var obj_ori = new { id = 1, name = testString, time = DateTime.Now };
-
-            Assert.AreEqual(Serialization.Instance.ConvertBySerialize<ModelA>(obj_ori)?.name, testString);
+ 
             Assert.AreEqual(obj_ori.ConvertBySerialize<ModelA>()?.name, testString);
             #endregion
 
@@ -64,7 +57,7 @@ namespace Vit.Core.MsTest.Module
 
             string str = obj.Serialize();
 
-            Serialization_Newtonsoft.Instance.SetDateTimeFormat("yyyy-MM-dd");
+            Serialization_Newtonsoft.Instance.serializeSetting.DateFormatString="yyyy-MM-dd";
 
             string str2 = obj.Serialize();
             var jtObj = str2.Deserialize<JObject>();

+ 2 - 2
dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/byte/BytesExtensions.cs

@@ -14,14 +14,14 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static string BytesToString(this byte[] data, Encoding encoding = null)
         {             
-            return Serialization.Instance.BytesToString(data, encoding); 
+            return Serialization_Newtonsoft.Instance.BytesToString(data, encoding); 
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static byte[] StringToBytes(this string data, Encoding encoding = null)
         {
-            return Serialization.Instance.StringToBytes(data, encoding);
+            return Serialization_Newtonsoft.Instance.StringToBytes(data, encoding);
         }
         #endregion
 

+ 1 - 1
dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/byte/SpanExtensions.cs

@@ -15,7 +15,7 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static string SpanToString(this ReadOnlySpan<byte> data, Encoding encoding = null)
         {
-            return Serialization.Instance.SpanToString(data, encoding);
+            return Serialization_Newtonsoft.Instance.SpanToString(data, encoding);
         }
 
         #endregion

+ 12 - 7
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Extensions/ObjectSerializeExtensions.cs

@@ -111,7 +111,7 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static ArraySegment<byte> SerializeToArraySegmentByte(this object value)
         {
-            return Serialization.Instance.SerializeToArraySegmentByte(value);
+            return Serialization.Instance.SerializeToBytes(value).BytesToArraySegmentByte();
         }
         #endregion
 
@@ -126,7 +126,7 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static T DeserializeFromArraySegmentByte<T>(this ArraySegment<byte> value)
         {
-            return Serialization.Instance.DeserializeFromArraySegmentByte<T>(value);
+            return Serialization_Newtonsoft.Instance.DeserializeFromArraySegmentByte<T>(value);
         }
 
         /// <summary>
@@ -138,11 +138,14 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static object DeserializeFromArraySegmentByte(this ArraySegment<byte> value, Type type)
         {
-            return Serialization.Instance.DeserializeFromArraySegmentByte(value, type);
+            return Serialization_Newtonsoft.Instance.DeserializeFromArraySegmentByte(value, type);
         }
         #endregion
         #endregion
 
+               
+
+
 
 
         #region (x.4)ConvertBySerialize
@@ -157,19 +160,21 @@ namespace Vit.Extensions
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static object ConvertBySerialize(this object value, Type type)
         {
-            return Serialization.Instance.ConvertBySerialize(value, type);
+            var str = Serialization.Instance.SerializeToString(value);
+            return Serialization.Instance.DeserializeFromString(str, type); 
         }
 
         /// <summary>
         /// 通过序列化克隆对象
         /// </summary>
-        /// <typeparam name="T"></typeparam>
+        /// <typeparam name="TTarget"></typeparam>
         /// <param name="value"></param>
         /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static T ConvertBySerialize<T>(this object value)
+        public static TTarget ConvertBySerialize<TTarget>(this object value)
         {
-            return Serialization.Instance.ConvertBySerialize<T>(value);
+            var str = Serialization.Instance.SerializeToString(value);
+            return Serialization.Instance.DeserializeFromString<TTarget>(str);
         }
         #endregion
 

+ 54 - 0
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/ISerialization.cs

@@ -0,0 +1,54 @@
+using System;
+
+namespace Vit.Core.Module.Serialization
+{
+    public interface ISerialization
+    {
+
+        #region (x.1)object <--> String
+
+        string SerializeToString<T>(T value);
+        string SerializeToString(object value, Type type);
+
+
+
+        T DeserializeFromString<T>(string value);
+        object DeserializeFromString(string value, Type type);
+
+        #endregion
+
+
+
+        #region (x.2)object <--> bytes
+
+        byte[] SerializeToBytes<T>(T obj);
+        byte[] SerializeToBytes(object value, Type type);
+
+
+        T DeserializeFromBytes<T>(byte[] bytes);
+        object DeserializeFromBytes(byte[] bytes, Type type);
+
+        #endregion
+
+
+
+        #region (x.3)DeserializeFromSpan
+
+        //T DeserializeFromSpan<T>(ReadOnlyMemory<byte> bytes);
+
+        //object DeserializeFromSpan(ReadOnlyMemory<byte> bytes, Type type);
+
+        #endregion
+
+
+
+        #region (x.4)DeserializeFromArraySegmentByte
+
+        T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes);
+
+        object DeserializeFromArraySegmentByte(ArraySegment<byte> bytes, Type type);
+
+        #endregion
+
+    }
+}

+ 3 - 323
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization.cs

@@ -1,8 +1,4 @@
-using Vit.Extensions;
-using System;
-using System.Text;
-using System.Runtime.CompilerServices;
-using Vit.Core.Util.ConfigurationManager;
+ 
 
 
 namespace Vit.Core.Module.Serialization
@@ -10,336 +6,20 @@ namespace Vit.Core.Module.Serialization
     public  abstract class Serialization
     {
 
-        #region defaultEncoding
-        public static Encoding defaultEncoding { get; set; } =
-            ConfigurationManager.Instance.GetByPath<string>("Vit.Serialization.Encoding")?.StringToEnum<EEncoding>().ToEncoding() ?? Encoding.UTF8;
-
-        #endregion
-
-
-
-        public static Serialization Instance { get; set; } = Serialization_Newtonsoft.Instance;
+        public static ISerialization Instance { get; set; } = Serialization_Newtonsoft.Instance;
 
         //public static readonly Serialization_Newtonsoft Newtonsoft = Serialization_Newtonsoft.Instance;
         //public static readonly Serialization_Text Text = Serialization_Text.Instance;
+        //public static readonly Serialization_MessagePack MessagePack = Serialization_MessagePack.Instance;
 
 
- 
-
-
-
-        #region 成员对象 
-
-
-        public virtual Encoding encoding { get; set; } = defaultEncoding;
-        public virtual string charset { get => encoding.GetCharset();  }
- 
-        #endregion
-
-
-
-        #region SpanToString
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public string SpanToString(ReadOnlySpan<byte> data, Encoding encoding = null)
-        {
-            if (data.Length == 0) return default;
-            unsafe
-            {
-                fixed (byte* bytes = data)
-                {
-                    return (encoding ?? this.encoding).GetString(bytes, data.Length);
-                }
-            }
-        }
-
-        #endregion
-
-
-        #region (x.1)bytes <--> String
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual string BytesToString(byte[] data, Encoding encoding = null)
-        {
-            return (encoding ?? this.encoding).GetString(data);
-        }
-
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual byte[] StringToBytes(string data, Encoding encoding = null)
-        {
-            return (encoding ?? this.encoding).GetBytes(data);
-        }
-        #endregion
-
-       
-
-
-        #region (x.2)object <--> String
-
-        #region SerializeToString
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public abstract string SerializeToString<T>(T value);
-
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public abstract string SerializeToString(object value, Type type);        
-
-        #endregion
-
-
-
-
-        #region DeserializeFromString
-
-        /// <summary>
-        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
-        /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public abstract object DeserializeFromString(string value, Type type);
-         
-
-
-        /// <summary>
-        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual T DeserializeFromString<T>(string value)
-        {
-            return (T)DeserializeFromString(value, typeof(T));
-        }
-
-
-           
-        #endregion
-
-        #endregion
-
-
-
-        #region (x.3)object <--> bytes
-
-        #region SerializeToBytes
-
-        /// <summary>
-        /// obj 可以为   byte[]、string、 object       
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual byte[] SerializeToBytes<T>(T obj)
-        {
-            if (null == obj) return new byte[0];
-
-            string strValue;
-            switch (obj) 
-            {                
-                case byte[] bytes:
-                    return bytes;
-                case ArraySegment<byte> asbs:
-                    return asbs.ArraySegmentByteToBytes();
-                case string str:
-                    strValue = str; break;
-                default: strValue = SerializeToString(obj);break;
-            }    
-      
-            return StringToBytes(strValue);
-        }
-
-
-
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual byte[] SerializeToBytes(object value, Type type) 
-        {
-            return SerializeToBytes(value);
-        }
-        #endregion
-
-
-        #region DeserializeFromBytes
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual T DeserializeFromBytes<T>(byte[] bytes)
-        {
-            return (T)DeserializeFromBytes(bytes, typeof(T));
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual object DeserializeFromBytes(byte[] bytes, Type type)
-        {      
-            if (type == typeof(byte[]))
-            {
-                return bytes;
-            }
-            if (type == typeof(ArraySegment<byte>))
-            {
-                return bytes.BytesToArraySegmentByte();
-            }
-            string strValue = BytesToString(bytes);
-            if (type == typeof(string))
-            {
-                return strValue;
-            }
-            return DeserializeFromString(strValue,type);
-        }
-        #endregion
-
-
-        #region DeserializeFromBytes
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual T DeserializeFromSpan<T>(ReadOnlySpan<byte> bytes)
-        {
-            return (T)DeserializeFromSpan(bytes, typeof(T));
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual object DeserializeFromSpan(ReadOnlySpan<byte> bytes, Type type)
-        {
-            if (bytes.Length == 0) return default;
-
-            string strValue = SpanToString(bytes);
-            if (type == typeof(string))
-            {
-                return strValue;
-            }
-            return DeserializeFromString(strValue, type);
-        }
-        #endregion
-
-        #endregion
-
-
-        #region (x.4)object <--> ArraySegmentByte
-
-        #region SerializeToArraySegmentByte
-        /// <summary>
-        /// obj 可以为   byte[]、string、 object       
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual ArraySegment<byte> SerializeToArraySegmentByte<T>(T obj)
-        {
-            if (null == obj) return ArraySegmentByteExtensions.Null;
-
-            if (obj is ArraySegment<byte> asbs)
-            {
-                return asbs;
-            }
-            
-            return SerializeToBytes(obj).BytesToArraySegmentByte();
-        }
-        #endregion
-
-        #region DeserializeFromArraySegmentByte
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
-        {
-            if (bytes.Count == 0) return default;
-            return (T)DeserializeFromArraySegmentByte(bytes, typeof(T));
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual object DeserializeFromArraySegmentByte(ArraySegment<byte> bytes, Type type)
-        {
-            if (bytes.Count == 0) return default;
-
-            if (type == typeof(byte[]))
-            {
-                return bytes.ArraySegmentByteToBytes();
-            }
-            if (type == typeof(ArraySegment<byte>))
-            {
-                return bytes;
-            }
-            string strValue = bytes.ArraySegmentByteToString();
-            if (type == typeof(string))
-            {
-                return strValue;
-            }
-            return DeserializeFromString(strValue,type);
-        }
-        #endregion
-
-        #endregion
-
-
-        #region (x.5)ConvertBySerialize
-
-        /// <summary>
-        /// 通过序列化克隆对象
-        /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual object ConvertBySerialize(Object value, Type type)
-        {
-            var str = SerializeToString(value);
-            return DeserializeFromString(str,type);
-        }
-
-        /// <summary>
-        /// 通过序列化克隆对象
-        /// </summary> 
-        /// <typeparam name="TTarget"></typeparam>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public virtual TTarget ConvertBySerialize<TTarget>(Object value)
-        {
-            var str = SerializeToString(value);
-            return DeserializeFromString<TTarget>(str);
-        }
-        #endregion
-
 
 
-        #region DeserializeStruct
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type">必须为 where T : struct</param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public  object DeserializeStruct(string value, Type type)
-        {
-            try
-            {
-                if (type.IsStringType())
-                    return value;
-                return value.Convert(type);
-            }
-            catch { }
-            return type.DefaultValue();
-        }
 
-        ///// <summary>
-        ///// 
-        ///// </summary>
-        ///// <typeparam name="T">必须为 where T : struct</typeparam>
-        ///// <param name="value"></param>
-        ///// <returns></returns>
-        //public object DeserializeStruct<T>(string value)
-        //{
-        //    return DeserializeStruct(value, typeof(T));
-        //}
 
 
 
-        #endregion
 
     }
 }

+ 53 - 38
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_MessagePack.cs

@@ -7,52 +7,45 @@ namespace Vit.Core.Module.Serialization
     /// <summary>
     /// 参考 https://github.com/neuecc/MessagePack-CSharp
     /// </summary>
-    public class Serialization_MessagePack : Serialization
+    public class Serialization_MessagePack : ISerialization
     {
 
-        public new static readonly Serialization_MessagePack Instance = new Serialization_MessagePack();
+        public static readonly Serialization_MessagePack Instance = new Serialization_MessagePack();
 
 
 
-        #region (x.2)object <--> String
+        #region (x.1)object <--> String
 
         #region SerializeToString
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString<T>(T value)
+        public string SerializeToString<T>(T value)
         {
-            //var bin = MessagePackSerializer.Serialize(
-            // value,
-            // MessagePack.Resolvers.ContractlessStandardResolver.Options);
-
             return MessagePackSerializer.ConvertToJson(SerializeToBytes(value));
         }
 
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString(object value,Type type)
-        {     
-            return MessagePackSerializer.SerializeToJson(value);
+        public string SerializeToString(object value,Type type)
+        {
+            return MessagePackSerializer.ConvertToJson(SerializeToBytes(value));
         }
 
         #endregion
 
         #region DeserializeFromString
 
-   
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public T DeserializeFromString<T>(string value)
+        {
+            throw new NotImplementedException(); 
+        }
 
-        /// <summary>
-        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
-        /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type"></param>
-        /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromString(string value, Type type)
+        public object DeserializeFromString(string value, Type type)
         {
             throw new NotImplementedException();
-            //return MessagePackSerializer.Deserialize(type, value);
         }
 
         #endregion
@@ -61,17 +54,13 @@ namespace Vit.Core.Module.Serialization
 
 
 
-        #region (x.3)object <--> bytes
+        #region (x.2)object <--> bytes
 
         #region SerializeToBytes
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
+ 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override byte[] SerializeToBytes<T>(T value)
+        public byte[] SerializeToBytes<T>(T value)
         {
             return MessagePackSerializer.Serialize<T>(value,
              MessagePack.Resolvers.ContractlessStandardResolver.Options);          
@@ -80,7 +69,7 @@ namespace Vit.Core.Module.Serialization
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override byte[] SerializeToBytes(object value,Type type)
+        public byte[] SerializeToBytes(object value,Type type)
         {
             return MessagePackSerializer.Serialize(type,value,
              MessagePack.Resolvers.ContractlessStandardResolver.Options);
@@ -91,17 +80,15 @@ namespace Vit.Core.Module.Serialization
         #region DeserializeFromBytes
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override T DeserializeFromBytes<T>(byte[] bytes)
-        {   
-            return MessagePackSerializer.Deserialize<T>(bytes,
-             MessagePack.Resolvers.ContractlessStandardResolver.Options);
+        public T DeserializeFromBytes<T>(byte[] bytes)
+        {
+            return DeserializeFromSpan<T>(bytes);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromBytes(byte[] bytes, Type type)
-        {
-            return MessagePackSerializer.Deserialize(type,bytes,
-             MessagePack.Resolvers.ContractlessStandardResolver.Options);
+        public object DeserializeFromBytes(byte[] bytes, Type type)
+        {        
+            return DeserializeFromSpan(bytes, type);
         }
         #endregion
 
@@ -110,10 +97,38 @@ namespace Vit.Core.Module.Serialization
 
 
 
- 
+        #region (x.3)DeserializeFromSpan
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public T DeserializeFromSpan<T>(ReadOnlyMemory<byte> bytes)
+        {        
+            return MessagePackSerializer.Deserialize<T>(bytes,
+             MessagePack.Resolvers.ContractlessStandardResolver.Options);
+        }
 
- 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromSpan(ReadOnlyMemory<byte> bytes, Type type)
+        {    
+            return MessagePackSerializer.Deserialize(type, bytes,
+             MessagePack.Resolvers.ContractlessStandardResolver.Options);
+        }
+        #endregion
+
+
+        #region (x.4)DeserializeFromArraySegmentByte
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
+        {
+            return DeserializeFromSpan<T>(bytes);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromArraySegmentByte(ArraySegment<byte> bytes, Type type)
+        {
+            return DeserializeFromSpan(bytes, type);
+        }
+        #endregion
 
     }
 }

+ 319 - 65
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Newtonsoft.cs

@@ -3,17 +3,120 @@ using Vit.Extensions;
 using System;
 using Vit.Core.Util.ConfigurationManager;
 using System.Runtime.CompilerServices;
+using System.Text;
 
 namespace Vit.Core.Module.Serialization
 {
-    public class Serialization_Newtonsoft: Serialization
+    public class Serialization_Newtonsoft: ISerialization
     {
+        #region defaultEncoding
+        public static Encoding defaultEncoding { get; set; } =
+            ConfigurationManager.Instance.GetByPath<string>("Vit.Serialization.Encoding")?.StringToEnum<EEncoding>().ToEncoding() ?? Encoding.UTF8;
+
+        #endregion
+
+
+
+        public static readonly Serialization_Newtonsoft Instance = new Serialization_Newtonsoft();
         
-        public new static readonly Serialization_Newtonsoft Instance = new Serialization_Newtonsoft().InitByAppSettings();
+
+
+        #region 基础对象
+
+      
+
+        #region 成员对象 
+
+
+        public Encoding encoding { get; set; } = defaultEncoding;
+        public string charset { get => encoding.GetCharset(); }
+
+        #endregion
+
+
+
+        #region SpanToString
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public string SpanToString(ReadOnlySpan<byte> data, Encoding encoding = null)
+        {
+            if (data.Length == 0) return default;
+            unsafe
+            {
+                fixed (byte* bytes = data)
+                {
+                    return (encoding ?? this.encoding).GetString(bytes, data.Length);
+                }
+            }
+        }
+
+        #endregion
+
+
+        #region (x.1)bytes <--> String
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public string BytesToString(byte[] data, Encoding encoding = null)
+        {
+            return (encoding ?? this.encoding).GetString(data);
+        }
+
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public  byte[] StringToBytes(string data, Encoding encoding = null)
+        {
+            return (encoding ?? this.encoding).GetBytes(data);
+        }
+        #endregion
+
+
+
+        #region DeserializeStruct
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="type">必须为 where T : struct</param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeStruct(string value, Type type)
+        {
+            try
+            {
+                if (type.IsStringType())
+                    return value;
+                return value.Convert(type);
+            }
+            catch { }
+            return type.DefaultValue();
+        }
+
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        ///// <typeparam name="T">必须为 where T : struct</typeparam>
+        ///// <param name="value"></param>
+        ///// <returns></returns>
+        //public object DeserializeStruct<T>(string value)
+        //{
+        //    return DeserializeStruct(value, typeof(T));
+        //}
+
+
+
+        #endregion
+
+        #endregion
+
+
+
+
 
 
 
         public readonly Newtonsoft.Json.JsonSerializerSettings serializeSetting = new Newtonsoft.Json.JsonSerializerSettings();
+
         public Serialization_Newtonsoft() 
         {
 
@@ -24,134 +127,285 @@ namespace Vit.Core.Module.Serialization
             serializeSetting.Formatting = Formatting.None;
 
             //日期格式化
+            var DateTimeFormat = ConfigurationManager.Instance.GetByPath<string>("Vit.Serialization.DateTimeFormat")
+                ?? "yyyy-MM-dd HH:mm:ss";
+
             serializeSetting.DateFormatHandling = global::Newtonsoft.Json.DateFormatHandling.IsoDateFormat;
-            serializeSetting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
+            serializeSetting.DateFormatString = DateTimeFormat;
+        }
 
 
 
-            //Newtonsoft.Json.JsonSerializerSettings serializeSetting = new Newtonsoft.Json.JsonSerializerSettings();
-            //JsonConvert.DefaultSettings = new Func<JsonSerializerSettings>(() =>
-            //{
-            //    //日期类型默认格式化处理
-            //    //serializeSetting.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat;
-            //    //serializeSetting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
-            //    //空值处理
-            //    serializeSetting.NullValueHandling = NullValueHandling.Ignore;
-            //    //serializeSetting.Converters.Add(Serialize_DateTimeFormat);
-            //    return serializeSetting;
-            //});
-        }
 
 
-        #region 成员对象
+        #region (x.1)object <--> String
+
+        #region SerializeToString
 
         /// <summary>
-        /// 时间序列化格式。例如 "yyyy-MM-dd HH:mm:ss"
+        /// T也可为值类型(例如 int?、bool) 
         /// </summary>
-        //readonly IsoDateTimeConverter Serialize_DateTimeFormat = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
+        /// <typeparam name="T"></typeparam>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public string SerializeToString<T>(T value)
+        {
+            if (null == value) return null;
+         
+            return SerializeToString(value, value.GetType()); 
+        }
 
         /// <summary>
-        /// 设置时间序列化格式。例如 "yyyy-MM-dd HH:mm:ss"
+        /// T也可为值类型(例如 int?、bool) 
         /// </summary>
-        /// <param name="DateTimeFormat"></param>
-        public  void SetDateTimeFormat(string DateTimeFormat) 
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public string SerializeToString(object value, Type type)
         {
-            //Serialize_DateTimeFormat.DateTimeFormat = DateTimeFormat;
+            if (null == value) return null;
 
-            serializeSetting.DateFormatString = DateTimeFormat;
+            if (type.TypeIsValueTypeOrStringType())
+            {
+                return value.Convert<string>();
+            }
+            return JsonConvert.SerializeObject(value, serializeSetting);
         }
 
- 
-
-       
         #endregion
 
+        #region DeserializeFromString
 
-        #region InitByAppSettings
         /// <summary>
-        /// 根据配置文件(appsettings.json)初始化序列化配置
+        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
         /// </summary>
-        public Serialization_Newtonsoft InitByAppSettings()
-        { 
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public T DeserializeFromString<T>(string value)
+        {
+            return (T)DeserializeFromString(value,typeof(T));
+        }
+
 
-            #region (x.2) DateTimeFormat
-            var DateTimeFormat = ConfigurationManager.Instance.GetByPath<string>("Vit.Serialization.DateTimeFormat");
-            if (!string.IsNullOrWhiteSpace(DateTimeFormat))
+        /// <summary>
+        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromString(string value, Type type)
+        {
+            if (null == value || null == type) return null;
+
+            if (type.TypeIsValueTypeOrStringType())
             {
-                try
-                {
-                    SetDateTimeFormat(DateTimeFormat);
-                }
-                catch
-                {
-                }
+                return DeserializeStruct(value, type);
             }
-            #endregion
 
-            return this;
+            if (string.IsNullOrWhiteSpace(value)) return type.DefaultValue();
+
+            return JsonConvert.DeserializeObject(value, type);
         }
+
         #endregion
 
+        #endregion
+
+
 
-      
 
 
-        #region (x.2)object <--> String
 
-        #region SerializeToString
 
+        #region (x.2)object <--> bytes
+
+        #region SerializeToBytes
+
+        /// <summary>
+        /// T 可以为   byte[]、string、 object 、struct
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="obj"></param>
+        /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString<T>(T value)
+        public byte[] SerializeToBytes<T>(T obj)
         {
-            if (null == value) return null;
+            if (null == obj) return null;
 
-            if (value.GetType().TypeIsValueTypeOrStringType())
+            string strValue;
+            switch (obj)
             {
-                return value.Convert<string>();
+                case byte[] bytes:
+                    return bytes;
+                case ArraySegment<byte> asbs:
+                    return asbs.ArraySegmentByteToBytes();
+                case string str:
+                    strValue = str; break;
+                default: strValue = SerializeToString(obj); break;
             }
-            //return JsonConvert.SerializeObject(value, Serialize_DateTimeFormat);     
-            return JsonConvert.SerializeObject(value, serializeSetting); 
+
+            return StringToBytes(strValue);
         }
 
+
+
+        /// <summary>
+        /// type 可以为   byte[]、string、 object 、struct
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString(object value, Type type)
+        public byte[] SerializeToBytes(object value, Type type)
         {
-            //return JsonConvert.SerializeObject(value, Serialize_DateTimeFormat);
-            return JsonConvert.SerializeObject(value, serializeSetting);
+            return SerializeToBytes(value);
         }
-
         #endregion
 
-        #region DeserializeFromString
+
+        #region DeserializeFromBytes
 
         /// <summary>
-        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
+        /// type 可以为   byte[]、string、 object 、struct
         /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type"></param>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="bytes"></param>
         /// <returns></returns>
+
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromString(string value, Type type)
+        public T DeserializeFromBytes<T>(byte[] bytes)
         {
-            if (null == value || null == type) return null;
+            return (T)DeserializeFromBytes(bytes, typeof(T));
+        }
 
-            if (type.TypeIsValueTypeOrStringType())
+        /// <summary>
+        /// type 可以为   byte[]、string、 object 、struct
+        /// </summary>
+        /// <param name="bytes"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromBytes(byte[] bytes, Type type)
+        {
+            if (type == typeof(byte[]))
             {
-                return DeserializeStruct(value, type);
+                return bytes;
             }
+            if (type == typeof(ArraySegment<byte>))
+            {
+                return bytes.BytesToArraySegmentByte();
+            }
+            string strValue = BytesToString(bytes);
+            if (type == typeof(string))
+            {
+                return strValue;
+            }
+            return DeserializeFromString(strValue, type);
+        }
+        #endregion
 
-            if (string.IsNullOrWhiteSpace(value)) return type.DefaultValue();
 
-            return JsonConvert.DeserializeObject(value, type);
+        #region DeserializeFromSpan
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public T DeserializeFromSpan<T>(ReadOnlySpan<byte> bytes)
+        {
+            return (T)DeserializeFromSpan(bytes, typeof(T));
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromSpan(ReadOnlySpan<byte> bytes, Type type)
+        {
+            if (bytes.Length == 0) return default;
+
+            string strValue = SpanToString(bytes);
+            if (type == typeof(string))
+            {
+                return strValue;
+            }
+            return DeserializeFromString(strValue, type);
         }
+        #endregion
 
         #endregion
 
+
+
+
+
+
+
+
+
+
+        #region (x.4)object <--> ArraySegmentByte
+
+        #region SerializeToArraySegmentByte
+        /// <summary>
+        /// obj 可以为   byte[]、string、 object 、ArraySegment    
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public ArraySegment<byte> SerializeToArraySegmentByte(object obj)
+        {
+            if (null == obj) return ArraySegmentByteExtensions.Null;
+
+            if (obj is ArraySegment<byte> asbs)
+            {
+                return asbs;
+            }
+            if (obj is byte[] bytes)
+            {
+                return bytes.BytesToArraySegmentByte();
+            }
+
+            return SerializeToBytes(obj).BytesToArraySegmentByte();
+        }
         #endregion
 
 
 
 
+        #region DeserializeFromArraySegmentByte
+ 
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public  T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
+        {
+            if (bytes.Count == 0) return default;
+            return (T)DeserializeFromArraySegmentByte(bytes, typeof(T));
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromArraySegmentByte(ArraySegment<byte> bytes, Type type)
+        {
+            if (bytes.Count == 0) return default;
+
+            if (type == typeof(byte[]))
+            {
+                return bytes.ArraySegmentByteToBytes();
+            }
+            if (type == typeof(ArraySegment<byte>))
+            {
+                return bytes;
+            }
+            string strValue = bytes.ArraySegmentByteToString();
+            if (type == typeof(string))
+            {
+                return strValue;
+            }
+            return DeserializeFromString(strValue, type);
+        }
+        #endregion
+
+        #endregion
+
 
 
 

+ 30 - 108
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.cs

@@ -1,15 +1,14 @@
-
-using Vit.Extensions;
-using System;
+using System;
 using System.Runtime.CompilerServices;
 using System.Text.Json;
 
 namespace Vit.Core.Module.Serialization
 {
-    public class Serialization_Text : Serialization
+    public class Serialization_Text : ISerialization
     {
 
-        public new static readonly Serialization_Text Instance = new Serialization_Text();
+        public static readonly Serialization_Text Instance = new Serialization_Text();
+
 
         public JsonSerializerOptions serializeOptions = new JsonSerializerOptions
         {
@@ -24,12 +23,12 @@ namespace Vit.Core.Module.Serialization
         };
 
 
-        #region (x.2)object <--> String
+        #region (x.1)object <--> String
 
         #region SerializeToString
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString<T>(T value)
+        public string SerializeToString<T>(T value)
         {  
             return JsonSerializer.Serialize(value, serializeOptions);
         }
@@ -37,32 +36,27 @@ namespace Vit.Core.Module.Serialization
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override string SerializeToString(object value,Type type)
+        public string SerializeToString(object value,Type type)
         {
             return JsonSerializer.Serialize(value, type, serializeOptions);
         }
 
         #endregion
 
-        #region DeserializeFromString
 
-   
 
-        /// <summary>
-        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
-        /// </summary>
-        /// <param name="value"></param>
-        /// <param name="type"></param>
-        /// <returns></returns>
+        #region DeserializeFromString   
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromString(string value, Type type)
+        public T DeserializeFromString<T>(string value)
         {
-            if (null == value || null == type) return null;
+            return (T)DeserializeFromString(value, typeof(T));
+        }
+
+
 
-            if (type.TypeIsValueTypeOrStringType())
-            {
-                return DeserializeStruct(value, type);
-            }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public object DeserializeFromString(string value, Type type)
+        {  
             return JsonSerializer.Deserialize(value, type, deserializeOptions);
         }
 
@@ -72,24 +66,13 @@ namespace Vit.Core.Module.Serialization
 
 
 
-        #region (x.3)object <--> bytes
+        #region  (x.2)object <--> bytes
 
         #region SerializeToBytes
 
-        /// <summary>
-        /// obj 可以为   byte[]、string、 object       
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override byte[] SerializeToBytes<T>(T value)
-        {
-            if (null == value) return new byte[0];
-            
-            if (value is byte[] bytes)
-            {
-                return bytes;
-            }
+        public byte[] SerializeToBytes<T>(T value)
+        {           
 
             return JsonSerializer.SerializeToUtf8Bytes(value, serializeOptions); 
         }
@@ -97,15 +80,8 @@ namespace Vit.Core.Module.Serialization
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override byte[] SerializeToBytes(object value,Type type)
+        public byte[] SerializeToBytes(object value,Type type)
         {
-            if (null == value) return new byte[0];
-
-            if (value is byte[] bytes)
-            {
-                return bytes;
-            }
-
             return JsonSerializer.SerializeToUtf8Bytes(value,type, serializeOptions);
         }
         #endregion
@@ -114,25 +90,15 @@ namespace Vit.Core.Module.Serialization
         #region DeserializeFromBytes
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override T DeserializeFromBytes<T>(byte[] bytes)
-        {
-            if (bytes == null || bytes.Length == 0) return default;
+        public T DeserializeFromBytes<T>(byte[] bytes)
+        {          
             return JsonSerializer.Deserialize<T>(bytes, deserializeOptions);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromBytes(byte[] bytes, Type type)
+        public object DeserializeFromBytes(byte[] bytes, Type type)
         {
-            if (bytes == null || bytes.Length == 0) return default;
-            //if (type == typeof(byte[]))
-            //{
-            //    return bytes;
-            //}
-            //if (type == typeof(ArraySegment<byte>))
-            //{
-            //    return bytes.BytesToArraySegmentByte();
-            //}
-            return JsonSerializer.Deserialize(bytes,type, deserializeOptions);
+            return JsonSerializer.Deserialize(bytes, type, deserializeOptions);
         }
         #endregion
 
@@ -141,82 +107,38 @@ namespace Vit.Core.Module.Serialization
 
 
 
-        #region DeserializeFromSpan
+        #region (x.3)DeserializeFromSpan
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override T DeserializeFromSpan<T>(ReadOnlySpan<byte> bytes)
+        public T DeserializeFromSpan<T>(ReadOnlySpan<byte> bytes)
         {
             if (bytes.Length == 0) return default;
             return JsonSerializer.Deserialize<T>(bytes, deserializeOptions);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public override object DeserializeFromSpan(ReadOnlySpan<byte> bytes, Type type)
+        public object DeserializeFromSpan(ReadOnlySpan<byte> bytes, Type type)
         {
             if (bytes.Length == 0) return default;
-
             return JsonSerializer.Deserialize(bytes, type, deserializeOptions);
         }
         #endregion
 
 
-        #region (x.4)object <--> ArraySegmentByte
-
-        #region SerializeToArraySegmentByte
-        /// <summary>
-        /// obj 可以为   byte[]、string、 object       
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns></returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public ArraySegment<byte> SerializeToArraySegmentByte(object obj)
-        {
-            if (null == obj) return ArraySegmentByteExtensions.Null;
-
-            if (obj is ArraySegment<byte> asbs)
-            {
-                return asbs;
-            }
-            if (obj is byte[] bytes)
-            {
-                return bytes.BytesToArraySegmentByte();
-            }
-            
-            return SerializeToBytes(obj).BytesToArraySegmentByte();
-        }
-        #endregion
-
-        #region DeserializeFromArraySegmentByte
+        #region (x.4)DeserializeFromArraySegmentByte
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
         {
-            if (bytes.Count == 0) return default;
-
-            return JsonSerializer.Deserialize<T>(bytes, deserializeOptions);
+            return DeserializeFromSpan<T>(bytes);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public object DeserializeFromArraySegmentByte(ArraySegment<byte> bytes, Type type)
         {
-            if (bytes.Count == 0) return default;
-
-            //if (type == typeof(byte[]))
-            //{
-            //    return bytes.ArraySegmentByteToBytes();
-            //}
-            //if (type == typeof(ArraySegment<byte>))
-            //{
-            //    return bytes;
-            //}
-            return JsonSerializer.Deserialize(bytes, type, deserializeOptions);
+            return DeserializeFromSpan(bytes, type);
         }
         #endregion
 
-        #endregion
-
-
- 
-
     }
 }

+ 0 - 3
dotnet/Library/Vit/Vit.WebHost/appsettings.json

@@ -60,9 +60,6 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
-
 
     /* 序列化配置,可不指定 */
     "Serialization": {

+ 8 - 4
dotnet/ServiceCenter/App.Gover.Gateway/appsettings.json

@@ -31,6 +31,10 @@
     },
 
 
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
     /* ServiceStation配置,可不指定 */
     "ServiceStation": {
 
@@ -77,7 +81,7 @@
           //"rootPath": "wwwroot",
 
           /* 默认页面(可不指定)。An ordered list of file names to select by default. List length and ordering  may affect performance */
-          "defaultFileNames": ["index.html"],
+          "defaultFileNames": [ "index.html" ],
 
           /* 是否可浏览目录(default false)。Enables directory browsing */
           //"useDirectoryBrowser": false,
@@ -94,7 +98,7 @@
         }
 
       },
- 
+
 
       /* 调用api前的事件,可不指定。 */
       "//BeforeCallApi": [
@@ -162,8 +166,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
 
     /* 序列化配置,可不指定 */

+ 10 - 4
dotnet/ServiceCenter/App.ServiceCenter/appsettings.json

@@ -19,7 +19,7 @@
         "heartBeatTimeoutMs": 30000,
         /* 心跳检测失败重试次数(单位次,默认10) */
         "heartBeatRetryCount": 10,
-     
+
 
         /* 数据传输 加密协议,可多个,可不指定 */
         "//security": [
@@ -164,6 +164,12 @@
       ]
     },
 
+
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
+
     /* LocalApiService 配置,可不指定 */
     "LocalApiService": {
 
@@ -227,7 +233,7 @@
           //"apiStationName_Force": "",
 
           /* ApiStation名称。可不指定。(优先级从高到低:  apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
-          "apiStationName": "demo",
+          "apiStationName": "demo"
 
 
           /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低:  routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
@@ -515,8 +521,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
     /* 序列化配置,可不指定 */
     "Serialization": {

+ 1 - 1
dotnet/ServiceStation/ApiLoader/Sers.Serslot/ExceptionFilter/ExceptionFilter.cs

@@ -15,7 +15,7 @@ namespace Sers.Serslot.ExceptionFilter
     public class ExceptionFilter : IExceptionFilter
     {
 
-        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization.Instance.charset);
+        static readonly string Response_ContentType_Json = ("application/json; charset=" + Vit.Core.Module.Serialization.Serialization_Newtonsoft.Instance.charset);
 
         /// <summary>
         /// 发生异常时进入

+ 11 - 6
dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/appsettings.json

@@ -19,7 +19,7 @@
         "heartBeatTimeoutMs": 30000,
         /* 心跳检测失败重试次数(单位次,默认10) */
         "heartBeatRetryCount": 10,
-        
+
 
         /* 数据传输 加密协议,可多个,可不指定 */
         "//security": [
@@ -151,6 +151,11 @@
       ]
     },
 
+
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
     /* LocalApiService 配置,可不指定 */
     "LocalApiService": {
 
@@ -216,7 +221,7 @@
           //"apiStationName_Force": "",
 
           /* ApiStation名称。可不指定。(优先级从高到低:  apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
-          "apiStationName": "demo",
+          "apiStationName": "demo"
 
 
           /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低:  routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
@@ -290,14 +295,14 @@
       /* serviceStation站点信息,可不指定 */
       "serviceStationInfo": {
         /* 服务站点名称 */
-        "serviceStationName": "demo", 
+        "serviceStationName": "demo",
 
         /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
         //"stationVersion": "1.1.9.0",
 
         /* [json]服务站点额外信息,可不指定 */
         "info": null
-      }      
+      }
 
     }
   },
@@ -336,8 +341,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
 
     /* 序列化配置,可不指定 */

+ 6 - 2
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/appsettings.json

@@ -39,6 +39,10 @@
     },
 
 
+    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    "RpcDataSerializeMode": "MessagePack",
+
+
     /* LocalApiService 配置,可不指定 */
     "LocalApiService": {
 
@@ -196,8 +200,8 @@
       "PrintToConsole": true
     },
 
-    /* 队列类型。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
-    "ConsumerType": "ConsumerCache_BlockingCollection",
+    /* 队列模式,可不指定。可为 BlockingCollection(默认)、 ConsumerCache_BlockingCollection(高性能) 、ActionBlock、BufferBlock  */
+    "ConsumerMode": "ConsumerCache_BlockingCollection",
 
 
     /* 序列化配置,可不指定 */

+ 16 - 0
readme.md

@@ -42,6 +42,12 @@ win10(vr)      ApiClientAsync 8/8	      37万(90%)
 win10(vr)      ApiClientAsync 4/8	      32万(50%)
 win10(vr)      ApiClientAsync 4/4	      33万(50%)
 
+
+
+i7 7700K 4核8线程  ApiClientAsync 
+win10(4.2GHZ)   16/32	      33万(90%)
+
+
    
 | Os  |  robot内部调用(8线程)   |  ab压测(32线程,CGateway)   |
 | ------------ | ------------ | ------------ |
@@ -50,6 +56,16 @@ win10(vr)      ApiClientAsync 4/4	      33万(50%)
 | CentOs7(4核1G) |25000|5000|
  
 
+项目均部署在同一机器,消息队列使用SocketMq
+   
+| Os  | 调用线程数 | qps(内部调用)  | qps(http网关调用-本机)  |qps(jmeter调用http网关-外部)  |
+| ------------ | ------------ | ------------ | ------------ |------------ |
+|  Ubuntu(6核2G) | 10 | 7000  | 2000 | 1700 |
+|  CentOs7(1核1G) | 10 | 4000  | 1100 | 840 |
+|  CentOs7(2核1G) | 10 | 5000  | 1500-2000 | 1300|
+|  CentOs7(6核1G) | 10 | 8000-9400  | 3000 | 1800 |
+| Windows10| 10 | 6000 | 400| 1600 |
+| Server2012(6核2G)| 10 | 15000-17000 |  | 2200 |
 
 
 # 模块