tpc http and websocket performance benchmark components
https://www.nuget.org/packages/BeetleX.NetBenchmark/
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();
}
}
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();
}
}
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();
}
}