Simple comparison between the compression software gzip and xz
Due to the need to handle disk alarms, logs are compressed. In this compression, gzip and xz software are used respectively to compress the text. The compression results are very surprising.
The objects in the delimiter format are smaller. First, let's briefly introduce gzip and xz:
Gzip: GZIP was first created by Jean-loup Gailly and Mark Adler for File compression in the un ix system. We often use files suffixed with .gz in linux, which are in GZIP format. Nowadays, it has become a widely used data compression format on the Internet, or a file format.
Xz: xz is a compressed file format. The target file is 30% smaller than the gzipcompressed file (.gz or · tgz) and 15% smaller than the bz2.
Due to the limited disk space, we use the-9 parameter for compression. The highest compression ratio of each compression is used. The fame and fortune are as follows:
Gzip: gzip-9-c source_filename> source_filename.gz
Xz: xz-9-c source_filename> source_filename.xz
Shows the final test result:
It can be seen that the source file iqas-2015-07-28 size is 35G, after gzip compression, the final file is 4.6G size, the compression ratio is about, this is a good result, but let's take a look at the size of the file compressed by xz is 401 MB, which is an order of magnitude smaller than that of gzip. The compression ratio is close to 1: 90, this saves a lot of space for text storage. However, it should be noted that the 9-level compression of xz is very time-consuming and memory-consuming. If the time and memory are sufficient, you can consider this method. If the time and memory are tight, we recommend that you use gzip.
This article permanently updates the link address: