Use UnsafeBoundedQueue and avoid dispatcher
Leverage https://github.com/typelevel/cats-effect/pull/3975 (released with CE 3.6.0) to remove some dispatcher calls.
It seems to work, but I was hoping to measure the actual impact with benchmarks before submitting a PR.
@seigert I'd love to run the benchmarks you mentioned here, could you do it or share the setup? I think instructions to bench the client side of fs2-grpc are sorely missing.
@fredfp, I cannot push my test client/server right now as it uses our internal libraries for configuration, starup and stuff. But I'll try to cut them out in a few days and upload it to github.
Basically, it is just simple metrics for request/response times over server and client implementation of this gRPC API:
syntax = "proto3";
package fs2.grpc.bench;
service TestService {
rpc Identity (Message) returns (Message);
rpc IdentityStream (stream Message) returns (stream Message);
rpc Unary (UnaryRequest) returns (Message);
rpc ClientStreaming (stream UnaryRequest) returns (Message);
rpc ServerStreaming (StreamingRequest) returns (stream Message);
rpc BothStreaming (stream StreamingRequest) returns (stream Message);
}
message Message {
bytes payload = 1;
}
message RequestParams {
int32 length = 1;
bool random_length = 2;
optional double random_factor_min = 3;
optional double random_factor_max = 4;
}
message UnaryRequest {
RequestParams params = 1;
}
message StreamingRequest {
RequestParams stream_params = 1;
RequestParams chunk_params = 2;
RequestParams message_params = 3;
}
Server implementation receives request and either
- sends its back in case of
Message; - generates simngle message defined by
UnaryRequest.RequestParams(lengthis payload length, random bytes); - generates number of messages defined by
StreamingRequest(RequestParamsdefine number of total messages in a stream, messages in a single chunk, length of single payload).
@fredfp, I've published our benchmark setup here: https://github.com/seigert/fs2-grpc-bench