pjfanning opened a new issue, #925:
URL: https://github.com/apache/pekko-grpc/issues/925

   Support `zstd` as a gRPC message encoding (`grpc-encoding: zstd`) alongside 
`gzip`. zstd usually gives a better compression ratio than gzip and is much 
faster, especially when decompressing.
   
   Related work:
   - pekko-http: apache/pekko-http#860 (zstd `Content-Encoding` for HTTP 
requests/responses) and apache/pekko-http#997 (plugin support for custom 
compression such as zstd).
   - pekko: apache/pekko#2404, and apache/pekko#3639 (merged), which adds zstd 
compression/decompression to pekko-stream, backed by an **optional** zstd-jni 
dependency.
   
   gRPC message compression works per message frame (the `Codec`s in 
`org.apache.pekko.grpc.internal`). It doesn't go through pekko-http's 
`Content-Encoding` support, so this doesn't depend on pekko-http#860. It should 
stay consistent with how pekko and pekko-http handle zstd, though (dependency, 
codec name, configuration).
   
   Proposal:
   - A `Zstd` codec beside `Gzip`, backed by zstd-jni. Either reuse 
pekko-stream's zstd support or call zstd-jni directly for per-message 
compression.
   - Make zstd-jni an optional dependency, as pekko-stream does: the codec is 
only offered (in `Codecs.supportedCodecs` and in negotiation) when zstd-jni is 
on the classpath, and gzip/identity users don't load the native library.
   - Decompression must respect `max-inbound-message-size`, as gzip does, so a 
zstd decompression bomb is rejected with `RESOURCE_EXHAUSTED`.
   - zstd isn't built into grpc-java or grpc-go, so interop needs a peer that 
registers a zstd codec. Tests should cover round trips, a grpc-java peer with a 
zstd `Compressor`/`Decompressor` registered, and the inbound size limit.
   - Document the optional dependency and the configuration.
   
   Related: client-side request compression #923, deflate #924.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to