asyncer-io / r2dbc-mysql

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
https://r2dbc.io
Apache License 2.0
184 stars 18 forks source link

[feature] Compression protocol support #216

Closed mirromutth closed 5 months ago

mirromutth commented 5 months ago

Is your feature request related to a problem? Please describe.

Add support for compression protocol.

Capability flags:

Enabling compression decreases performance, so its benefits occur primarily when there is low network bandwidth, network transfer time dominates the cost of compression and decompression operations, and result sets are large.

Describe the solution you'd like

Add an option compressionAlgorithms, with default value UNCOMPRESSED, which auto selects the compression algorithm, prefer Z-standard.

Add compression packet codec before MessageDuplexCodec/EnvelopeSlicer if compression protocol is enabled.

Additional context

See also MySQL and MariaDB docs.

Netty does not have a ZstdDecoder yet, see also PR netty/netty#13531. Use zstd-jni instead, which is also used by ZstdEncoder. This dependency should be optional.