针对Nginx应用场景,在客户端上,使用HTTPress工具对vKAE进行详细的性能测试,涵盖Nginx开源版本的同步与异步模式,以及使能vKAE结合Nginx的同步与异步模式,并对测试结果进行详细分析,得出结论与应用建议。
在虚拟机中执行两组HTTPress性能测试,分别针对Nginx开源版本的同步和异步模式,以及使能vKAE结合Nginx的同步与异步模式。
httpress -n 2000000 -c 200 -t 10 -k https://服务端IP地址:服务端端口号/index${nodeIndexNum}.html
httpress -n 20000 -c 200 -t 10 https://服务端IP地址:服务端端口号/index${nodeIndexNum}.html
在服务端上,执行以下操作:
vim sync_nginx_1_worker.conf
以下为使能KAE + 参数未调优过的Nginx同步模式的配置文件内容。
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user root; worker_processes 1; worker_cpu_affinity 1 ; # error_log /var/log/nginx/error.log debug; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; # access_log off; # access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 4096; include /usr/local/nginx/conf/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 8080; listen [::]:8080; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } # Settings for a TLS enabled server. # server { listen 8090 ssl http2 so_keepalive=off; listen [::]:8090 ssl http2 so_keepalive=off; #listen 8090 ssl http2 so_keepalive=off asynch; #listen [::]:8090 ssl http2 so_keepalive=off asynch; server_name _; # ssl_asynch on; ssl_certificate /usr/local/nginx/server_2048.crt; ssl_certificate_key /usr/local/nginx/server_2048.key; root /usr/share/nginx/html; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"; #ssl_ciphers "RSA-PSK-AES128-CBC-SHA256 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"; # ssl_ciphers AES256-GCM-SHA384; ssl_prefer_server_ciphers on; # ssl_session_tickets off; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
worker_processes 4; worker_cpu_affinity 1 10 100 1000;
#listen 8090 ssl http2 so_keepalive=off asynch; #listen [::]:8090 ssl http2 so_keepalive=off asynch; # ssl_asynch on;
最后在以下两行内容前面分别添加#号:
listen 8090 ssl http2 so_keepalive=off; listen [::]:8090 ssl http2 so_keepalive=off;
nginx -s stop || true; sleep 1; OPENSSL_CONF=/home/openssl.cnf /usr/share/nginx/sbin/nginx -c /root/test/sync_nginx_1_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 64000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; OPENSSL_CONF=/home/openssl.cnf /usr/share/nginx/sbin/nginx -c /root/test/async_nginx_1_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 64000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; OPENSSL_CONF=/home/openssl.cnf /usr/share/nginx/sbin/nginx -c /root/test/sync_nginx_4_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 128000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; OPENSSL_CONF=/home/openssl.cnf /usr/share/nginx/sbin/nginx -c /root/test/async_nginx_4_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 128000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; /usr/share/nginx/sbin/nginx -c /root/test/sync_nginx_1_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 64000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; /usr/share/nginx/sbin/nginx -c /root/test/async_nginx_1_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 64000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; /usr/share/nginx/sbin/nginx -c /root/test/sync_nginx_4_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 128000 https://服务端IP地址:8090/index.html
nginx -s stop || true; sleep 1; /usr/share/nginx/sbin/nginx -c /root/test/async_nginx_4_worker.conf; sleep 1
taskset -c 64-254 httpress -c 64 -t 32 -n 128000 https://服务端IP地址:8090/index.html
以HTTPS短连接为例,在规格为8C16G虚拟机中,使用HTTPress工具进行压力测试得到的RPS结果如表1所示。
处理器型号 |
服务端线程数=1 |
服务端线程数=4 |
虚拟机规格 |
Nginx同步/异步 |
是否启用vKAE |
---|---|---|---|---|---|
鲲鹏920处理器 |
1367 |
5102 |
8C16G |
同步 |
是 |
鲲鹏920处理器 |
2246 |
7393 |
8C16G |
异步 |
是 |
鲲鹏920处理器 |
587 |
2255 |
8C16G |
同步 |
否 |
鲲鹏920处理器 |
584 |
2245 |
8C16G |
异步 |
否 |
在CPU利用率达到100%的情况下,得出以下结论:
对于8C16G规格的虚拟机: