Rate This Document
Findability
Accuracy
Completeness
Readability

Using KAE to Accelerate Nginx

This section describes how to enable Nginx acceleration using KAE in web scenarios.

Environment Requirements

Table 1 and Table 2 list the environment requirements. You can also refer to this section to verify Nginx and OSs of other versions.

Table 1 Hardware requirement

Item

Description

CPU

Kunpeng 920 7260

Table 2 OS and software requirements

Item

Version

OS

openEuler 20.03 LTS SP1/SP2

Nginx

1.14.2

OpenSSL

1.1.1x/3.0.12

httpress

1.1.0

Prerequisites

  1. Install Nginx by compiling the source code and configure the HTTPS function of Nginx. For details, see Nginx Porting Guide.

    The performance data varies with algorithm suites. You can choose an algorithm suite based on your requirements. If an algorithm in the algorithm suite is not supported by KAE, the OpenSSL software computing interface is invoked.

  2. Install and verify httpress by compiling the source code. For details, see httpress Test Guide.

Using Software Computing to Test Nginx Performance

  1. Start Nginx.
    1
    2
    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ps -ef | grep nginx
    
  2. Test the software computing performance, that is, the performance data when KAE is not used. (500,000 requests, 100 concurrent connections, and 100 threads are used as an example.)
    1
    ./httpress -n 500000 -c 100 -t 100 https://127.0.0.1:20000/index.html
    

Using Hardware Computing to Test Nginx Performance

  1. Install and verify KAE. For details, see Kunpeng Accelerator Engine User Guide.
  2. Quit Nginx.
    1
    2
    /usr/local/nginx/sbin/nginx -s quit
    ps -ef | grep nginx
    
  3. Ensure that OpenSSL can invoke the configuration file using OPENSSL_CONF and identify KAE. For details, see "Using KAE Through the OpenSSL/Tongsuo Configuration File" in Kunpeng Accelerator Engine User Guide.
  4. Start Nginx.
    1
    2
    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ps -ef | grep nginx
    
  5. Test the hardware computing performance, that is, the performance data when KAE is used. (500,000 requests, 100 concurrent connections, and 100 threads are used as an example.)
    1
    ./httpress -n 500000 -c 100 -t 100 https://127.0.0.1:20000/index.html
    

    During the test, open a new terminal and run the cat /sys/class/uacce/hisi_hpre-*/attrs/available_instances command. The command output changes from 256 to 255, indicating that a hardware queue has been consumed. After the test is complete, the value is restored to 256. This indicates that KAE has taken effect.

    If KAE has taken effect, that is, hardware computing is enabled, the performance data does not increase significantly, and the value of available_instances does not change, check whether the preceding steps are properly performed. If Nginx and KAE are normal, the OPENSSL_CONF configuration file may be incorrect, or its permission is incorrect. You can contact Huawei technical support to solve this problem.

Data Comparison

According to the preceding test results, the software computing performance is 6,939 requests per second, and the hardware computing performance is 12,262 requests per second. After KAE acceleration is used, the performance is significantly improved.