Ssl HAProxy使用100%CPU 200并发连接
我最近开始对我的应用程序进行负载测试,发现由于某种原因,Ssl HAProxy使用100%CPU 200并发连接,ssl,amazon-ec2,haproxy,Ssl,Amazon Ec2,Haproxy,我最近开始对我的应用程序进行负载测试,发现由于某种原因,HAProxy无法处理大量并发连接 我只使用HAProxy来负载平衡我的SSL流量,对于非SSL(99%的流量是SSL),我使用nginx 我已经在blitz.io上测试了我的设置,当向非ssl(200并发)发送流量时,我没有超时或错误。然而,当在SSL上执行相同的测试时(由HAProxy处理),我立即得到100%的CPU,请求超时 这让我相信我的HAProxy配置中有问题 下面是我的配置,有什么想法吗 哦,我在一个中等EC2 CPU优化的
HAProxy
无法处理大量并发连接
我只使用HAProxy
来负载平衡我的SSL流量,对于非SSL(99%的流量是SSL),我使用nginx
我已经在blitz.io上测试了我的设置,当向非ssl(200并发)发送流量时,我没有超时或错误。然而,当在SSL上执行相同的测试时(由HAProxy处理),我立即得到100%的CPU,请求超时
这让我相信我的HAProxy配置中有问题
下面是我的配置,有什么想法吗
哦,我在一个中等EC2 CPU优化的实例上运行这个
我的haproxy.cfg:
global
maxconn 400000
ulimit-n 800019
nbproc 1
debug
daemon
log 127.0.0.1 local0 notice
defaults
mode http
option httplog
log global
stats enable
stats refresh 60s
stats uri /stats
maxconn 32768
frontend secured
timeout client 86400000
mode http
timeout client 120s
option httpclose
#option forceclose
option forwardfor
bind 0.0.0.0:443 ssl crt /etc/nginx/ssl/ssl-bundle.pem
acl is_sockjs path_beg /echo /broadcast /close # SockJS
acl is_express path_beg /probe /loadHistory /activity # Express
use_backend www_express if is_express
use_backend sockjs if is_sockjs
default_backend www_nginx
backend tcp_socket
mode http
server server1 xx.xx.xx.xx:8080 check port 8080
backend www_express
mode http
option forwardfor #this sets X-Forwarded-For
timeout server 30000
timeout connect 4000
server server1 xx.xx.xx.xx:8008 weight 1 maxconn 32768 check
backend sockjs
mode http
option forwardfor #this sets X-Forwarded-For
timeout server 30000
timeout connect 4000
server server1 xx.xx.xx.xx:8081 weight 1 maxconn 32768 check
backend www_nginx
mode http
option forwardfor #this sets X-Forwarded-For
timeout server 30000
timeout connect 4000
server server1 localhost:80 weight 1 maxconn 8024 check
listen stats :8181
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth helloxx:xx
在进行非ssl测试时,CPU负载是什么样子的?SSL将增加一些开销。这完全取决于密钥的大小。如果没有SSL,我大约占10%。将HAProxy配置中的SSL行更改为:
bind 0.0.0.0:443 SSL-crt/etc/nginx/SSL/SSL-bundle.pem-ciphers RC4-SHA:AES128-SHA:AES:!ADH:!阿努尔:!卫生署:!!埃德:!eNULL
这帮了大忙,但CPUSSL中的巨大峰值本身不应该增加那么多开销。iowait
看起来像什么?您在日志中看到任何特定错误吗?删除一些SSL密码将有所帮助。这将是我的建议之一。