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.
- Download KAEzip and decompress it to the KAEzip-master directory.
- Download zlib-1.2.11.tar.gz from the official zlib website and copy it to KAEzip-master/open_source.
- Download KAE-kae1.zip to the /home directory, decompress it, and go to the kae_driver directory.
1 2
unzip KAE-kae1.zip cd KAE-kae1/kae_driver
- Create a libwd package and copy it to KAEzip-master/open_source.
1 2
tar -czvf libwd-1.0.0.tar.gz warpdrive cp libwd-1.0.0.tar.gz KAEzip-master/open_source
- Perform the compilation and installation.
1 2
cd KAEzip-master sh setup.sh install
The zlib library is installed in /usr/local/kaezip.
- 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/kaezip/lib command, /usr/local/kaezip/lib 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
Hardware accelerator queues are resources virtualized by hardware drivers. For example, after the hisi_zip driver is installed, 256 queues are virtualized by default. Each compression task to be sent to the acceleration hardware must apply for a queue in advance. If the number of concurrent tasks exceeds 256, you need to increase the number of accelerator queues. For example, change the number 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.
- Obtain the patch and save it to the /home directory.
- 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.
- 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


