Skip to main content

Posts

Showing posts from 2023

Notes on Compression in the MySQL Protocol

The MySQL Protocol is the network protocol that is used between a MySQL server and a client. This is called the “classic” protocol as there is now a newer protobuf based protocol called X Protocol . However the “classic” protocol is used by many database drivers, applications, etc. and also by MySQL Replication. The MySQL Protocol has the option to compress network traffic. Most client libraries don’t enable this by default as this increases CPU usage. Some history Initially this was added in MySQL 3.22 (based on historical release notes) and was based on zlib . Then in MySQL 8.0.18 a second compression algorithm, Zstandard , was added based on a contribution by Facebook . So zlib has been there basically forever and Zstandard support is new-ish (8.0.18 was released in October 2019). Why you might want to use compression. There are multiple usecases that are often mentioned when talking about the compressed protocol. The first one is slow connections. This could, for example, ...