GRPC dotnet very slow with .net 5 framework
See original GitHub issueHello all I’m facing a very weird behavior. I’m using GRPC .net client package (version 2.45.0) on .NET framework 5 as a very stupid client for a grpc server written in Golang. The client -> server communication is in streaming. With GRPC core package the client/server communication run about 15000 operations per second. With GRPC .net client package the communication is about 1200 ops/s.
Please find here below the cliente code:
GRPC core code: ` var chanel = new Channel(“172.25.0.100”, 4424, ChannelCredentials.Insecure); var service = new GrpcService.GrpcServiceClient(chanel); var call = service.AppendItems();
foreach (var i in grpcItems) { await call.RequestStream.WriteAsync®.ConfigureAwait(false); } await call.RequestStream.CompleteAsync(); `
GRPC .net client code: ` var chanel = GrpcChannel.ForAddress(“http://172.25.0.100:4424/”, new GrpcChannelOptions { HttpHandler = new SocketsHttpHandler { EnableMultipleHttp2Connections = true, PreAuthenticate = false, UseCookies = false, PooledConnectionIdleTimeout = Timeout.InfiniteTimeSpan, }, }); var service = new GrpcService.GrpcServiceClient(chanel); var call = service.AppendItems();
foreach (var i in grpcItems) { await call.RequestStream.WriteAsync®.ConfigureAwait(false); } await call.RequestStream.CompleteAsync(); `
Using .net 6 frameworks times are almost the same but I was expecting something faster. Can you kindly point me out on how to improve performances.
Thank you
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
Hello, I’ve encountered the same situation when migrating to
Grpc.Net.Client
fromGrpc.Core
where the performance is quite worse. Unfortunately this can be difficult to reproduce, so I made a simple repro here:➡️ https://github.com/ogxd/grpc-net-client-migration-perf-repro
Just run the unit test, it will setup a server and create clients in both Grpc.Core and Grpc.Net.Client and push some load.
Here are the results when I ask for 10,000 QPS:
It gets even worse if I ask for 20,000 QPS:
Tested on a windows laptop with dotnet 6 in release mode.
Because the conclusion was that the difference would only be there when under workstation GC and because my application uses server mode GC, I switched to Grpc.Net.Client. There is however an important difference in performance still 😦
EDIT: I have experimented a bit and I think this one is unrelated, it looks more related to cancellation management. I have created another issue https://github.com/grpc/grpc-dotnet/issues/1917