KAE zlib Compression Tuning
- Purpose
Optimize zlib compression to maximize the CPU capability of processing OSD processes and maximize the hardware performance.
- Procedure
Enable the hardware acceleration engine to implement zlib compression.
Preparing the Environment
Download the acceleration engine installation package and developer guide.
Installing the Acceleration Engine
- Install the acceleration engine according to the developer guide.
- Install the zlib library.
- Replace the zlib software compression algorithm dynamic library.
1 2 3 4
cd /usr/local/kaezip/lib cp libz.so.1.2.11 /lib64/ mv /lib64/libz.so.1 /lib64/libz.so.1-bak ln -s /lib64/libz.so.1.2.11 /lib64/libz.so.1
In the cd /usr/local/zlib command, /usr/local/zlib indicates the zlib installation path. Change it as required.
If the Ceph cluster is running before the dynamic library is replaced, run the following command on all storage nodes to restart the OSDs for the change to take effect after the dynamic library is replaced:
1
|
systemctl restart ceph-osd.target |
Changing the Default Number of Accelerator Queues
The default number of queues of the hardware accelerator is 256. To fully utilize the performance of the accelerator, change the number of queues to 512 or 1024.
- Remove hisi_zip.
1rmmod hisi_zip - Set the default accelerator queue parameter pf_q_num=512.
1vim /etc/modprobe.d/hisi_zip.conf1options hisi_zip uacce_mode=2 pf_q_num=512
- Load hisi_zip.
1modprobe hisi_zip - Check the hardware accelerator queue.
1cat /sys/class/uacce/hisi_zip-*/attrs/available_instancesThe change is successful if the following information is displayed.

- Check the dynamic library links. If libwd.so.1 is contained in the command output, the operation is successful.
1ldd /lib64/libz.so.1
Adapting Ceph to the Accelerator
Currently, the mainline Ceph versions allow configuring the zlib compression mode using the configuration file. The released Ceph versions (by version 15.2.3) adopt the zlib compression mode without data headers or trailers. However, the current hardware acceleration library supports only the mode with data headers and trailers. Therefore, the Ceph source code needs to be modified to adapt to the Kunpeng hardware acceleration library. For details about the modification method, see the latest patch that has been incorporated into the mainline versions.
https://github.com/ceph/ceph/pull/34852
The following uses Ceph 14.2.8 as an example to describe how to adapt Ceph to the zlib compression engine.
- Obtain the source code.
https://download.ceph.com/tarballs/

After the source package is downloaded, save it to the /home directory on the server.
- Obtain the patch and save it to the /home directory.
https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/storage/Patch/

- Go to the /home directory, decompress the source package and go to the directory generated after decompression.
1cd /home && tar -zxvf ceph-14.2.8.tar.gz && cd ceph-14.2.8/
- Apply the patch in the source code directory.
1patch -p1 < ../ceph-14.2.8-zlib-compress.patch
- After modifying the source code, compile Ceph.
For details about the compilation procedure, see Ceph 14.2.8 Compilation Guide (CentOS 7.6 & openEuler 20.03 & openEuler 22.03).
- Install Ceph.
- Modify the ceph.conf file to configure the zlib compression mode.
1vi /etc/ceph/ceph.confcompressor_zlib_winsize=15
- Modify the systemd permissions. In Ceph, the RGW process service is managed by systemd. To enable systemd to access hardware acceleration devices, you need to modify the configuration on each RGW node as follows:
- Open the configuration file.
1vi /usr/lib/systemd/system/ceph-radosgw@.serviceChange PrivateDevices=yes to PrivateDevices=no.
- Make the modification take effect.
1systemctl daemon-reload
- Open the configuration file.
- Restart the Ceph cluster for the configuration to take effect.
1ceph daemon osd.0 config show|grep compressor_zlib_winsize
