SSL SNI期望期间的haproxy队列时间(qtime)
问题描述:
我们使用haproxy 1.5.14作为HTTP的负载平衡器以及多个域主机名的HTTPS端点。对于HTTPS端点,我们使用SSL NI头部检查来找出适当的后端节点。SSL SNI期望期间的haproxy队列时间(qtime)
在我当前的安装中存在多个https端点,我注意到后端qtime stat vaue非常高(200-300ms),这让我很不安。 qcur(当前队列长度)同时为零。 我们基本上是放慢了haproxy端200ms-300ms的所有请求吗? (不知道我是否正确理解qtime的这个值)如果是 - 我肯定是在寻找优化它的方法。
此行为仅在HTTPS后端观察到,而不在HTTP后端观察到。我想知道这是否是前端SNI头部检查的结果,用于确定正确的后端节点。请求会在SSL SNI检查期间留在队列中吗?
我们目前的配置(仅用于HTTPS端点):
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 40000
ulimit-n 100000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
retries 3
timeout http-request 1s
timeout queue 1m
timeout connect 3s
timeout client 1m
timeout server 30s
timeout http-keep-alive 2s
timeout check 3s
maxconn 40000
frontend https-in *:443
mode tcp
option tcplog
option socket-stats
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend foo-ssl if { req_ssl_sni -m beg foo }
use_backend bar-ssl if { req_ssl_sni -m beg bar }
backend foo-ssl *:443
balance leastconn
mode tcp
option ssl-hello-chk
server foo1 x.x.x.x:443 maxconn 10000 check
server foo2 x.x.x.x:443 maxconn 10000 check
backend bar-ssl *:443
balance leastconn
mode tcp
option ssl-hello-chk
server bar1 x.x.x.x:443 maxconn 10000 check
server bar2 x.x.x.x:443 maxconn 10000 check
答
这不应该发生,也意味着你的客户需要那么长的时间发送SSL问候与SNI,这是没有太大的预期要么。您应该使用网络捕获(tcpdump),并通过haproxy进程运行strace -tt以了解时间丢失的时间。