Configure Python gRPC Server for Compression

46 views
Skip to first unread message

asadh...@gmail.com

unread,
Feb 7, 2019, 3:14:42 AM2/7/19
to grpc.io
Has anyone does this? I cannot find any documentation or code demonstrating this. For my Python gRPC client, I use the following:

channel = grpc.insecure_channel('localhost:50051', options=[('grpc.default_compression_algorithm', 1), ('grpc.default_compression_level', CompressionLevel.high)])

How do I do the same for my Python gRPC server? Any help would be greatly appreciated. Thanks.

rbel...@google.com

unread,
Feb 13, 2019, 2:08:05 PM2/13/19
to grpc.io
Unfortunately, compression settings are not yet fully supported in Python gRPC. However, I have work queued up for this quarter to address this gap. You can track progress on this through the linked github issue.

Asad Habib

unread,
Feb 13, 2019, 4:07:24 PM2/13/19
to rbel...@google.com, grpc.io
Okay, thanks for the update. I will follow this issue via github. For the time being, what would you recommend to reduce gRPC payload sizes with Python? From Python server to client, I changed the definition of my variable from string to bytes but that didn't make any difference in payload size. Since I'm sending huge chunks of data across the wire (GBs of data), even a small difference matters. Your input would be greatly appreciated. Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "grpc.io" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grpc-io/gLOMKC3xSow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/7a396ae3-aebc-487e-b85e-e908f94070b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rbel...@google.com

unread,
Feb 13, 2019, 4:21:42 PM2/13/19
to grpc.io
In the interim, if you're not tied to Python specifically, you could use a different implementation of gRPC that fully supports compression like C++ or Java. If you really are tied to Python, then you could do the compression yourself, using a module like gzip.
Reply all
Reply to author
Forward
0 new messages