Skip to content
tpc http and websocket performance benchmark testing components
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
NetBenchmark
LICENSE
README.md

README.md

NetBenchmark

tpc http and websocket performance benchmark components

package

https://www.nuget.org/packages/BeetleX.NetBenchmark/

tcp

    class Program
    {
        static void Main(string[] args)
        {
            var data = StringPacket.RamdomString(512);
            var runer = Benchmark.Tcp<StringPacket, Program>("192.168.2.19", 9090, 200,
                async (tcp, token) =>
                {
                    tcp.Send(data);
                    await tcp.Receive();
                }
            );
            runer.Run();
            runer.Print();
        }
    }

tcp results

image

http

    class Program
    {
        static void Main(string[] args)
        {
            var runer = Benchmark.Http<Program>(new Uri("http://192.168.2.19:5000"), 100,
                async (http, token) =>
                {
                    await http.Get("/api/values");
                    await http.PostJson("/api/values", "beetlex.io");
                });
            runer.Run();
            runer.Print();
        }
    }

http result

image

websocket

    class Program
    {
        static void Main(string[] args)
        {
            var runer = Benchmark.WebsocketJson<Program>(new Uri("ws://192.168.2.19:8080"), 100,
                async (ws, token) =>
                {
                    ws.TimeOut = 1000 * 5;
                    ws.Send(new { url = "/json" });
                    var result = await ws.Receive();
                });
            runer.Run();
            runer.Print();
        }
    }

result

image

You can’t perform that action at this time.