Skip to content

Commit

Permalink
chore: Benchmark note for ServerStreaming
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed Oct 30, 2024
1 parent 94d34e1 commit a13a135
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ public ValueTask PrepareAsync(GrpcChannel channel)
return ValueTask.CompletedTask;
}

// Follow what the grpc-dotnet benchmark does, but this ServerStreaming benchmark seems meaningless as MoveNext may concatenate multiple responses from the server.
// So most times MoveNext won't wait at all, and it may wait occasionally.
public async ValueTask RunAsync(int connectionId, PerformanceTestRunningContext ctx, CancellationToken cancellationToken)
{
var stream = await client.ServerStreamingAsync();
while(!cancellationToken.IsCancellationRequested)
{
ctx.Increment();
var begin = timeProvider.GetTimestamp();
//_ = stream.ResponseStream.Current;
await stream.ResponseStream.MoveNext(cancellationToken);
ctx.Latency(connectionId, timeProvider.GetElapsedTime(begin));
}
Expand Down

0 comments on commit a13a135

Please sign in to comment.