Simple gRPC requests take much longer time for backend
See original GitHub issueHello. I’ve tried YetAnotherHttpHandler 0.1.0 with an example gRPC Greeter service.
When published to a remote server, it takes up to 200ms longer for backend to process each request sent with YetAnotherHttpHandler than with default .NET HttpHandler. Can’t find out, why a simple echo response takes so much time.
This does not reproduce when both client and server run on a local PC.
An example Greeter service docker container I’ve used for test: https://hub.docker.com/r/tobegit3hub/grpc-helloworld
Can be started with docker run -d -p 50051:50051 tobegit3hub/grpc-helloworld
helloworld.proto for Client gRPC implementation: https://github.com/grpc/grpc/blob/master/examples/protos/helloworld.proto
Client code (remove GrpcChannelOptions to try it with default HttpHandler) :
`
using var channel = GrpcChannel.ForAddress("http://server-ip:50051", new GrpcChannelOptions()
{
HttpHandler = new YetAnotherHttpHandler()
{
Http2Only = true,
SkipCertificateVerification = true,
}
});
var client = new Helloworld.Greeter.GreeterClient(channel);
Stopwatch sw = new Stopwatch();
for (int j = 0; j < 100; j++)
{
sw.Start();
var reply = await client.SayHelloAsync(
new HelloRequest { Name = "GreeterClient" });
sw.Stop();
Console.WriteLine("Greeting: " + reply.Message + " " + sw.ElapsedMilliseconds);
sw.Reset();
await Task.Delay(500);
}
`
The same reproduces with ASP .NET Core gRPC services and/or MagicOnion.
Issue Analytics
- State:
- Created 2 months ago
- Comments:8 (3 by maintainers)
I’m running console repro project on Windows 10:
Microsoft Windows 10 Home Version 10.0.19045 Build 19045 System Type x64-based PC Processor Intel® Core™ i7-10710U CPU @ 1.10GHz, 1608 Mhz, 6 Core(s), 12 Logical Processor(s) Total Physical Memory 31.8 GB Internet Connection: Ethernet
The above graph is from Android app.
I’ve tried to run repro project in a local docker container based on Ubuntu and the issue does not reproduce. So it looks platform-dependent.