question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simple gRPC requests take much longer time for backend

See original GitHub issue

Hello. 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:open
  • Created 2 months ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pspgitcommented, Aug 8, 2023

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.

0reactions
pspgitcommented, Aug 8, 2023

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.

YetAnotherHttpHandler
Yet Greeting: Hello, GreeterClient! 437
Yet Greeting: Hello, GreeterClient! 136
Yet Greeting: Hello, GreeterClient! 136
Yet Greeting: Hello, GreeterClient! 136
Yet Greeting: Hello, GreeterClient! 135
Yet Greeting: Hello, GreeterClient! 135
Yet Greeting: Hello, GreeterClient! 136
Yet Greeting: Hello, GreeterClient! 135
Yet Greeting: Hello, GreeterClient! 135
Yet Greeting: Hello, GreeterClient! 135

.NET HttpHandler
.NET Greeting: Hello, GreeterClient! 346
.NET Greeting: Hello, GreeterClient! 137
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 133
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 134
.NET Greeting: Hello, GreeterClient! 138
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my Node.js gRPC client take 3 seconds to send ...
First, the first request made by a client always takes longer because it has to do some connection setup work. The general expectation...
Read more >
Deadlines
A timeout is the max duration of time that the request can take. For simplicity, we will only refer to deadline in this...
Read more >
gRPC and Deadlines
Deadlines allow gRPC clients to specify how long they are willing to wait for an RPC to complete before the RPC is terminated...
Read more >
So You Want to Optimize gRPC - Part 1
Reads and writes will experience a 10 and 50 millisecond delay to make the example act more like a persistent database.
Read more >
Performance Best Practices
A user guide of both general and language-specific best practices to improve performance.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found