blackbeam / mysql_async

Asyncronous Rust Mysql driver based on Tokio.
Apache License 2.0
377 stars 114 forks source link

add support for connection compression-algorithms #280

Open i18nsite opened 9 months ago

i18nsite commented 9 months ago

https://aws.amazon.com/cn/blogs/database/reduce-network-transfer-time-with-connection-compression-in-amazon-rds-for-mysql-and-amazon-rds-for-mariadb/

The --compress command line option that was available with earlier versions of MySQL client tools has been deprecated as of MySQL 8.0.18. With MySQL client versions prior to 8.0.18, the client supports only the zlib compression algorithm, in addition to uncompressed connections. You cannot specify a compression algorithm or the compression level with this option, so we recommend upgrading to the latest client driver to take advantage of compression.

To set up the connection, both the client and the database server must agree on a mutually permitted compression algorithm. Since Amazon RDS for MySQL supports all 3 compression options, the client can choose any algorithm. Therefore, if you specify multiple options with --compression-algorithms, the first compression algorithm supported by the database server gets picked. For example, if --compression-algorithms=zlib,zstd, then the zlib compression algorithm is picked. If the database server doesn’t support the zlib compression algorithm (which isn’t the case with Amazon RDS for MySQL), then the zstd compression algorithm is picked.

blackbeam commented 9 months ago

Hi.

Please note that zlib is supported (just in case you missed it). Zstd is not yet implemented – blackbeam/rust_mysql_common#38. As you can see it is in backlog since 2021, so PRs are much appreciated.