Grpc transfer big data, one unary call is slower than streaming.
- 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

Thanks.
Contributor 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