grpc / grpc/grpc-dotnet

Grpc transfer big data, one unary call is slower than streaming.

Open
#1,080 2 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

I'm trying to transfer a big data between two services using grpc.

The data size is about 23M and is composed by 42 big List.

Then I test the performance using one unary call vs server side streaming(stream one list at a time).

The unary call takes 276.59 ms.

The streaming call takes 126.64 ms.

But if I change the data to contains 1000 small list, each list just have one number, the streaming call is much more slower than unary call.

Is the result normal? And Why?

Here is the server side code:
```C#
public override Task GetLargeMEM(Empty request, ServerCallContext context)
{
return Task.FromResult(MemData.GrpcLargeMem);
}
public override async Task StreamLargeMem(Empty request, IServerStreamWriter responseStream, ServerCallContext context)
{
foreach (var log in MemData.GrpcLargeMem.Logs)
{
await responseStream.WriteAsync(log);
}
}
```
I use the .net core 3.1 and grpc nuget package 2.32.0.
Run test in aks cluster
![image](https://user-images.githubusercontent.com/26685122/96369007-f72c4f00-1189-11eb-855d-89c8c9946eb6.png)

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start with the GetLargeMEM and StreamLargeMem server methods shown in the issue, then review the .NET Core 3.1 and grpc package 2.32.0 behavior for unary and server-streaming calls. Reproduce the comparison in the AKS setup using both 42 large lists and 1000 one-value lists; done means explaining the timing difference or identifying a reproducible performance problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, kubernetes
Domain
backend-api-design, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.