1*85da4cbeSYuan Liu================== 2*85da4cbeSYuan LiuQATzip Compression 3*85da4cbeSYuan Liu================== 4*85da4cbeSYuan LiuIn scenarios with limited network bandwidth, the ``QATzip`` solution can help 5*85da4cbeSYuan Liuusers save a lot of host CPU resources by accelerating compression and 6*85da4cbeSYuan Liudecompression through the Intel QuickAssist Technology(``QAT``) hardware. 7*85da4cbeSYuan Liu 8*85da4cbeSYuan Liu 9*85da4cbeSYuan LiuThe following test was conducted using 8 multifd channels and 10Gbps network 10*85da4cbeSYuan Liubandwidth. The results show that, compared to zstd, ``QATzip`` significantly 11*85da4cbeSYuan Liusaves CPU resources on the sender and reduces migration time. Compared to the 12*85da4cbeSYuan Liuuncompressed solution, ``QATzip`` greatly improves the dirty page processing 13*85da4cbeSYuan Liucapability, indicated by the Pages per Second metric, and also reduces the 14*85da4cbeSYuan Liutotal migration time. 15*85da4cbeSYuan Liu 16*85da4cbeSYuan Liu:: 17*85da4cbeSYuan Liu 18*85da4cbeSYuan Liu VM Configuration: 16 vCPU and 64G memory 19*85da4cbeSYuan Liu VM Workload: all vCPUs are idle and 54G memory is filled with Silesia data. 20*85da4cbeSYuan Liu QAT Devices: 4 21*85da4cbeSYuan Liu |-----------|--------|---------|----------|----------|------|------| 22*85da4cbeSYuan Liu |8 Channels |Total |down |throughput|pages per | send | recv | 23*85da4cbeSYuan Liu | |time(ms)|time(ms) |(mbps) |second | cpu %| cpu% | 24*85da4cbeSYuan Liu |-----------|--------|---------|----------|----------|------|------| 25*85da4cbeSYuan Liu |qatzip | 16630| 28| 10467| 2940235| 160| 360| 26*85da4cbeSYuan Liu |-----------|--------|---------|----------|----------|------|------| 27*85da4cbeSYuan Liu |zstd | 20165| 24| 8579| 2391465| 810| 340| 28*85da4cbeSYuan Liu |-----------|--------|---------|----------|----------|------|------| 29*85da4cbeSYuan Liu |none | 46063| 40| 10848| 330240| 45| 85| 30*85da4cbeSYuan Liu |-----------|--------|---------|----------|----------|------|------| 31*85da4cbeSYuan Liu 32*85da4cbeSYuan Liu 33*85da4cbeSYuan LiuQATzip Compression Framework 34*85da4cbeSYuan Liu============================ 35*85da4cbeSYuan Liu 36*85da4cbeSYuan Liu``QATzip`` is a user space library which builds on top of the Intel QuickAssist 37*85da4cbeSYuan LiuTechnology to provide extended accelerated compression and decompression 38*85da4cbeSYuan Liuservices. 39*85da4cbeSYuan Liu 40*85da4cbeSYuan LiuFor more ``QATzip`` introduction, please refer to `QATzip Introduction 41*85da4cbeSYuan Liu<https://github.com/intel/QATzip?tab=readme-ov-file#introductionl>`_ 42*85da4cbeSYuan Liu 43*85da4cbeSYuan Liu:: 44*85da4cbeSYuan Liu 45*85da4cbeSYuan Liu +----------------+ 46*85da4cbeSYuan Liu | MultiFd Thread | 47*85da4cbeSYuan Liu +-------+--------+ 48*85da4cbeSYuan Liu | 49*85da4cbeSYuan Liu | compress/decompress 50*85da4cbeSYuan Liu +-------+--------+ 51*85da4cbeSYuan Liu | QATzip library | 52*85da4cbeSYuan Liu +-------+--------+ 53*85da4cbeSYuan Liu | 54*85da4cbeSYuan Liu +-------+--------+ 55*85da4cbeSYuan Liu | QAT library | 56*85da4cbeSYuan Liu +-------+--------+ 57*85da4cbeSYuan Liu | user space 58*85da4cbeSYuan Liu --------+--------------------- 59*85da4cbeSYuan Liu | kernel space 60*85da4cbeSYuan Liu +------+-------+ 61*85da4cbeSYuan Liu | QAT Driver | 62*85da4cbeSYuan Liu +------+-------+ 63*85da4cbeSYuan Liu | 64*85da4cbeSYuan Liu +------+-------+ 65*85da4cbeSYuan Liu | QAT Devices | 66*85da4cbeSYuan Liu +--------------+ 67*85da4cbeSYuan Liu 68*85da4cbeSYuan Liu 69*85da4cbeSYuan LiuQATzip Installation 70*85da4cbeSYuan Liu------------------- 71*85da4cbeSYuan Liu 72*85da4cbeSYuan LiuThe ``QATzip`` installation package has been integrated into some Linux 73*85da4cbeSYuan Liudistributions and can be installed directly. For example, the Ubuntu Server 74*85da4cbeSYuan Liu24.04 LTS system can be installed using below command 75*85da4cbeSYuan Liu 76*85da4cbeSYuan Liu.. code-block:: shell 77*85da4cbeSYuan Liu 78*85da4cbeSYuan Liu #apt search qatzip 79*85da4cbeSYuan Liu libqatzip-dev/noble 1.2.0-0ubuntu3 amd64 80*85da4cbeSYuan Liu Intel QuickAssist user space library development files 81*85da4cbeSYuan Liu 82*85da4cbeSYuan Liu libqatzip3/noble 1.2.0-0ubuntu3 amd64 83*85da4cbeSYuan Liu Intel QuickAssist user space library 84*85da4cbeSYuan Liu 85*85da4cbeSYuan Liu qatzip/noble,now 1.2.0-0ubuntu3 amd64 [installed] 86*85da4cbeSYuan Liu Compression user-space tool for Intel QuickAssist Technology 87*85da4cbeSYuan Liu 88*85da4cbeSYuan Liu #sudo apt install libqatzip-dev libqatzip3 qatzip 89*85da4cbeSYuan Liu 90*85da4cbeSYuan LiuIf your system does not support the ``QATzip`` installation package, you can 91*85da4cbeSYuan Liuuse the source code to build and install, please refer to `QATzip source code installation 92*85da4cbeSYuan Liu<https://github.com/intel/QATzip?tab=readme-ov-file#build-intel-quickassist-technology-driver>`_ 93*85da4cbeSYuan Liu 94*85da4cbeSYuan LiuQAT Hardware Deployment 95*85da4cbeSYuan Liu----------------------- 96*85da4cbeSYuan Liu 97*85da4cbeSYuan Liu``QAT`` supports physical functions(PFs) and virtual functions(VFs) for 98*85da4cbeSYuan Liudeployment, and users can configure ``QAT`` resources for migration according 99*85da4cbeSYuan Liuto actual needs. For more details about ``QAT`` deployment, please refer to 100*85da4cbeSYuan Liu`Intel QuickAssist Technology Documentation 101*85da4cbeSYuan Liu<https://intel.github.io/quickassist/index.html>`_ 102*85da4cbeSYuan Liu 103*85da4cbeSYuan LiuFor more ``QAT`` hardware introduction, please refer to `intel-quick-assist-technology-overview 104*85da4cbeSYuan Liu<https://www.intel.com/content/www/us/en/architecture-and-technology/intel-quick-assist-technology-overview.html>`_ 105*85da4cbeSYuan Liu 106*85da4cbeSYuan LiuHow To Use QATzip Compression 107*85da4cbeSYuan Liu============================= 108*85da4cbeSYuan Liu 109*85da4cbeSYuan Liu1 - Install ``QATzip`` library 110*85da4cbeSYuan Liu 111*85da4cbeSYuan Liu2 - Build ``QEMU`` with ``--enable-qatzip`` parameter 112*85da4cbeSYuan Liu 113*85da4cbeSYuan Liu E.g. configure --target-list=x86_64-softmmu --enable-kvm ``--enable-qatzip`` 114*85da4cbeSYuan Liu 115*85da4cbeSYuan Liu3 - Set ``migrate_set_parameter multifd-compression qatzip`` 116*85da4cbeSYuan Liu 117*85da4cbeSYuan Liu4 - Set ``migrate_set_parameter multifd-qatzip-level comp_level``, the default 118*85da4cbeSYuan Liucomp_level value is 1, and it supports levels from 1 to 9 119*85da4cbeSYuan Liu 120*85da4cbeSYuan LiuQAT Memory Requirements 121*85da4cbeSYuan Liu======================= 122*85da4cbeSYuan Liu 123*85da4cbeSYuan LiuThe user needs to reserve system memory for the QAT memory management to 124*85da4cbeSYuan Liuallocate DMA memory. The size of the reserved system memory depends on the 125*85da4cbeSYuan Liunumber of devices used for migration and the number of multifd channels. 126*85da4cbeSYuan Liu 127*85da4cbeSYuan LiuBecause memory usage depends on QAT configuration, please refer to `QAT Memory 128*85da4cbeSYuan LiuDriver Queries 129*85da4cbeSYuan Liu<https://intel.github.io/quickassist/PG/infrastructure_debugability.html?highlight=memory>`_ 130*85da4cbeSYuan Liufor memory usage calculation. 131*85da4cbeSYuan Liu 132*85da4cbeSYuan Liu.. list-table:: An example of a PF used for migration 133*85da4cbeSYuan Liu :header-rows: 1 134*85da4cbeSYuan Liu 135*85da4cbeSYuan Liu * - Number of channels 136*85da4cbeSYuan Liu - Sender memory usage 137*85da4cbeSYuan Liu - Receiver memory usage 138*85da4cbeSYuan Liu * - 2 139*85da4cbeSYuan Liu - 10M 140*85da4cbeSYuan Liu - 10M 141*85da4cbeSYuan Liu * - 4 142*85da4cbeSYuan Liu - 12M 143*85da4cbeSYuan Liu - 14M 144*85da4cbeSYuan Liu * - 8 145*85da4cbeSYuan Liu - 16M 146*85da4cbeSYuan Liu - 20M 147*85da4cbeSYuan Liu 148*85da4cbeSYuan LiuHow To Choose Between QATzip and QPL 149*85da4cbeSYuan Liu==================================== 150*85da4cbeSYuan LiuStarting from 4th Gen Intel Xeon Scalable processors, codenamed Sapphire Rapids 151*85da4cbeSYuan Liuprocessor(``SPR``), multiple built-in accelerators are supported including 152*85da4cbeSYuan Liu``QAT`` and ``IAA``. The former can accelerate ``QATzip`` and the latter is 153*85da4cbeSYuan Liuused to accelerate ``QPL``. 154*85da4cbeSYuan Liu 155*85da4cbeSYuan LiuHere are some suggestions: 156*85da4cbeSYuan Liu 157*85da4cbeSYuan Liu1 - If the live migration scenario is limited by network bandwidth and ``QAT`` 158*85da4cbeSYuan Liuhardware resources exceed ``IAA``, use the ``QATzip`` method, which can save a 159*85da4cbeSYuan Liulot of host CPU resources for compression. 160*85da4cbeSYuan Liu 161*85da4cbeSYuan Liu2 - If the system cannot support shared virtual memory (SVM) technology, use 162*85da4cbeSYuan Liuthe ``QATzip`` method because ``QPL`` performance is not good without SVM 163*85da4cbeSYuan Liusupport. 164*85da4cbeSYuan Liu 165*85da4cbeSYuan Liu3 - For other scenarios, use the ``QPL`` method first. 166