Skip to content

Commit

Permalink
Add simple protocol performance benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
chronoxor committed Jan 10, 2022
1 parent e2dc8b3 commit bd1e87e
Show file tree
Hide file tree
Showing 11 changed files with 570 additions and 5 deletions.
22 changes: 22 additions & 0 deletions NetCoreServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtoClient", "examples\Pro
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtoServer", "examples\ProtoServer\ProtoServer.csproj", "{8E48ACC4-F944-44BA-AEF7-3417D60160F3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtoClient", "performance\ProtoClient\ProtoClient.csproj", "{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtoServer", "performance\ProtoServer\ProtoServer.csproj", "{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -529,6 +533,22 @@ Global
{8E48ACC4-F944-44BA-AEF7-3417D60160F3}.Release|Any CPU.Build.0 = Release|Any CPU
{8E48ACC4-F944-44BA-AEF7-3417D60160F3}.Release|x64.ActiveCfg = Release|Any CPU
{8E48ACC4-F944-44BA-AEF7-3417D60160F3}.Release|x64.Build.0 = Release|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Debug|x64.ActiveCfg = Debug|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Debug|x64.Build.0 = Debug|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Release|Any CPU.Build.0 = Release|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Release|x64.ActiveCfg = Release|Any CPU
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25}.Release|x64.Build.0 = Release|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Debug|x64.ActiveCfg = Debug|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Debug|x64.Build.0 = Debug|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Release|Any CPU.Build.0 = Release|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Release|x64.ActiveCfg = Release|Any CPU
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -584,6 +604,8 @@ Global
{0A31A021-B53C-4B1B-A408-A46ABC97C93F} = {7535CE12-3B22-4473-890A-980B72E5D27A}
{6F0566A8-39A6-4910-BBE9-8F0B2CAEF50F} = {81ED94B5-0C65-432C-AEF5-67C3DFF7F2EE}
{8E48ACC4-F944-44BA-AEF7-3417D60160F3} = {81ED94B5-0C65-432C-AEF5-67C3DFF7F2EE}
{FF5FC891-4B49-4D2C-9342-252BA4FB9F25} = {8965E5CD-E36E-4DC5-A36E-827AFFC642D1}
{CA22BAB3-2DF7-4DFE-AAD6-11A1ADDA17A4} = {8965E5CD-E36E-4DC5-A36E-827AFFC642D1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {64415837-63D9-474E-A25C-EE91C9CA90C5}
Expand Down
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Has integration with message protocol based on [Fast Binary Encoding](https://gi
* [SSL echo server](#ssl-echo-server)
* [UDP echo server](#udp-echo-server)
* [Unix Domain Socket echo server](#unix-domain-socket-echo-server)
* [Simple protocol server](#simple-protocol-server)
* [WebSocket echo server](#websocket-echo-server)
* [WebSocket secure echo server](#websocket-secure-echo-server)
* [Benchmark: Multicast](#benchmark-multicast)
Expand Down Expand Up @@ -3324,6 +3325,50 @@ Message latency: 620 ns
Message throughput: 1610666 msg/s
```

### Simple protocol server

* [ProtoServer](https://github.com/chronoxor/NetCoreServer/blob/master/performance/ProtoServer/Program.cs)
* [ProtoClient](https://github.com/chronoxor/NetCoreServer/blob/master/performance/ProtoClient/Program.cs) --clients 1

```
Server address: 127.0.0.1
Server port: 4444
Working clients: 1
Working messages: 1000
Message size: 32
Seconds to benchmarking: 10
Errors: 0
Total time: 10.015 s
Total data: 100.568 MiB
Total messages: 3294993
Data throughput: 10.040 MiB/s
Message latency: 3.039 mcs
Message throughput: 328978 msg/s
```

* [ProtoServer](https://github.com/chronoxor/NetCoreServer/blob/master/performance/ProtoServer/Program.cs)
* [ProtoClient](https://github.com/chronoxor/NetCoreServer/blob/master/performance/ProtoClient/Program.cs) --clients 100

```
Server address: 127.0.0.1
Server port: 4444
Working clients: 100
Working messages: 1000
Message size: 32
Seconds to benchmarking: 10
Errors: 0
Total time: 12.530 s
Total data: 207.994 MiB
Total messages: 6814785
Data throughput: 16.611 MiB/s
Message latency: 1.838 mcs
Message throughput: 543858 msg/s
```

### WebSocket echo server

* [WsEchoServer](https://github.com/chronoxor/NetCoreServer/blob/master/performance/WsEchoServer/Program.cs)
Expand Down
2 changes: 1 addition & 1 deletion performance/HttpTraceClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void Main(string[] args)
// Disconnect clients
Console.Write("Clients disconnecting...");
foreach (var client in httpClients)
client.Disconnect();
client.DisconnectAsync();
Console.WriteLine("Done!");
foreach (var client in httpClients)
while (client.IsConnected)
Expand Down
2 changes: 1 addition & 1 deletion performance/HttpsTraceClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static void Main(string[] args)
// Disconnect clients
Console.Write("Clients disconnecting...");
foreach (var client in httpsClients)
client.Disconnect();
client.DisconnectAsync();
Console.WriteLine("Done!");
foreach (var client in httpsClients)
while (client.IsConnected)
Expand Down
Loading

0 comments on commit bd1e87e

Please sign in to comment.