lith 4 年之前
父节点
当前提交
76a8fcc771
共有 17 个文件被更改,包括 191 次插入137 次删除
  1. 4 2
      dotnet/Doc/PublishFile/Sers单体压测/ServiceCenter/appsettings.json
  2. 4 2
      dotnet/Gateway/App.Gateway/appsettings.json
  3. 9 11
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContextData.cs
  4. 10 4
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/MessagePack_RpcContextData.cs
  5. 9 9
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/StringBuilder_RpcContextData.cs
  6. 78 63
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/Text_RpcContextData.cs
  7. 10 2
      dotnet/Library/Sers/Sers.Core/Sers.Core/Sers.Core.csproj
  8. 15 15
      dotnet/Library/Sers/Sers.Core/Sers.Core/Util/Consumer/ConsumerFactory.cs
  9. 15 15
      dotnet/Library/Sers/Sers.Core/Test/Sers.Core.Util.Consumer.Test/ProgramQps.cs
  10. 9 0
      dotnet/Library/Sers/Sers.Core/Test/Sers.Core.Util.Consumer.Test/Sers.Core.Util.Consumer.Test.csproj
  11. 11 2
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_MessagePack.Newtonsoft_Object.cs
  12. 1 5
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.Newtonsoft.cs
  13. 4 2
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.cs
  14. 3 1
      dotnet/ServiceCenter/App.Gover.Gateway/appsettings.json
  15. 3 2
      dotnet/ServiceCenter/App.ServiceCenter/appsettings.json
  16. 3 1
      dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/appsettings.json
  17. 3 1
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/appsettings.json

+ 4 - 2
dotnet/Doc/PublishFile/Sers单体压测/ServiceCenter/appsettings.json

@@ -43,8 +43,10 @@
 
 
 
 
 
 
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
-    "RpcDataSerializeMode": "MessagePack",
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
+    "RpcDataSerializeMode": "BytePointor",
 
 
 
 
 
 

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

@@ -31,8 +31,10 @@
     },
     },
 
 
 
 
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
-    "RpcDataSerializeMode": "MessagePack",
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
+    "RpcDataSerializeMode": "Text",
 
 
 
 
     /* ServiceStation配置,可不指定 */
     /* ServiceStation配置,可不指定 */

+ 9 - 11
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContextData.cs

@@ -18,21 +18,20 @@ namespace Sers.Core.Module.Rpc
 
 
         static RpcContextData()
         static RpcContextData()
         {
         {
-            // 可不指定。RpcData序列化模式。默认为Text。
-            // 可为 Newtonsoft、Text、MessagePack、BytePointor。
-            // 效率依次递增。MessagePack 和 BytePointor直接序列化为二进制数据而不是json字符串
+            // RpcData序列化模式。可不指定。默认为Text。
+            // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+            // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
             string rpcDataSerializeMode = ConfigurationManager.Instance.GetByPath<string>("Sers.RpcDataSerializeMode");
             string rpcDataSerializeMode = ConfigurationManager.Instance.GetByPath<string>("Sers.RpcDataSerializeMode");
-
-
+ 
             switch (rpcDataSerializeMode) 
             switch (rpcDataSerializeMode) 
             {
             {
                 case "Newtonsoft": Serialization = Newtonsoft_RpcContextData.Instance; break;
                 case "Newtonsoft": Serialization = Newtonsoft_RpcContextData.Instance; break;
                 case "Text": Serialization = Text_RpcContextData.Instance; break;
                 case "Text": Serialization = Text_RpcContextData.Instance; break;
+                case "StringBuilder": Serialization = StringBuilder_RpcContextData.Instance; break;
                 case "MessagePack": Serialization = MessagePack_RpcContextData.Instance; break;
                 case "MessagePack": Serialization = MessagePack_RpcContextData.Instance; break;
-                case "BytePointor": Serialization = BytePointor_RpcContextData.Instance; break;              
-            
-                //case "StringBuilder": Serialization = StringBuilder_RpcContextData.Instance; break;              
-                default: Serialization = Text_RpcContextData.Instance; break;
+                case "BytePointor": Serialization = BytePointor_RpcContextData.Instance; break;           
+                          
+                default: Serialization = StringBuilder_RpcContextData.Instance; break;
             }
             }
         }
         }
 
 
@@ -188,8 +187,7 @@ namespace Sers.Core.Module.Rpc
 
 
  
  
         public object error;
         public object error;
-
-        //[MessagePack.MessagePackFormatter(typeof(Vit.Core.Module.Serialization.MessagePack_Newtonsoft_Object))]
+ 
         public object user;
         public object user;
 
 
 
 

+ 10 - 4
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/MessagePack_RpcContextData.cs

@@ -108,7 +108,9 @@ namespace Sers.Core.Module.Rpc.Serialization
             if (value.error != null)
             if (value.error != null)
             {
             {
                 writer.Write("error");
                 writer.Write("error");
-                MessagePack_Newtonsoft_Object.Instance.Serialize(ref writer, value.error, options);
+                //MessagePack_Newtonsoft_Object.Instance.Serialize(ref writer, value.error, options);
+                var str = Serialization_Newtonsoft.Instance.SerializeToString(value.error);
+                writer.Write(str);
             }
             }
 
 
 
 
@@ -116,7 +118,9 @@ namespace Sers.Core.Module.Rpc.Serialization
             if (value.user != null)
             if (value.user != null)
             {
             {
                 writer.Write("user");
                 writer.Write("user");
-                MessagePack_Newtonsoft_Object.Instance.Serialize(ref writer, value.user, options);
+                //MessagePack_Newtonsoft_Object.Instance.Serialize(ref writer, value.user, options);
+                var str = Serialization_Newtonsoft.Instance.SerializeToString(value.user);
+                writer.Write(str);
             }
             }
         }
         }
 
 
@@ -226,13 +230,15 @@ namespace Sers.Core.Module.Rpc.Serialization
                     case "error":
                     case "error":
                         if (!reader.TryReadNil())
                         if (!reader.TryReadNil())
                         {
                         {
-                            result.error = MessagePack_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
+                            //result.error = MessagePack_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
+                            result.error = Serialization_Newtonsoft.Instance.DeserializeFromString<object>(reader.ReadString());
                         }
                         }
                         break;
                         break;
                     case "user":
                     case "user":
                         if (!reader.TryReadNil())
                         if (!reader.TryReadNil())
                         {
                         {
-                            result.error = MessagePack_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
+                            //result.user = MessagePack_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
+                            result.user = Serialization_Newtonsoft.Instance.DeserializeFromString<object>(reader.ReadString());
                         }
                         }
                         break;
                         break;
                     default:
                     default:

+ 9 - 9
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/StringBuilder_RpcContextData.cs

@@ -46,23 +46,23 @@ namespace Sers.Core.Module.Rpc.Serialization
             //(x.2)caller
             //(x.2)caller
             buffer.Append("\",\"caller\":{\"rid\":\"").Append(data.caller.rid);
             buffer.Append("\",\"caller\":{\"rid\":\"").Append(data.caller.rid);
 
 
-            if (data.caller.callStack != null)
-                buffer.Append("\",\"callStack\":").Append(Serialization_Newtonsoft.Instance.SerializeToString(data.caller.callStack));
+            buffer.Append("\",\"source\":\"").Append(data.caller.source).Append('"');
 
 
-            buffer.Append("\",\"source\":").Append(data.caller.source);
+            if (data.caller.callStack != null)
+                buffer.Append(",\"callStack\":").Append(Serialization_Text.Instance.SerializeToString(data.caller.callStack));
 
 
             //(x.3)http
             //(x.3)http
-            buffer.Append("\"},\"http\":{\"url\":\"").Append(data.http.url)
-                .Append("\",\"method\":\"").Append(data.http.method);
+            buffer.Append("},\"http\":{\"url\":\"").Append(data.http.url)
+                .Append("\",\"method\":\"").Append(data.http.method).Append('"');
 
 
             if (data.http.statusCode != null)
             if (data.http.statusCode != null)
-                buffer.Append("\",\"statusCode\":").Append(data.http.statusCode.Value);
+                buffer.Append(",\"statusCode\":").Append(data.http.statusCode.Value);
             if (data.http.protocol != null)
             if (data.http.protocol != null)
-                buffer.Append("\",\"protocol\":").Append(data.http.protocol);
+                buffer.Append(",\"protocol\":").Append(data.http.protocol).Append('"');
             if (data.http.headers != null)
             if (data.http.headers != null)
-                buffer.Append("\",\"headers\":").Append(Serialization_Newtonsoft.Instance.SerializeToString(data.http.headers));
+                buffer.Append(",\"headers\":").Append(Serialization_Text.Instance.SerializeToString(data.http.headers));
 
 
-            buffer.Append("\"}");
+            buffer.Append("}");
 
 
             if (data.error != null)
             if (data.error != null)
                 buffer.Append(",\"error\":").Append(Serialization_Newtonsoft.Instance.SerializeToString(data.error));
                 buffer.Append(",\"error\":").Append(Serialization_Newtonsoft.Instance.SerializeToString(data.error));

+ 78 - 63
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Serialization/Text_RpcContextData.cs

@@ -3,6 +3,8 @@ using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
 using System.Text.Json;
 using System.Text.Json;
 using System.Text.Json.Serialization;
 using System.Text.Json.Serialization;
+using Vit.Core.Module.Serialization;
+using Vit.Extensions;
 
 
 namespace Sers.Core.Module.Rpc.Serialization
 namespace Sers.Core.Module.Rpc.Serialization
 {
 {
@@ -11,31 +13,46 @@ namespace Sers.Core.Module.Rpc.Serialization
 
 
         public static readonly Text_RpcContextData Instance = new Text_RpcContextData();
         public static readonly Text_RpcContextData Instance = new Text_RpcContextData();
 
 
+        JsonSerializerOptions options = Serialization_Text.Instance.options;
+
+        JsonWriterOptions writerOptions = new JsonWriterOptions()
+        {
+            Encoder = Serialization_Text.Instance.options.Encoder,
+            Indented = Serialization_Text.Instance.options.WriteIndented,
+            SkipValidation = true
+        };
+
+        JsonReaderOptions readerOptions = new JsonReaderOptions
+        {
+            AllowTrailingCommas = Serialization_Text.Instance.options.AllowTrailingCommas,
+            CommentHandling = Serialization_Text.Instance.options.ReadCommentHandling,
+            MaxDepth = Serialization_Text.Instance.options.MaxDepth
+        };
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public byte[] SerializeToBytes(RpcContextData data) 
         public byte[] SerializeToBytes(RpcContextData data) 
         {
         {
             using (var stream = new MemoryStream())
             using (var stream = new MemoryStream())
-            using (Utf8JsonWriter writer = new Utf8JsonWriter(stream))
+            using (Utf8JsonWriter writer = new Utf8JsonWriter(stream, writerOptions))
             {
             {
-                Instance.Write(writer,data,null);
-                writer.Flush();
+                Instance.Write(writer, data,options);     
+                writer.Flush();        
                 return stream.ToArray();
                 return stream.ToArray();
-            }     
+            }
         }
         }
 
 
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public RpcContextData DeserializeFromBytes(ArraySegment<byte> data)
         public RpcContextData DeserializeFromBytes(ArraySegment<byte> data)
         {
         {
-            Utf8JsonReader reader = new Utf8JsonReader(data);
+            Utf8JsonReader reader = new Utf8JsonReader(data, readerOptions);
 
 
             if (!reader.Read())
             if (!reader.Read())
             {
             {
                 return null;
                 return null;
             }
             }
 
 
-            return Instance.Read(ref reader, null, null);
+            return Instance.Read(ref reader, typeof(RpcContextData), options);
         }
         }
 
 
 
 
@@ -104,12 +121,8 @@ namespace Sers.Core.Module.Rpc.Serialization
             //(x.4)error          
             //(x.4)error          
             if (value.error != null)
             if (value.error != null)
             {
             {
-                writer.WritePropertyName("error");
-                writer.WriteStartObject();               
-              
+                writer.WritePropertyName("error");           
                 JsonSerializer.Serialize(writer, value.error, options);
                 JsonSerializer.Serialize(writer, value.error, options);
-
-                writer.WriteEndObject();
             }
             }
 
 
 
 
@@ -117,11 +130,7 @@ namespace Sers.Core.Module.Rpc.Serialization
             if (value.user != null)
             if (value.user != null)
             {
             {
                 writer.WritePropertyName("user");
                 writer.WritePropertyName("user");
-                writer.WriteStartObject();
-
-                JsonSerializer.Serialize(writer, value.error, options);
-
-                writer.WriteEndObject();
+                JsonSerializer.Serialize(writer, value.user,options);
             }
             }
 
 
 
 
@@ -205,25 +214,27 @@ namespace Sers.Core.Module.Rpc.Serialization
                                 case "source":
                                 case "source":
                                     result.caller.source = reader.GetString();
                                     result.caller.source = reader.GetString();
                                     break;
                                     break;
-                                //case "callStack":
-                                    //if (reader.TokenType != JsonTokenType.StartArray)
-                                    //    throw new ArgumentException("json read error");
-
-                                    //arrayCount = reader.ReadArrayHeader();
-                                    //if (arrayCount > 0)
-                                    //{
-                                    //    options.Security.DepthStep(ref reader);
-                                    //    var list = new List<string>(arrayCount);
-                                    //    while ((arrayCount--) > 0)
-                                    //    {
-                                    //        list.Add(reader.ReadString());
-                                    //    }
-                                    //    result.caller.callStack = list;
-                                    //    reader.Depth--;
-                                    //}
-                                    //break;
-                                //default:
-                                //    reader.Skip(); break;
+                                case "callStack":
+                                    if (reader.TokenType != JsonTokenType.StartArray)
+                                        throw new ArgumentException("json read error");
+                                    var list = result.caller.callStack = new System.Collections.Generic.List<string>();
+                                    while (true)
+                                    {
+                                        if (!reader.Read())
+                                        {
+                                            throw new ArgumentException("json read error");
+                                        }
+
+                                        if (reader.TokenType == JsonTokenType.EndArray)
+                                        {
+                                            reader.Skip();
+                                            break;
+                                        }
+                                        list.Add(reader.GetString());
+                                    }
+                                    break;
+                                default:
+                                    reader.Skip(); break;
                             }
                             }
                         } 
                         } 
                         break;
                         break;
@@ -270,39 +281,43 @@ namespace Sers.Core.Module.Rpc.Serialization
                                 case "protocol":
                                 case "protocol":
                                     result.http.protocol = reader.GetString();
                                     result.http.protocol = reader.GetString();
                                     break;
                                     break;
-                                //case "headers":
-                                //    arrayCount = reader.ReadMapHeader();
-                                //    if (arrayCount > 0)
-                                //    {
-                                //        options.Security.DepthStep(ref reader);
-                                //        var headers = new Dictionary<string, string>(arrayCount);
-                                //        while ((arrayCount--) > 0)
-                                //        {
-                                //            headers[reader.ReadString()] = reader.ReadString();
-                                //        }
-                                //        result.http.headers = headers;
-                                //        reader.Depth--;
-                                //    }
-                                //    break;                             
-                              
+
+                                case "headers":
+                                    if (reader.TokenType != JsonTokenType.StartObject)
+                                        throw new ArgumentException("json read error");
+                                    var headers = result.http.Headers();
+                                    while (true)
+                                    {
+                                        if (!reader.Read())
+                                        {
+                                            throw new ArgumentException("json read error");
+                                        }
+
+                                        if (reader.TokenType == JsonTokenType.EndObject)
+                                        {
+                                            reader.Skip();
+                                            break;
+                                        }
+                                        key = reader.GetString();
+                                        if (!reader.Read())
+                                        {
+                                            throw new ArgumentException("json read error");
+                                        }
+                                        headers[key] = reader.GetString();
+                                    }
+                                    break;                                                 
+
                             }
                             }
                         }
                         }
                         break;
                         break;
 
 
 
 
-                        //case "error":
-                        //    if (!reader.TryReadNil())
-                        //    {
-                        //        result.error = MessagePackFormatter_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
-                        //    }
-                        //    break;
-                        //case "user":
-                        //    if (!reader.TryReadNil())
-                        //    {
-                        //        result.error = MessagePackFormatter_Newtonsoft_Object.Instance.Deserialize(ref reader, options);
-                        //    }
-                        //    break;
-
+                    case "error":
+                        result.error = JsonSerializer.Deserialize(ref reader, typeof(object), options);
+                        break;
+                    case "user":
+                        result.user = JsonSerializer.Deserialize(ref reader, typeof(object), options);
+                        break;
                 }
                 }
             }
             }
 
 

+ 10 - 2
dotnet/Library/Sers/Sers.Core/Sers.Core/Sers.Core.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
 
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
@@ -27,8 +27,16 @@
     <None Remove="SersLoader\ApiDesc\Attribute\Valid\delete\**" />
     <None Remove="SersLoader\ApiDesc\Attribute\Valid\delete\**" />
   </ItemGroup>
   </ItemGroup>
 
 
+
+  <ItemGroup>
+    <Compile Remove="Util\Consumer\Consumer_Disruptor.cs" />
+    <Compile Remove="Util\Consumer\Consumer_WorkerPool.cs" />
+    <Compile Remove="Util\Consumer\Consumer_WorkerPoolCache.cs" />
+    <Compile Remove="Util\Consumer\Consumer_WorkerPoolCascade.cs" />
+  </ItemGroup>
+
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Disruptor" Version="3.6.2" />
+    <!--<PackageReference Include="Disruptor" Version="3.6.2" />-->
     <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
     <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
     <PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
     <PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
     <PackageReference Include="System.Threading.Tasks.Dataflow" Version="5.0.0" />
     <PackageReference Include="System.Threading.Tasks.Dataflow" Version="5.0.0" />

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

@@ -28,12 +28,12 @@ namespace Sers.Core.Util.Consumer
                     break;
                     break;
 
 
 
 
-                case "Disruptor":
-                    consumer = new Consumer_Disruptor<T>(); // 16 16 800万
-                    break;
-                case "WorkerPool":
-                    consumer = new Consumer_WorkerPool<T>(); //16 16 800-900万
-                    break;
+                //case "Disruptor":
+                //    consumer = new Consumer_Disruptor<T>(); // 16 16 800万
+                //    break;
+                //case "WorkerPool":
+                //    consumer = new Consumer_WorkerPool<T>(); //16 16 800-900万
+                //    break;
 
 
                 case "ConsumerCache_ActionBlock":
                 case "ConsumerCache_ActionBlock":
                     consumer = new ConsumerCache<T, Consumer_ActionBlock<T>>(); // 16 16  4000-4200万
                     consumer = new ConsumerCache<T, Consumer_ActionBlock<T>>(); // 16 16  4000-4200万
@@ -47,15 +47,15 @@ namespace Sers.Core.Util.Consumer
 
 
 
 
 
 
-                case "ConsumerCache_WorkerPool":
-                    consumer = new ConsumerCache<T, Consumer_WorkerPool<T>>(); //750万  异常
-                    break;
-                case "WorkerPoolCache":
-                    consumer = new Consumer_WorkerPoolCache<T>();        //940万 异常
-                    break;
-                case "WorkerPoolCascade":
-                    consumer = new Consumer_WorkerPoolCascade<T>();   //1400万 异常
-                    break;
+                //case "ConsumerCache_WorkerPool":
+                //    consumer = new ConsumerCache<T, Consumer_WorkerPool<T>>(); //750万  异常
+                //    break;
+                //case "WorkerPoolCache":
+                //    consumer = new Consumer_WorkerPoolCache<T>();        //940万 异常
+                //    break;
+                //case "WorkerPoolCascade":
+                //    consumer = new Consumer_WorkerPoolCascade<T>();   //1400万 异常
+                //    break;
 
 
                 default:
                 default:
                     consumer = new Consumer_BlockingCollection<T>();
                     consumer = new Consumer_BlockingCollection<T>();

+ 15 - 15
dotnet/Library/Sers/Sers.Core/Test/Sers.Core.Util.Consumer.Test/ProgramQps.cs

@@ -84,12 +84,12 @@ namespace CLClient
                     break;
                     break;
               
               
   
   
-                case "Disruptor":
-                    consumer = new Consumer_Disruptor<Product>(); // 16 16 800万
-                    break;
-                case "WorkerPool":
-                    consumer = new Consumer_WorkerPool<Product>(); //16 16 800-900万
-                    break;
+                //case "Disruptor":
+                //    consumer = new Consumer_Disruptor<Product>(); // 16 16 800万
+                //    break;
+                //case "WorkerPool":
+                //    consumer = new Consumer_WorkerPool<Product>(); //16 16 800-900万
+                //    break;
 
 
                 case "ConsumerCache_ActionBlock":
                 case "ConsumerCache_ActionBlock":
                     consumer = new ConsumerCache<Product, Consumer_ActionBlock<Product>>(); // 16 16  4000-4200万
                     consumer = new ConsumerCache<Product, Consumer_ActionBlock<Product>>(); // 16 16  4000-4200万
@@ -103,15 +103,15 @@ namespace CLClient
 
 
 
 
 
 
-                case "ConsumerCache_WorkerPool":
-                    consumer = new ConsumerCache<Product, Consumer_WorkerPool<Product>>(); //750万  异常
-                    break;
-                case "WorkerPoolCache":
-                    consumer = new Consumer_WorkerPoolCache<Product>();        //940万 异常
-                    break;
-                case "WorkerPoolCascade":
-                    consumer = new Consumer_WorkerPoolCascade<Product>();   //1400万 异常
-                    break;
+                //case "ConsumerCache_WorkerPool":
+                //    consumer = new ConsumerCache<Product, Consumer_WorkerPool<Product>>(); //750万  异常
+                //    break;
+                //case "WorkerPoolCache":
+                //    consumer = new Consumer_WorkerPoolCache<Product>();        //940万 异常
+                //    break;
+                //case "WorkerPoolCascade":
+                //    consumer = new Consumer_WorkerPoolCascade<Product>();   //1400万 异常
+                //    break;
 
 
                 default:
                 default:
                     consumer= ConsumerFactory.CreateConsumer<Product>(); 
                     consumer= ConsumerFactory.CreateConsumer<Product>(); 

+ 9 - 0
dotnet/Library/Sers/Sers.Core/Test/Sers.Core.Util.Consumer.Test/Sers.Core.Util.Consumer.Test.csproj

@@ -4,6 +4,10 @@
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
     <TargetFramework>netcoreapp2.1</TargetFramework>
   </PropertyGroup>
   </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Remove="Test\WorkerPoolTest.cs" />
+  </ItemGroup>
  
  
 
 
   <ItemGroup>
   <ItemGroup>
@@ -21,6 +25,11 @@
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\Sers.Core\Sers.Core.csproj" />
     <ProjectReference Include="..\..\Sers.Core\Sers.Core.csproj" />
   </ItemGroup>
   </ItemGroup>
+ 
+
+  <ItemGroup>
+    <Folder Include="Test\" />
+  </ItemGroup>
 
 
  
  
 
 

+ 11 - 2
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_MessagePack.Newtonsoft_Object.cs

@@ -3,7 +3,6 @@ using System.Runtime.CompilerServices;
 using MessagePack.Formatters;
 using MessagePack.Formatters;
 using MessagePack;
 using MessagePack;
 using Newtonsoft.Json.Linq;
 using Newtonsoft.Json.Linq;
-using Vit.Core.Module.Serialization;
 using Vit.Extensions;
 using Vit.Extensions;
 
 
 using static Vit.Core.Module.Serialization.Serialization_MessagePack;
 using static Vit.Core.Module.Serialization.Serialization_MessagePack;
@@ -83,7 +82,17 @@ namespace Vit.Core.Module.Serialization
             }
             }
             else
             else
             {
             {
-                options.Resolver.GetFormatterWithVerify<Object>().Serialize(ref writer, value_, options);
+                throw new NotSupportedException(nameof(MessagePack_Newtonsoft_Object) + " support type JObject,not " + value_.GetType().FullName);
+
+                //options.Resolver.GetFormatterWithVerify<Object>().Serialize(ref writer, value_, options);
+                //try
+                //{               
+                //    MessagePackSerializer.Serialize(value_.GetType(), ref writer, value_, options); 
+                //}
+                //catch (Exception ex)
+                //{
+                //    throw;
+                //}             
             }
             }
         }
         }
 
 

+ 1 - 5
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.Newtonsoft.cs

@@ -3,16 +3,12 @@ using System.Runtime.CompilerServices;
 using System.Text.Json;
 using System.Text.Json;
 using System.Text.Json.Serialization;
 using System.Text.Json.Serialization;
 
 
-using Vit.Core.Util.ConfigurationManager;
- 
-
-
 
 
 #region 适配 Newtonsoft
 #region 适配 Newtonsoft
 
 
 namespace Vit.Core.Module.Serialization
 namespace Vit.Core.Module.Serialization
 {
 {
-   
+
     using Newtonsoft.Json.Linq;
     using Newtonsoft.Json.Linq;
     using Vit.Extensions;
     using Vit.Extensions;
 
 

+ 4 - 2
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Text.cs

@@ -2,7 +2,7 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
 using System.Text.Json;
 using System.Text.Json;
 using System.Text.Json.Serialization;
 using System.Text.Json.Serialization;
-
+using System.Text.Unicode;
 using Vit.Core.Util.ConfigurationManager;
 using Vit.Core.Util.ConfigurationManager;
 
 
 namespace Vit.Core.Module.Serialization
 namespace Vit.Core.Module.Serialization
@@ -16,11 +16,13 @@ namespace Vit.Core.Module.Serialization
     {
     {
 
 
         public static readonly Serialization_Text Instance = new Serialization_Text();
         public static readonly Serialization_Text Instance = new Serialization_Text();
-                          
+
 
 
 
 
         public readonly JsonSerializerOptions options = new JsonSerializerOptions
         public readonly JsonSerializerOptions options = new JsonSerializerOptions
         {
         {
+            //中文不转义 如 {"title":"\u4ee3\u7801\u6539\u53d8\u4e16\u754c"}
+            Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(UnicodeRanges.All),            
             IncludeFields = true,
             IncludeFields = true,
             DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
             DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
         };
         };

+ 3 - 1
dotnet/ServiceCenter/App.Gover.Gateway/appsettings.json

@@ -31,7 +31,9 @@
     },
     },
 
 
 
 
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
     "RpcDataSerializeMode": "Text",
     "RpcDataSerializeMode": "Text",
 
 
 
 

+ 3 - 2
dotnet/ServiceCenter/App.ServiceCenter/appsettings.json

@@ -164,8 +164,9 @@
       ]
       ]
     },
     },
 
 
-
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
     "RpcDataSerializeMode": "Text",
     "RpcDataSerializeMode": "Text",
 
 
 
 

+ 3 - 1
dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/appsettings.json

@@ -152,7 +152,9 @@
     },
     },
 
 
 
 
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
     "RpcDataSerializeMode": "Text",
     "RpcDataSerializeMode": "Text",
 
 
 
 

+ 3 - 1
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/appsettings.json

@@ -39,7 +39,9 @@
     },
     },
 
 
 
 
-    /* RpcData序列化模式,可不指定。可为 Text(默认)、Newtonsoft、MessagePack。MessagePack效率最快,但传递方式不为json字符串。 */
+    // RpcData序列化模式。可不指定。默认为Text。
+    // 可为 Newtonsoft、Text、StringBuilder、MessagePack、BytePointor。
+    // 效率依次递增。MessagePack 和 BytePointor 序列化为二进制数据而不是json字符串。
     "RpcDataSerializeMode": "Text",
     "RpcDataSerializeMode": "Text",