Performance Impact of Enabling Binlog Compression in MySQL 8.0
The article evaluates how turning on binlog transaction compression in MySQL 8.0 (both 8.0.19 and 8.0.20) affects throughput and resource usage under a sysbench workload of 120 tables with 240 concurrent threads, showing roughly a 1% performance drop and a similar increase in CPU consumption.
This technical note investigates the performance overhead introduced by MySQL binlog transaction compression. The author previously measured that binlog compression can halve storage usage, but the current study focuses on its impact on query throughput and CPU usage.
Test environment : A single‑instance MySQL server (port 3306, max‑mem 131072) running on a physical machine. The workload uses sysbench with 120 tables, each containing 100,000 rows, and 240 concurrent threads for one hour.
Scenario 8.0.19 (no compression) :
Installation:
dbma-cli-single-instance --port=3306 --max-mem=131072 \
--pkg=mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz installCreate test user and database:
create user sysbench@'%' identified by 'sysbench';
create database tempdb;
grant all on tempdb.* to sysbench@'%';Load data and run the read‑select benchmark:
sysbench --mysql-host=192.168.100.10 --mysql-port=3306 --mysql-user=sysbench \
--mysql-password=sysbench --tables=120 --table_size=100000 \
--mysql-db=tempdb --time=3600 --threads=240 oltp_read_select prepare
sysbench --mysql-host=192.168.100.10 --mysql-port=3306 --mysql-user=sysbench \
--mysql-password=sysbench --tables=120 --table_size=100000 \
--mysql-db=tempdb --time=3600 --threads=240 oltp_read_select runResults (figures omitted) show baseline throughput and resource consumption.
Scenario 8.0.20 with binlog compression enabled :
dbma-cli-single-instance --port=3306 --max-mem=131072 \
--pkg=mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz installAfter installation, the server enables compression automatically. The global variables confirm:
show global variables like 'binlog_transaction_compression%';
+-------------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------------+-------+
| binlog_transaction_compression | ON |
| binlog_transaction_compression_level_zstd | 3 |
+-------------------------------------------+-------+Data loading and benchmark execution use the same sysbench commands as above (with oltp_point_select for the prepare phase).
Performance graphs indicate a slight degradation compared with the uncompressed case.
Scenario 8.0.20 with binlog compression disabled :
set @@global.binlog_transaction_compression='OFF';
show global variables like 'binlog_transaction_compression%';
+-------------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------------+-------+
| binlog_transaction_compression | OFF |
| binlog_transaction_compression_level_zstd | 3 |
+-------------------------------------------+-------+The same sysbench run is performed. The resulting throughput is marginally higher than the compressed run.
Conclusion : Enabling binlog transaction compression in MySQL 8.0 leads to a modest performance impact—approximately a 1% reduction in throughput and a 1% increase in CPU usage—while providing significant storage savings.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.