Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beetlex-io/netbenchmark
tpc http and websocket performance benchmark testing components
https://github.com/beetlex-io/netbenchmark
benchmark http-benchmarking http-client network-benchmark tcp-benchmarking tcp-client websocket websocket-benchmarking
Last synced: 4 months ago
JSON representation
tpc http and websocket performance benchmark testing components
- Host: GitHub
- URL: https://github.com/beetlex-io/netbenchmark
- Owner: beetlex-io
- License: apache-2.0
- Created: 2020-01-21T01:41:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-05T03:40:42.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T14:09:27.971Z (4 months ago)
- Topics: benchmark, http-benchmarking, http-client, network-benchmark, tcp-benchmarking, tcp-client, websocket, websocket-benchmarking
- Language: C#
- Homepage:
- Size: 27.3 KB
- Stars: 17
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NetBenchmark
tpc http and websocket performance benchmark components
## package
https://www.nuget.org/packages/BeetleX.NetBenchmark/
## tcp
``` csharp
class Program
{
static void Main(string[] args)
{
var data = StringPacket.RamdomString(512);
var runer = Benchmark.Tcp("192.168.2.19", 9090, 200,
async (tcp, token) =>
{
tcp.Send(data);
await tcp.Receive();
}
);
runer.Run();
runer.Print();
}
}
```
## tcp results
![image](https://user-images.githubusercontent.com/2564178/73148397-1ca69380-40f7-11ea-8db0-b2210cf66acb.png)
## http
``` csharp
class Program
{
static void Main(string[] args)
{
var runer = Benchmark.Http(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](https://user-images.githubusercontent.com/2564178/73148550-f2090a80-40f7-11ea-859d-713352100dae.png)
## websocket
``` csharp
class Program
{
static void Main(string[] args)
{
var runer = Benchmark.WebsocketJson(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](https://user-images.githubusercontent.com/2564178/73153365-7ebec300-410e-11ea-8e13-a0d3f2c313ba.png)