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

The verification data in this case is obtained in the following environment. You can also refer to this section to verify Nginx and OSs of other versions.

KAE supports only Nginx+OpenSSL 1.1.1x. Other scenarios such as Nginx+OpenSSL 3.0.x are not supported currently.

  • CPU: Kunpeng 920 7260 processor
  • OS: openEuler 20.03 LTS SP1
  • Nginx version: 1.14.2
  • OpenSSL: 1.1.1x
  • httpress version: 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. In this example, 100 connections, 500,000 requests, and 100 threads are used.
    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 KAE and verify the installation by referring to Introduction.
  2. Quit Nginx.
    1
    2
    /usr/local/nginx/sbin/nginx -s quit
    ps -ef | grep nginx
    
  3. Use KAE through the OpenSSL configuration file openssl.cnf. For details, see Using KAE Through the OpenSSL/Tongsuo Configuration File. The purpose is to ensure that OpenSSL can invoke the configuration file through OPENSSL_CONF and identify KAE.
  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.
    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.

The performance data varies with algorithm suites. The test result of the algorithm suite you use may be different.