我们的应用程序需要基于cookie的粘性会话,因此我们希望使用HAproxy来平衡到IIS服务器场的传入流量.
我们使用以下配置似乎在实验室工作(循环工作正常和会话保留),但在生产中应用超过3k并发用户时失败:
前端Front_http
bind :80
mode http
default_backend backend_http
stats enable
capture cookie ASP.NET_SessionId len 32
maxconn 10000
Run Code Online (Sandbox Code Playgroud)
前端Front_https
mode http
default_backend backend_https
bind *:443 ssl crt /etc/haproxy/cert.pem
capture cookie ASP.NET_SessionId len 32
maxconn 10000
Run Code Online (Sandbox Code Playgroud)
后端backend_http
balance roundrobin
option forwardfor
stick-table type ip size 20k expire 5m
appsession ASP.NET_SessionId len 64 timeout 5m request-learn prefix
server Server_1 192.168.10.81:80 cookie Server_1
server Server_2 192.168.10.81:80 cookie Server_2
server Server_3 192.168.10.81:80 cookie Server_3
Run Code Online (Sandbox Code Playgroud)
后端backend_https
balance roundrobin
option forwardfor
stick-table type ip size 20k …
Run Code Online (Sandbox Code Playgroud)