11

How To Get Your Backup to Half of Its Size - Introducing ZSTD Support in Percona...

 1 year ago
source link: https://www.percona.com/blog/get-your-backup-to-half-of-its-size-introducing-zstd-support-in-percona-xtrabackup/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introducing ZSTD Support in Percona XtraBackup

ZSTD Support in Percona XtraBackupHaving a backup of your database is like insurance, you have to pay a monthly price to ensure you have a service available when you need to. When talking about backups, the storage required to keep your backups is what comes into factor when talking about price, the bigger your backup, or the bigger the retention period, the more it will cost.

Compressing your backups is a common practice to reduce this cost. Currently, Percona XtraBackup (PXB) has support for two compression algorithms: quicklz (which is an abandoned project and will soon be deprecated in PXB) and LZ4.

Today we are glad to introduce support for a new compression algorithm in Percona XtraBackup 8.0.30 – Zstandard (ZSTD).

Zstandard is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios.

Usage

A new value has been added to the xtrabackup –compress option. Passing –compress=zstd to PXB will make it use the new Zstandard algorithm to run compression.

Compression can work in parallel by adjusting –parallel=X for parallel file copy and –compress-threads=x for parallel compression of those files.

For decompression either on PXB or xbstream the usage remains the same. Users only need to pass –decompress and the tool will use the same algorithm used for compression.

Please note that as in qpress and LZ4, you will require the ZSTD client to run the –decompress operation.

Compress

Shell
xtrabackup --backup --compress=zstd --parallel=16 --compress-threads=8 --target-dir=/backup

Decompress

Shell
xtrabackup --decompress --parallel=16 --target-dir=/backup

Testing

To test how ZSTD compares with LZ4 and uncompressed backups, we set up a test environment using an AWS EC2 instance c5.4xlarge (16 CPUs and 32G of RAM ) with data and backup going to the same disk partition, an EBS IO2 with 10K provisioned IOPS SSD.

For each round of tests, we created a set of 12 tables with 40M rows resulting in a 109G dataset.

We ran five rounds of tests creating a new database with the same amount of data on each round.

Percona XtraBackup was invoked using –parallel=16 –compress-threads=8 .

Size of resulting backup (full, LZ4, and ZSTD), time to run the backup (full, LZ4, and ZSTD), and time to decompress the resulting backup (LZ4 and ZSTD).

The second round of tests explored how the two algorithms and uncompressed backups perform when uploading the data to S3. For this round, we ran two tests.

The first one was to take the backup again and upload it to S3, time to complete was measured.

The second part of the test was to download the backup from S3 and in the case of uncompressed backups, just store it on disk, and for compressed backup, we were first decompressing it and then storing it on disk.

On all tests, ZSTD compression level of one was used.

Results

ZSTD Support in Percona XtraBackup
time to decompress
Time-to-Backup.png
Time-to-Backup-Stream.png

Time-to-Download-Decompress.png

Summary

As we can see from the test results above, ZSTD not only overcame LZ4 results on all tests, but it also brought backup size to half of its original size.

When streaming is added to the mix is when we see the biggest difference between both algorithms, with ZSTD overcoming LZ4 with an even bigger margin.

This can bring users and organizations a huge amount of savings in backup storage, either on-premises or especially in the cloud – where we are charged for each GB of storage we use.

Learn more about Percona XtraBackup


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK