目录
1 概述
浪潮信息KOS是浪潮信息基于Linux Kernel、OpenAnolis等开源技术自主研发的一款服务器操作系统,支持x86、ARM等主流架构处理器,性能和稳定性居于行业领先地位,具备成熟的 CentOS 迁移和替换能力,可满足云计算、大数据、分布式存储、人工智能、边缘计算等应用场景需求。详细介绍见官网链接https://www.ieisystem.com/kos/product-kos-xq.thtml?id=12126
lzbench是开源LZ77/LZSS/LZMA压缩器的内存基准测试。它将所有压缩器连接到一个exe中。在开始时,一个输入文件被读取到内存中。然后使用所有压缩器对文件进行压缩和解压缩,并验证解压缩后的文件。这种方法有一个很大的优点,即对所有压缩器使用相同的编译器和相同的优化;下载地址:https://gitee.com/yossi/lzbench/tree/v1.8.1
2 安装准备
2.1 操作环境
操作系统版本:KOS 5.8 sp2u1(5.10.134-17.2.2.kos5.x86_64)
测试架构:x86_64,8核4G虚拟机
2.2 软件版本
Lzbench 1.8.1
3 编译安装
Linux系统化下直接在lzbench源码的根目录下直接make,生成二进制文件即可
4 执行测试
测试场景
根据官网https://gitee.com/kun-llfl/lzbench/tree/v1.8.1/#usage的介绍,测试可以有很多种场景,官方示例的四种测试场景,用单个文件作为测试对象,测试过程如下。
新建测试文件大小同官网默认的数据大小,fallocate -l 1747626 lztest,测试以下四种场景:
lzbench -ezstd filename = lztest# selects all levels of zstd
lzbench -ebrotli,2,5/zstd filename = lztest#selects levels 2 & 5 of brotli and zstd
lzbench -t3 -u5 fname = lztest #3 sec compression and 5 sec decompression loops
lzbench -t0 -u0 -i3 -j5 -ezstd fname = lztest #compression and 5 decompression iter.
lzbench -t0u0i3j5 -ezstd fname = lztest#the same as above with aggregated parameters
测试结果如下:
我们参照官网,使用-t16,16 -eall 参数来作为测试参数,基本涵盖所有压缩器,测试目录和文件两种场景,命令略微不同,测试目录要加-r参数;测试两种文件类型:目录和文件,结我们选测试目录的场景,测试命令:lzbench -v -o4 -e$Algo $test_file 其中$Algo取(lz4、zstd、xz、bzip2)四种场景。
参数含义
usage: lzbench [options] input [input2] [input3]
where [input] is a file or a directory and [options] are:
-b# set block/chunk size to # KB (default = MIN(filesize,1747626 KB))
-c# sort results by column # (1=algname, 2=ctime, 3=dtime, 4=comprsize)
-e# #=compressors separated by '/' with parameters specified after ',' (deflt=fast)
-iX,Y set min. number of compression and decompression iterations (default = 1, 1)
-j join files in memory but compress them independently (for many small files)
-l list of available compressors and aliases
-m# set memory limit to # MB (default = no limit)
-o# output text format 1=Markdown, 2=text, 3=text+origSize, 4=CSV (default = 2)
-p# print time for all iterations: 1=fastest 2=average 3=median (default = 1)
-r operate recursively on directories
-s# use only compressors with compression speed over # MB (default = 0 MB)
-tX,Y set min. time in seconds for compression and decompression (default = 1, 2)
-v disable progress information
-x disable real-time process priority
-z show (de)compression times instead of speed
最佳实践
测试结果数值跟文件夹大小相关,基本上不需要调整,压缩和解压缩效率的结果极大概率跟操作系统正相关