我要评分
获取效率
正确性
完整性
易理解

Installing and Enabling the Feature

To enable the network asynchronization feature on Redis, install the related dependency libraries, compile the SO file, and apply the patch. This section uses Redis 7.0.15 as an example.

  1. Download the required dependencies.
    1
    yum -y install wget git vim tar make gcc gcc-c++ libatomic texinfo libtool
    
  2. Install the liburing.a library.
    1
    2
    3
    4
    5
    6
    git clone https://gitee.com/src-openeuler/liburing.git
    cd liburing
    tar -zxvf liburing-2.4.tar.gz
    cd liburing-2.4
    make -j
    make install
    
  3. Install the libconfig library.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    git clone https://gitee.com/src-openeuler/libconfig.git
    cd libconfig
    tar -zxvf v1.8.1.tar.gz
    cd libconfig-1.8.1
    autoreconf --install --force
    ./configure --prefix=/usr/local
    make -j
    make install
    cp /usr/local/lib/libconfig.so.15 /usr/lib64
    
  4. Download the patch package of the network asynchronization feature for Redis 7.0.15 as instructed in Table 2.
  5. Download the KRAIO library and decompress the package.
  6. Create a /etc/kraio folder and copy the kraio.conf file in kraio to /etc/kraio.
    1
    2
    3
    cd kraio
    mkdir /etc/kraio 
    cp conf/kraio.conf /etc/kraio
    
  7. Place the downloaded SO file and kraio.h file in the corresponding paths and configure environment variables.
    1
    2
    3
    4
    cp ./libkraio/libkraio.so /usr/lib64 
    cp ./include/kraio.h /usr/include
    export PATH=/usr/local/include:$PATH 
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/lib
    
  8. Move the redis-7.0.15-adapt-iouring.patch file in Redis to the Redis source code directory and apply the patch.

    Redis 7.0.15 is used as an example. For Redis 6.0.20, move the redis-6.0.20-adapt-iouring.patch file to the Redis source code directory and apply the patch. In the subsequent operations, replace the version number in commands.

    1
    2
    3
    4
    5
    git clone https://gitcode.com/BoostKit/Redis.git
    cd Redis
    cp redis-7.0.15-adapt-iouring.patch path/redis-7.0.15/
    cd path/redis-7.0.15
    patch -p1 < redis-7.0.15-adapt-iouring.patch
    
  9. Recompile Redis.
    1
    2
    3
    cd path/redis-7.0.15
    make distclean
    make -j
    
  10. Modify the /etc/kraio/kraio.conf file.
    1. Go to /etc/kraio.
      cd /etc/kraio
    2. Open the kraio.conf file.
      vim kraio.conf
    3. Press i to enter the insert mode and make the following changes: send_callback=1, zero_copy=1, and log_level=3.

    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. During the testing, run the following command on the server. If any iou-sqp-* thread is displayed, the feature is successfully enabled.
    1
    top -Hp <redis-server Instance pid>