https://github.com/peterdeme/grpc.json.performancetest
Grpc vs Json performance test on .NET Core 2.0 platform
https://github.com/peterdeme/grpc.json.performancetest
benchmark grpc json kestrel performance test
Last synced: 3 days ago
JSON representation
Grpc vs Json performance test on .NET Core 2.0 platform
- Host: GitHub
- URL: https://github.com/peterdeme/grpc.json.performancetest
- Owner: peterdeme
- Created: 2017-08-22T19:58:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-07T19:17:28.000Z (almost 6 years ago)
- Last Synced: 2025-02-05T12:46:57.737Z (8 months ago)
- Topics: benchmark, grpc, json, kestrel, performance, test
- Language: C#
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grpc vs Json Performance Test on .NET Core 2.0
Benchmarked with [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) library.
### Versions
**GRPC library version**: 1.4.1**ASP.NET Core version**: 2.0, **Newtonsoft.Json**: 10.0.3
### Servers
**GRPC**: Benchmarked against GRPC server.
**Json**: Benchmarked against ASP.NET Core 2.0 (Kestrel + MVC framework).
### Clients
**GRPC**: .NET Core 2.0 console app.**Json**: .NET Core 2.0 console app.
### Json request size
Encoding: UTF8Formatting: not indented
[SmallRequest](https://github.com/peterdeme/Grpc.Json.PerformanceTest/blob/master/Shared/SmallRequest.cs): 26 chars -> **26 bytes**
[HugeRequest](https://github.com/peterdeme/Grpc.Json.PerformanceTest/blob/master/Shared/HugeRequest.cs): 4,828 characters -> **4,828 bytes**
## GRPC Result
``` ini
BenchmarkDotNet=v0.10.9, OS=Windows 10 Threshold 2 (10.0.10586)
Processor=Intel Core i7-5500U CPU 2.40GHz (Broadwell), ProcessorCount=4
Frequency=2338332 Hz, Resolution=427.6553 ns, Timer=TSC
.NET Core SDK=2.0.0
[Host] : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
DefaultJob : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT```
| Method | Mean | Error | StdDev |
|------------------------- |---------:|---------:|---------:|
| SendSmallRequestToServer | 138.7 us | 2.349 us | 2.082 us |
| SendHugeRequestToServer | 277.9 us | 5.124 us | 5.483 us |
## Json Result
``` ini
BenchmarkDotNet=v0.10.9, OS=Windows 10 Threshold 2 (10.0.10586)
Processor=Intel Core i7-5500U CPU 2.40GHz (Broadwell), ProcessorCount=4
Frequency=2338332 Hz, Resolution=427.6553 ns, Timer=TSC
.NET Core SDK=2.0.0
[Host] : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
DefaultJob : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT```
| Method | Mean | Error | StdDev | Median |
|------------------------- |---------:|---------:|---------:|---------:|
| SendSmallRequestToServer | 613.5 us | 20.30 us | 56.26 us | 590.5 us |
| SendHugeRequestToServer | 964.1 us | 20.12 us | 39.71 us | 950.1 us |## Diagrams
*The smaller the better. Y scale is nanosec*
![]()
*The smaller the better. Y scale is nanosec*
![]()
## How to run the tests
Open 2 separate command window and run the servers.```
cd "Grpc.Json.PerformanceTest\JsonServer"
dotnet run -c Release
```
```
cd "Grpc.Json.PerformanceTest\GrpcServer"
dotnet run -c Release
```And then the testrunners:
```
cd "Grpc.Json.PerformanceTest\JsonClient"
dotnet run -c Release
``````
cd "Grpc.Json.PerformanceTest\GrpcClient"
dotnet run -c Release
```