Ver Fonte

[csharp/zysocket] Remove Zysocket-v (#9756)

Zysocket-V hasn't been updated for 4 years:
https://github.com/luyikk/zysocket-v

Also most downloads are probably for the TechEmpower tests:
https://www.nuget.org/packages/ZYSocketServerV
Petrik de Heus há 5 meses atrás
pai
commit
6b07457ece
23 ficheiros alterados com 0 adições e 1062 exclusões
  1. 0 25
      frameworks/CSharp/zysocket-v/PlatformBenchmarks.sln
  2. 0 48
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/AsciiString.cs
  3. 0 31
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/ConcurrentRandom.cs
  4. 0 123
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/DBRaw.cs
  5. 0 24
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/Fortune.cs
  6. 0 186
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/GMTDate.cs
  7. 0 200
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/HttpHandler.cs
  8. 0 9
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/HttpToken.cs
  9. 0 15
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/JsonMessage.cs
  10. 0 17
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/PlatformBenchmarks.csproj
  11. 0 19
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/Program.cs
  12. 0 13
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/Properties/PublishProfiles/FolderProfile.pubxml
  13. 0 15
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/World.cs
  14. 0 85
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/ZYHttpServer.cs
  15. 0 29
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/db.cs
  16. 0 58
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/fortunes.cs
  17. 0 22
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/json.cs
  18. 0 19
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/plaintext.cs
  19. 0 41
      frameworks/CSharp/zysocket-v/PlatformBenchmarks/queries.cs
  20. 0 23
      frameworks/CSharp/zysocket-v/README.md
  21. 0 29
      frameworks/CSharp/zysocket-v/benchmark_config.json
  22. 0 18
      frameworks/CSharp/zysocket-v/config.toml
  23. 0 13
      frameworks/CSharp/zysocket-v/zysocket-v.dockerfile

+ 0 - 25
frameworks/CSharp/zysocket-v/PlatformBenchmarks.sln

@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29230.47
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformBenchmarks", "PlatformBenchmarks\PlatformBenchmarks.csproj", "{E4500562-635D-4DB9-99AE-B321F52A7C46}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{E4500562-635D-4DB9-99AE-B321F52A7C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E4500562-635D-4DB9-99AE-B321F52A7C46}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E4500562-635D-4DB9-99AE-B321F52A7C46}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E4500562-635D-4DB9-99AE-B321F52A7C46}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {9FD9812E-E78B-4B9F-8526-8C85458ABA2E}
-	EndGlobalSection
-EndGlobal

+ 0 - 48
frameworks/CSharp/zysocket-v/PlatformBenchmarks/AsciiString.cs

@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace PlatformBenchmarks
-{
-    public readonly struct AsciiString : IEquatable<AsciiString>
-    {
-        private readonly byte[] _data;
-
-        public AsciiString(string s) => _data = Encoding.ASCII.GetBytes(s);
-
-        public int Length => _data.Length;
-
-        public byte[] Data => _data;
-
-        public ReadOnlySpan<byte> AsSpan() => _data;
-
-        public static implicit operator ReadOnlySpan<byte>(AsciiString str) => str._data;
-        public static implicit operator byte[](AsciiString str) => str._data;
-
-        public static implicit operator AsciiString(string str) => new AsciiString(str);
-
-        public static explicit operator string(AsciiString str) => str.ToString();
-
-        public bool Equals(AsciiString other) => ReferenceEquals(_data, other._data) || SequenceEqual(_data, other._data);
-        private bool SequenceEqual(byte[] data1, byte[] data2) => new Span<byte>(data1).SequenceEqual(data2);
-
-        public static bool operator ==(AsciiString a, AsciiString b) => a.Equals(b);
-        public static bool operator !=(AsciiString a, AsciiString b) => !a.Equals(b);
-        public override bool Equals(object other) => (other is AsciiString) && Equals((AsciiString)other);
-
-        public override int GetHashCode()
-        {
-            // Copied from x64 version of string.GetLegacyNonRandomizedHashCode()
-            // https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/String.Comparison.cs
-            var data = _data;
-            int hash1 = 5381;
-            int hash2 = hash1;
-            foreach (int b in data)
-            {
-                hash1 = ((hash1 << 5) + hash1) ^ b;
-            }
-            return hash1 + (hash2 * 1566083941);
-        }
-
-    }
-}

+ 0 - 31
frameworks/CSharp/zysocket-v/PlatformBenchmarks/ConcurrentRandom.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading;
-
-namespace PlatformBenchmarks
-{
-    public class ConcurrentRandom
-    {
-        private static int nextSeed = 0;
-
-        // Random isn't thread safe
-        [ThreadStatic]
-        private static Random _random;
-
-        private static Random Random => _random ?? CreateRandom();
-
-        [MethodImpl(MethodImplOptions.NoInlining)]
-        private static Random CreateRandom()
-        {
-            _random = new Random(Interlocked.Increment(ref nextSeed));
-            return _random;
-        }
-
-        public int Next(int minValue, int maxValue)
-        {
-            return Random.Next(minValue, maxValue);
-        }
-    }
-}

+ 0 - 123
frameworks/CSharp/zysocket-v/PlatformBenchmarks/DBRaw.cs

@@ -1,123 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Common;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks
-{
-    public class RawDb
-    {
-
-        private readonly ConcurrentRandom _random;
-
-        private readonly DbProviderFactory _dbProviderFactory;
-
-        private readonly string _connectionString;
-
-        public RawDb(ConcurrentRandom random, DbProviderFactory dbProviderFactory)
-        {
-            _random = random;
-            _dbProviderFactory = dbProviderFactory;
-            _connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3";
-            //_connectionString = "Server=192.168.1.55;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3";
-            OnCreateCommand();
-        }
-
-        private void OnCreateCommand()
-        {
-            SingleCommand = new Npgsql.NpgsqlCommand();
-            SingleCommand.CommandText = "SELECT id, randomnumber FROM world WHERE id = @Id";
-            var id = SingleCommand.CreateParameter();
-            id.ParameterName = "@Id";
-            id.DbType = DbType.Int32;
-            id.Value = _random.Next(1, 10001);
-            SingleCommand.Parameters.Add(id);
-            FortuneCommand = new Npgsql.NpgsqlCommand();
-            FortuneCommand.CommandText = "SELECT id, message FROM fortune";
-        }
-
-        private DbCommand SingleCommand;
-
-        private DbCommand FortuneCommand;
-
-        public async Task<World> LoadSingleQueryRow()
-        {
-            using (var db = _dbProviderFactory.CreateConnection())
-            {
-                db.ConnectionString = _connectionString;
-                await db.OpenAsync();
-                SingleCommand.Connection = db;
-                SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
-                return await ReadSingleRow(db, SingleCommand);
-
-            }
-        }
-
-        async Task<World> ReadSingleRow(DbConnection connection, DbCommand cmd)
-        {
-            using (var rdr = await cmd.ExecuteReaderAsync(CommandBehavior.SingleRow))
-            {
-                await rdr.ReadAsync();
-
-                return new World
-                {
-                    Id = rdr.GetInt32(0),
-                    RandomNumber = rdr.GetInt32(1)
-                };
-            }
-        }
-
-        public async Task<World[]> LoadMultipleQueriesRows(int count)
-        {
-            using (var db = _dbProviderFactory.CreateConnection())
-            {
-                db.ConnectionString = _connectionString;
-                await db.OpenAsync();
-                return await LoadMultipleRows(count, db);
-            }
-
-        }
-
-        private async Task<World[]> LoadMultipleRows(int count, DbConnection db)
-        {
-            SingleCommand.Connection = db;
-            SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
-            var result = new World[count];
-            for (int i = 0; i < result.Length; i++)
-            {
-                result[i] = await ReadSingleRow(db, SingleCommand);
-                SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
-            }
-            return result;
-
-        }
-
-        public async Task<List<Fortune>> LoadFortunesRows()
-        {
-            var result = new List<Fortune>();
-
-            using (var db = _dbProviderFactory.CreateConnection())
-            {
-                db.ConnectionString = _connectionString;
-                await db.OpenAsync();
-                FortuneCommand.Connection = db;
-                using (var rdr = await FortuneCommand.ExecuteReaderAsync(CommandBehavior.CloseConnection))
-                {
-                    while (await rdr.ReadAsync())
-                    {
-                        result.Add(new Fortune
-                        {
-                            Id = rdr.GetInt32(0),
-                            Message = rdr.GetString(1)
-                        });
-                    }
-                }
-            }
-            result.Add(new Fortune { Message = "Additional fortune added at request time." });
-            result.Sort();
-            return result;
-        }
-    }
-}

+ 0 - 24
frameworks/CSharp/zysocket-v/PlatformBenchmarks/Fortune.cs

@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace PlatformBenchmarks
-{
-    public class Fortune : IComparable<Fortune>, IComparable
-    {
-        public int Id { get; set; }
-
-        public string Message { get; set; }
-
-        public int CompareTo(object obj)
-        {
-            return CompareTo((Fortune)obj);
-        }
-
-        public int CompareTo(Fortune other)
-        {
-            // Performance critical, using culture insensitive comparison
-            return String.CompareOrdinal(Message, other.Message);
-        }
-    }
-}

+ 0 - 186
frameworks/CSharp/zysocket-v/PlatformBenchmarks/GMTDate.cs

@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-
-namespace PlatformBenchmarks
-{
-    internal class GMTDate
-    {
-        private List<byte[]> mWeekBuffers = new List<byte[]>();
-
-        public List<byte[]> mYears = new List<byte[]>();
-
-        public List<byte[]> mMoth = new List<byte[]>();
-
-        public List<byte[]> mNumber = new List<byte[]>();
-
-        private byte _1 = 58;
-
-        private byte _s = 32;
-
-        private byte _r = 13;
-
-        private byte _n = 10;
-
-        private byte[] GMT = new byte[3]
-        {
-        71,
-        77,
-        84
-        };
-
-        private static GMTDate mDefault;
-
-        private Timer mUpdateTime;
-
-        public static GMTDate Default
-        {
-            get
-            {
-                if (mDefault == null)
-                {
-                    mDefault = new GMTDate();
-                    mDefault.Init();
-                }
-                return mDefault;
-            }
-        }
-
-        public ArraySegment<byte> DATE
-        {
-            get;
-            set;
-        }
-
-        public GMTDate()
-        {
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Sun"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Mon"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Tue"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Wed"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Thu"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Fri"));
-            mWeekBuffers.Add(Encoding.ASCII.GetBytes("Sat"));
-            for (int j = 1970; j < 2470; j++)
-            {
-                mYears.Add(Encoding.ASCII.GetBytes(j.ToString()));
-            }
-            for (int i = 0; i <= 100; i++)
-            {
-                mNumber.Add(Encoding.ASCII.GetBytes(i.ToString("00")));
-            }
-            mMoth.Add(Encoding.ASCII.GetBytes("Jan"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Feb"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Mar"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Apr"));
-            mMoth.Add(Encoding.ASCII.GetBytes("May"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Jun"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Jul"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Aug"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Sep"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Oct"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Nov"));
-            mMoth.Add(Encoding.ASCII.GetBytes("Dec"));
-        }
-
-        private void Init()
-        {
-            DATE = GetData(inLine: true);
-            mUpdateTime = new Timer(delegate
-            {
-                DATE = GetData(inLine: true);
-            }, null, 1000, 1000);
-        }
-
-        private ArraySegment<byte> GetData(bool inLine = false)
-        {
-            return GetData(DateTime.Now, inLine);
-        }
-
-        private ArraySegment<byte> GetData(DateTime date, bool inLine = false)
-        {
-            date = date.ToUniversalTime();
-            int offset13 = 0;
-            byte[] GTM_BUFFER = new byte[50];
-            Encoding.ASCII.GetBytes("Date: ", 0, 6, GTM_BUFFER, 0);
-            offset13 = 6;
-            byte[] buffer = GTM_BUFFER;
-            byte[] sub8 = mWeekBuffers[(int)date.DayOfWeek];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = sub8[2];
-            offset13++;
-            buffer[offset13] = 44;
-            offset13++;
-            buffer[offset13] = _s;
-            offset13++;
-            sub8 = mNumber[date.Day];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = _s;
-            offset13++;
-            sub8 = mMoth[date.Month - 1];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = sub8[2];
-            offset13++;
-            buffer[offset13] = _s;
-            offset13++;
-            sub8 = mYears[date.Year - 1970];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = sub8[2];
-            offset13++;
-            buffer[offset13] = sub8[3];
-            offset13++;
-            buffer[offset13] = _s;
-            offset13++;
-            sub8 = mNumber[date.Hour];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = _1;
-            offset13++;
-            sub8 = mNumber[date.Minute];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = _1;
-            offset13++;
-            sub8 = mNumber[date.Second];
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = _s;
-            offset13++;
-            sub8 = GMT;
-            buffer[offset13] = sub8[0];
-            offset13++;
-            buffer[offset13] = sub8[1];
-            offset13++;
-            buffer[offset13] = sub8[2];
-            offset13++;
-            if (inLine)
-            {
-                buffer[offset13] = _r;
-                offset13++;
-                buffer[offset13] = _n;
-                offset13++;
-            }
-            return new ArraySegment<byte>(GTM_BUFFER, 0, offset13);
-        }
-    }
-
-}

+ 0 - 200
frameworks/CSharp/zysocket-v/PlatformBenchmarks/HttpHandler.cs

@@ -1,200 +0,0 @@
-using System;
-using System.Buffers;
-using System.Text;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-        private static AsciiString _line = new AsciiString("\r\n");
-
-        private static AsciiString _2line = new AsciiString("\r\n\r\n");
-
-        private static AsciiString _httpsuccess = new AsciiString("HTTP/1.1 200 OK\r\n");
-
-        private static readonly AsciiString _headerServer = "Server: zysocket\r\n";
-
-        private static readonly AsciiString _headerContentLength = "Content-Length: ";
-
-        private static readonly AsciiString _headerContentLengthZero = "Content-Length: 0\r\n";
-
-        private static readonly AsciiString _headerContentTypeText = "Content-Type: text/plain\r\n";
-
-        private static readonly AsciiString _headerContentTypeHtml = "Content-Type: text/html; charset=UTF-8\r\n";
-
-        private static readonly AsciiString _headerContentTypeJson = "Content-Type: application/json\r\n";
-
-        private static readonly AsciiString _path_Json = "/json";
-
-        private static readonly AsciiString _path_Db = "/db";
-
-        private static readonly AsciiString _path_Queries = "/queries";
-
-        private static readonly AsciiString _path_Plaintext = "/plaintext";
-
-        private static readonly AsciiString _path_Fortunes = "/fortunes";
-
-        private static readonly AsciiString _result_plaintext = "Hello, World!";
-
-        private static readonly byte[] LenData = new byte[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
-
-        private static byte _Space = 32;
-
-        private static byte _question = 63;
-
-
-        public HttpHandler()
-        {
-
-        }
-
-        public void Default(IFiberRw<HttpToken> fiberRw,ref WriteBytes write)
-        {
-            write.Write("<b> zysocket server</b><hr/>");         
-            write.Write($"error not found!");
-
-            var length = write.Stream.Length - fiberRw.UserToken.HttpHandlerPostion;
-            write.Stream.Position = fiberRw.UserToken.ContentPostion.postion;
-            write.Write(length.ToString(), false);
-            write.Flush();
-        }
-
-        private async Task OnCompleted(IFiberRw<HttpToken> fiberRw, WriteBytes write)
-        {
-            Task<int> WSend()
-            {
-                var length = write.Stream.Length - fiberRw.UserToken.HttpHandlerPostion;
-                write.Stream.Position = fiberRw.UserToken.ContentPostion.postion;
-                write.Write(length.ToString(), false);
-                write.Flush(false);
-                return fiberRw.Flush();
-            }
-
-            if (fiberRw.UserToken != null)
-                await await fiberRw.Sync.Ask(WSend);
-        }
-
-        private int AnalysisUrl(ReadOnlySpan<byte> url)
-        {
-            for (int i = 0; i < url.Length; i++)
-            {
-                if (url[i] == _question)
-                    return i;
-            }
-            return -1;
-
-        }
-
-        public async Task Receive(IFiberRw<HttpToken> fiberRw, Memory<byte> memory_r, WriteBytes write)
-        {
-            var data = (await fiberRw.ReadLine(memory_r));
-            ReadHander(fiberRw,ref data,ref write);
-            fiberRw.StreamReadFormat.Position = fiberRw.StreamReadFormat.Length;
-        }
-
-
-        private void ReadHander(IFiberRw<HttpToken> fiberRw,ref Memory<byte> linedata,ref WriteBytes write)
-        {
-            
-            var token = fiberRw.UserToken;
-            ReadOnlySpan<byte> line = linedata.Span;
-            ReadOnlySpan<byte> url = line;
-
-            int offset2 = 0;
-            int count = 0;
-            for (int i = 0; i < line.Length; i++)
-            {
-                if (line[i] == _Space)
-                {
-                    if (count != 0)
-                    {
-                        url = line.Slice(offset2, i - offset2);                                      
-                        break;
-                    }                  
-                    offset2 = i + 1;
-                    count++;
-                }
-            }
-
-          
-            int queryIndex = AnalysisUrl(url);
-            ReadOnlySpan<byte> queryString = default;
-            ReadOnlySpan<byte> baseUrl;
-            if (queryIndex > 0)
-            {
-                baseUrl = url.Slice(0, queryIndex);
-                queryString = url.Slice(queryIndex + 1, url.Length - queryIndex - 1);
-            }
-            else
-            {
-                baseUrl = url;
-            }
-            OnWriteHeader(ref write);
-
-            if (baseUrl.Length == _path_Plaintext.Length && baseUrl.StartsWith(_path_Plaintext))
-            {
-                write.Write(_headerContentTypeText.Data, 0, _headerContentTypeText.Length);
-                OnWriteContentLength(write, token);
-                Plaintext(fiberRw, write);
-            }
-            else if (baseUrl.Length == _path_Json.Length && baseUrl.StartsWith(_path_Json))
-            {
-                write.Write(_headerContentTypeJson.Data, 0, _headerContentTypeJson.Length);
-                OnWriteContentLength(write, token);
-                Json(fiberRw, write);
-            }
-            else if (baseUrl.Length == _path_Db.Length && baseUrl.StartsWith(_path_Db))
-            {
-                write.Write(_headerContentTypeJson.Data, 0, _headerContentTypeJson.Length);
-                OnWriteContentLength(write, token);
-                db(fiberRw, write);
-            }
-            else if (baseUrl.Length == _path_Queries.Length && baseUrl.StartsWith(_path_Queries))
-            {
-                write.Write(_headerContentTypeJson.Data, 0, _headerContentTypeJson.Length);
-                OnWriteContentLength(write, token);
-                queries(Encoding.ASCII.GetString(queryString),fiberRw, write);
-            }
-            else if (baseUrl.Length == _path_Fortunes.Length && baseUrl.StartsWith(_path_Fortunes))
-            {
-                write.Write(_headerContentTypeHtml.Data, 0, _headerContentTypeHtml.Length);
-                OnWriteContentLength(write, token);
-                fortunes(fiberRw, write);
-            }
-            else
-            {
-                write.Write(_headerContentTypeHtml.Data, 0, _headerContentTypeHtml.Length);
-                OnWriteContentLength(write, token);
-                Default( fiberRw, ref write);
-            }
-
-        }
-
-
-        private void OnWriteHeader(ref WriteBytes write)
-        {
-            write.Write(_httpsuccess.Data, 0, _httpsuccess.Length);
-            write.Write(_headerServer.Data, 0, _headerServer.Length);
-            ArraySegment<byte> date = GMTDate.Default.DATE;
-            write.Write(date.Array, date.Offset, date.Count);
-        }
-
-
-
-        private void OnWriteContentLength(WriteBytes write, HttpToken token)
-        {
-            write.Write(_headerContentLength.Data, 0, _headerContentLength.Length);
-            token.ContentPostion = write.Allocate(LenData);
-            write.Write(_2line, 0, 4);
-            token.HttpHandlerPostion = (int)write.Stream.Position;
-        }
-
-       
-
-
-
-    }
-}

+ 0 - 9
frameworks/CSharp/zysocket-v/PlatformBenchmarks/HttpToken.cs

@@ -1,9 +0,0 @@
-namespace PlatformBenchmarks
-{
-    public class HttpToken
-    {
-        public (int postion, int size) ContentPostion { get; set; }
-        public long HttpHandlerPostion { get; set; }
-        public RawDb Db { get; set; }
-    }
-}

+ 0 - 15
frameworks/CSharp/zysocket-v/PlatformBenchmarks/JsonMessage.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace PlatformBenchmarks
-{
-    public struct JsonMessage
-    {
-        public string message
-        {
-            get;
-            set;
-        }
-    }
-}

+ 0 - 17
frameworks/CSharp/zysocket-v/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -1,17 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <OutputType>Exe</OutputType>
-    <TargetFramework>netcoreapp3.0</TargetFramework> 
-    <LangVersion>8.0</LangVersion>
-    <ServerGarbageCollection>true</ServerGarbageCollection>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
-    <PackageReference Include="Npgsql" Version="4.1.1" />
-    <PackageReference Include="Swifter.Json" Version="1.2.9.6" />
-    <PackageReference Include="ZYSocketServerV" Version="1.6.2" />
-  </ItemGroup>
-
-</Project>

+ 0 - 19
frameworks/CSharp/zysocket-v/PlatformBenchmarks/Program.cs

@@ -1,19 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using System;
-
-namespace PlatformBenchmarks
-{
-    class Program
-    {
-        public static void Main(string[] args)
-        {
-            new HostBuilder().ConfigureServices(delegate (HostBuilderContext hostContext, IServiceCollection services)
-            {
-                services.AddHostedService<ZYHttpServer>();
-
-            }).Build().Run();
-
-        }
-    }
-}

+ 0 - 13
frameworks/CSharp/zysocket-v/PlatformBenchmarks/Properties/PublishProfiles/FolderProfile.pubxml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-https://go.microsoft.com/fwlink/?LinkID=208121. 
--->
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <PublishProtocol>FileSystem</PublishProtocol>
-    <Configuration>Release</Configuration>
-    <Platform>Any CPU</Platform>
-    <TargetFramework>net5.0</TargetFramework>
-    <PublishDir>bin\Release\netcoreapp2.2\publish\</PublishDir>
-  </PropertyGroup>
-</Project>

+ 0 - 15
frameworks/CSharp/zysocket-v/PlatformBenchmarks/World.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace PlatformBenchmarks
-{
-    [StructLayout(LayoutKind.Sequential, Size = 8)]
-    public struct World
-    {
-        public int Id { get; set; }
-
-        public int RandomNumber { get; set; }
-    }
-}

+ 0 - 85
frameworks/CSharp/zysocket-v/PlatformBenchmarks/ZYHttpServer.cs

@@ -1,85 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.Server;
-using ZYSocket.Server.Builder;
-
-namespace PlatformBenchmarks
-{
-    public class ZYHttpServer : IHostedService
-    {
-        public ISocketServer SocketServer { get; private set; }
-        public IServiceProvider serviceProvider { get; private set; }
-
-        public HttpHandler @HttpHandler { get; private set; }
-
-        public ZYHttpServer()
-        {
-            ArraySegment<byte> date = GMTDate.Default.DATE;
-            var containerBuilder = new ServiceCollection();
-            new SockServBuilder(containerBuilder, p =>
-            {
-                return new ZYSocketSuper(p)
-                {
-                    BinaryInput = new BinaryInputHandler(BinaryInputHandler),
-                    Connetions = new ConnectionFilter(ConnectionFilter),
-                    MessageInput = new DisconnectHandler(DisconnectHandler)
-                };
-            })
-             .ConfigServer(p =>
-             {
-                 p.Port = 8080;
-                 p.MaxBufferSize = 1024;
-                 p.MaxConnectCout = 20000;
-             });
-
-            serviceProvider = containerBuilder.BuildServiceProvider();
-            SocketServer = serviceProvider.GetRequiredService<ISocketServer>();
-            @HttpHandler = new HttpHandler();
-        }
-
-
-        public Task StartAsync(CancellationToken cancellationToken)
-        {
-            SocketServer.Start();
-            return Task.CompletedTask;
-        }
-
-        public Task StopAsync(CancellationToken cancellationToken)
-        {
-            SocketServer.Stop();
-            return Task.CompletedTask;
-        }
-
-        bool ConnectionFilter(ISockAsyncEvent socketAsync) => true;
-
-        void DisconnectHandler(string message, ISockAsyncEvent socketAsync, int erorr)
-        {
-            socketAsync.UserToken = null;
-            socketAsync.AcceptSocket.Dispose();
-        }
-
-
-        async void BinaryInputHandler(ISockAsyncEvent socketAsync)
-        {
-            var fiberRw = await socketAsync.GetFiberRw<HttpToken>();
-            fiberRw.UserToken = new HttpToken
-            {
-                Db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance)
-            };
-
-            using var data_r = fiberRw.GetMemory(1024);         
-            using var write = new WriteBytes(fiberRw);
-            for (; ; )
-            {
-                await HttpHandler.Receive(fiberRw, data_r.Memory, write);
-            }
-
-        }
-    }
-}

+ 0 - 29
frameworks/CSharp/zysocket-v/PlatformBenchmarks/db.cs

@@ -1,29 +0,0 @@
-
-using Swifter.Json;
-using System;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-
-        public async void db(IFiberRw<HttpToken> fiberRw, WriteBytes write)
-        {
-            try
-            {
-                var data = await fiberRw.UserToken.Db.LoadSingleQueryRow();
-                await JsonFormatter.SerializeObjectAsync(data, write.Stream, System.Text.Encoding.UTF8);
-            }
-            catch (Exception e_)
-            {
-                write.Write(e_.Message);               
-            }
-
-            await OnCompleted(fiberRw, write);
-
-        }
-    }
-}

+ 0 - 58
frameworks/CSharp/zysocket-v/PlatformBenchmarks/fortunes.cs

@@ -1,58 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-
-        private readonly static AsciiString _fortunesTableStart = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";     
-        private readonly static AsciiString _fortunesRowStart = "<tr><td>";
-        private readonly static AsciiString _fortunesColumn = "</td><td>";
-        private readonly static AsciiString _fortunesRowEnd = "</td></tr>";
-        private readonly static AsciiString _fortunesTableEnd = "</table></body></html>";
-
-        public async void fortunes(IFiberRw<HttpToken> fiberRw, WriteBytes write)
-        {
-         
-
-            try
-            {
-                var data = await fiberRw.UserToken.Db.LoadFortunesRows();
-
-                Task<int> WSend()
-                {
-                    write.Write(_fortunesTableStart.Data, 0, _fortunesTableStart.Length);
-                    foreach (var item in data)
-                    {
-                        write.Write(_fortunesRowStart.Data, 0, _fortunesRowStart.Length);
-                        write.Write(item.Id.ToString(CultureInfo.InvariantCulture),false);
-                        write.Write(_fortunesColumn.Data, 0, _fortunesColumn.Length);
-                        write.Write(System.Web.HttpUtility.HtmlEncode(item.Message),false);
-                        write.Write(_fortunesRowEnd.Data, 0, _fortunesRowEnd.Length);
-                    }
-                    write.Write(_fortunesTableEnd.Data, 0, _fortunesTableEnd.Length);
-
-                    var length = write.Stream.Length - fiberRw.UserToken.HttpHandlerPostion;
-                    write.Stream.Position = fiberRw.UserToken.ContentPostion.postion;
-                    write.Write(length.ToString(), false);
-                    write.Flush(false);
-                    return fiberRw.Flush();
-                }
-                if (fiberRw.UserToken != null)
-                    await await fiberRw.Sync.Ask(WSend);
-            }
-            catch (Exception e_)
-            {
-                write.Write(e_.Message);
-                await OnCompleted(fiberRw, write);
-            }
-
-
-        }
-    }
-}

+ 0 - 22
frameworks/CSharp/zysocket-v/PlatformBenchmarks/json.cs

@@ -1,22 +0,0 @@
-using Swifter.Json;
-using System;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-        public async void Json(IFiberRw<HttpToken> fiberRw,WriteBytes write)
-        {
-            JsonMessage jsonMessage = default(JsonMessage);
-            jsonMessage.message = "Hello, World!";          
-            JsonFormatter.SerializeObject(jsonMessage,write.Stream,System.Text.Encoding.UTF8);
-            var length = write.Stream.Length - fiberRw.UserToken.HttpHandlerPostion;
-            write.Stream.Position = fiberRw.UserToken.ContentPostion.postion;
-            write.Write(length.ToString(), false);
-            await write.Flush();
-        }
-    }
-}

+ 0 - 19
frameworks/CSharp/zysocket-v/PlatformBenchmarks/plaintext.cs

@@ -1,19 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-        public async void Plaintext( IFiberRw<HttpToken> fiberRw,  WriteBytes write)
-        {
-            write.Write(_result_plaintext.Data, 0, _result_plaintext.Length);
-            var length = write.Stream.Length - fiberRw.UserToken.HttpHandlerPostion;
-            write.Stream.Position = fiberRw.UserToken.ContentPostion.postion;
-            write.Write(length.ToString(), false);
-            await write.Flush();          
-        }
-    }
-}

+ 0 - 41
frameworks/CSharp/zysocket-v/PlatformBenchmarks/queries.cs

@@ -1,41 +0,0 @@
-using Swifter.Json;
-using System;
-using ZYSocket;
-using ZYSocket.FiberStream;
-
-namespace PlatformBenchmarks
-{
-    public partial class HttpHandler
-    {
-        public async void queries(string queryString, IFiberRw<HttpToken> fiberRw, WriteBytes write)
-        {
-            int count = 1;
-            if (!string.IsNullOrEmpty(queryString))
-            {
-                var values = queryString.Split('=');
-                if (values.Length > 1)
-                {
-                    if (int.TryParse(values[1], out int size))
-                    {
-                        count = size;
-                    }
-                }
-            }
-            if (count > 500)
-                count = 500;
-            if (count < 1)
-                count = 1;
-            try
-            {
-                var data = await fiberRw.UserToken.Db.LoadMultipleQueriesRows(count);               
-
-                await JsonFormatter.SerializeObjectAsync(data, write.Stream, System.Text.Encoding.UTF8);
-            }
-            catch (Exception e_)
-            {
-                write.Write(e_.Message);
-            }
-            await OnCompleted(fiberRw, write);
-        }
-    }
-}

+ 0 - 23
frameworks/CSharp/zysocket-v/README.md

@@ -1,23 +0,0 @@
-# [ZYSOCKET-V](https://github.com/luyikk/zysocket-v)(.Net) Benchmarking Test
-This includes tests for plaintext, json, db.
-
-## Infrastructure Software Versions
-**Language**
-
-* C# 7.2
-
-**Platforms**
-
-* .NET Core (Windows and Linux)
-
-**Web Servers**
-
-* [ZYSOCKET-V](https://github.com/luyikk/zysocket-v)
-
-## Paths & Source for Tests
-
-* [Plaintext](PlatformBenchmarks/Program.cs): "/plaintext"
-* [JSON Serialization](PlatformBenchmarks/Program.cs): "/json"
-* [Single query](PlatformBenchmarks/Program.cs): "/db"
-* [Multiple query](PlatformBenchmarks/Program.cs): "/queries"
-* [Fortune](PlatformBenchmarks/Program.cs): "/fortune"

+ 0 - 29
frameworks/CSharp/zysocket-v/benchmark_config.json

@@ -1,29 +0,0 @@
-{
-  "framework": "zysocket-v",
-  "tests": [
-    {
-      "default": {    
-        "fortune_url": "/fortunes",  
-        "plaintext_url": "/plaintext",
-        "json_url": "/json",
-        "db_url": "/db",
-        "query_url": "/queries?queries=",   
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Fullstack",
-        "database": "Postgres",
-        "framework": "zysocket-v",
-        "language": "C#",
-        "orm": "Raw",
-        "platform": ".NET",
-        "flavor": "CoreCLR",
-        "webserver": "zysocket-v",
-        "os": "Linux",
-        "database_os": "Linux",
-        "display_name": "zysocket-v",
-        "notes": "",
-        "versus": "aspcore-mvc"
-      }
-    }
-  ]
-}

+ 0 - 18
frameworks/CSharp/zysocket-v/config.toml

@@ -1,18 +0,0 @@
-[framework]
-name = "zysocket-v"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries?queries="
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "Fullstack"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = ".NET"
-webserver = "zysocket-v"
-versus = "aspcore-mvc"

+ 0 - 13
frameworks/CSharp/zysocket-v/zysocket-v.dockerfile

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