跳到主要内容

HAProxy FAQ

Memory Usage

  • e.g.
    • 16 kB buffers
    • 34 kB/session
    • 30000 sessions/GB
    • 20000 sessions/GB - 考虑系统也会需要内存

perf debug

sysctl net.ipv4.ip_local_port_range
net.core.wmem_max
net.core.rmem_max
net.ipv4.tcp_rmem
net.ipv4.tcp_wmem
  • nbproc $(nproc)

req_ssl_sni vs ssl_fc_sni

use_backend s1 if { ssl_fc_sni my.domain.org }
use_backend s2 if { hdr(host) -i my2.domain.org }

TLS handshake, Client hello 后无响应

在 AlpineLinux 3.14 上,Host 内运行 HAProxy,使用 SNI Passthrough 出现该问题,修改为在容器内运行后问题解决。 在容器内使用完全相同的 HAProxy 版本也没有问题,一次断定是 Host 环境的问题。

可能的原因

  • 系统依赖升级后未重启

HAProxy exit code 143

  • SIGTERM

cannot parse Content-Length: too long int

  • H2, ssl-passthrough 时会有问题
  • #1561

Cannot raise FD limit to 20637, limit is 4096.

ERR_HTTP2_SERVER_REFUSED_STREAM

h3

Whitelist

acl white_list src 192.168.1.0/24 192.168.10.0/24
tcp-request content accept if white_list
tcp-request content reject