Skip to content Skip to sidebar Skip to footer

Is It Possible To Enable Grpc Message Compression In Server? (python)

I have a gRPC client (in Java) sending requests to a server (written in Python). I need to enable both request compression and response compression. There is good documentation on

Solution 1:

Compression in Python is supported via metadata arguments.

You can find an example here: https://github.com/grpc/grpc/blob/master/src/python/grpcio_tests/tests/unit/_compression_test.py

Solution 2:

To add to kpayson64's answer which covers call-level compression, you can set compression settings on a grpc.Channel or grpc.Server object upon initialization via the channel arg grpc.default_compression_algorithm.

Please also see the gRPC Compression Cookbook on recommendations on where to or not to explicitly enable compression.

Post a Comment for "Is It Possible To Enable Grpc Message Compression In Server? (python)"