(仅针对使用鲲鹏920 7280Z处理器的服务器)KAE软硬结合对加解密功能的性能调优
在整机单实例且ssl_session_cache和ssl_session_tickets为off的情况下,使能KAE后,进行Https短连接测试时,由于KAE的RSA加解密性能存在限制,测试结果可能不理想。为了提升整机性能,可以采用软硬结合的策略。
- 创建并配置OpenSSL配置文件,使Nginx可以使用KAE。
- 创建文件openssl.cnf。
1
vi openssl.cnf
- 按“i”进入编辑模式,在配置文件openssl.cnf添加以下内容后,将openssl.cnf放在“/home”目录下。
openssl_conf=openssl_def [openssl_def] engines=engine_section [engine_section] kae=kae_section [kae_section] engine_id=kae dynamic_path=/usr/local/lib/engines-1.1/kae.so default_algorithms=ALL init=1
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 使能KAE。
1
export OPENSSL_CONF=/home/openssl.cnf
- 创建文件openssl.cnf。
- 在启动Nginx之前,通过设置环境变量KAE_GO_SOFT_RATIO来指定RSA加解密软件算法处理的比例(该比例的范围为0~100)。目前此功能仅在特定的dev_rsa_dispatch分支版本中可用。
1
export KAE_GO_SOFT_RATIO=33
- 使能KAE前后性能对比。
- 在客户端创建脚本文件,例如test.sh。
1
vi test.sh
- 按“i”进入编辑模式,在脚本文件中添加如下内容。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/bash function test() { taskset -c 0-9 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 10-19 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 20-29 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 30-39 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 40-49 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 50-59 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 60-69 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 70-79 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 80-89 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 90-99 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & taskset -c 100-109 wrk -H "Connection: Close" -t 11 -c 200 -d 60 https://$IP:$port/index.html & wait } test > result.log cat result.log |grep Requests/sec | awk '{print $2}' | awk '{sum+=$1} END {print sum}'
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 执行脚本,查看使能KAE前后的性能值对比。
1
sh test.sh
可以看到,采用软硬结合的策略,使能KAE前后的性能值分别是120340、181411,性能约提升50%。
- 在客户端创建脚本文件,例如test.sh。
- Nginx的启动和取消KAE操作请参见KAE对Nginx处理HTTPS连接请求的性能调优。
父主题: 在物理机使能KAE加解密