[Question] Using grpc compression weirdly leads to low throughput
dentiny opened this issue · comments
I have a service using grpc to stream data to client-side.
For the original implementation, the average throughput could be ~110MBps with a 1Gbps NIC, so I think bandwidth itself is a bottleneck. The usual way is to enable compression/decompression.
I found grpc supports compression natively. The only line of code I added at server side is
builder.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_LOW);
with no change at client-side. But the throughput drops stably.
With dstat -n
, the throughput looks like
33M 121k
2948B 1756B
306B 166B
3026B 688B
which looks like the average throughput is 7MBps.
And with response.ByteSize()
, I calculated the throughput is ~11MBps, still way below the one before compression.
The observation doesn't change as the compression level, whether it's low, medium or high.
I want to know, if I'm using the compression in grpc wrongly?
I answered this on the grpc.io mailing list.