Closed lysu closed 3 years ago
Can you provide a minimal reproduce example? Server won't compress response if the compression algorithm is not supported.
yes, we could use
https://github.com/lysu/grpc-go/blob/dev-test/examples/helloworld/greeter_client/main.go
as client...
and
as server..
and check server response by set breakpoint on google.golang.org/grpc.recvAndDecompress at rpc_util.go:703, and watch pf
var:
if server is rust, pf
will be compressionNone... but compressionMade if we use go version https://github.com/lysu/grpc-go/blob/1ddc040f5c6c061b33331a50d6d08337e4a3e964/examples/helloworld/greeter_server/main.go
I also try to .default_compression_algorithm(CompressionAlgorithms::GRPC_COMPRESS_GZIP)
in rust example, but it's still compressionNone
After commenting following line, the official cpp version of compression example also doesn't compress the response:
https://github.com/grpc/grpc/blob/master/examples/cpp/compression/greeter_server.cc#L44
It seems one has to set the compression type in server side to make it work. The cookbook https://github.com/grpc/grpc/blob/master/doc/compression_cookbook.md also doesn't have a clear statement that server response will use the same compression algorithm as client. The only one clear rule I can find is from go-grpc's documentation, which is a different implementation.
https://github.com/grpc/grpc-go/blob/master/Documentation/compression.md#server-side
tidb will use grpc to communicate with both tikv and other tidb.
when investigating an issue we found that only tidb->tidb got empty result due to https://github.com/grpc/grpc-go/issues/4552
but tikv works well, after more investigation it seems tikv server doesn't give a compressed response like grpc-go does, grpc-go seems response compressed data when client seen compressed data even if it doesn't enable compress in server-side.
I'm not sure is it a problem, ptal~