Scenario: I’m running an HAProxy instance in two clusters, and my backend application is deployed across five different clusters. Despite generating significant load, my backend application does not seem to be scaling up as expected. I suspect that HAProxy might not be forwarding the load effectively and requests are getting queued. I’ve already set timeout queue
to 5s to minimize queuing.
global
maxconn 5000
log stdout format iso local0
defaults
log global
mode http
option httplog
option http-keep-alive
option redispatch
option log-health-checks
option forwardfor
timeout http-request 10s
timeout queue 5s
timeout connect 5s
timeout client 30s
timeout server 30s
timeout http-keep-alive 10s
retries 3
listen fe_haproxy_stats
bind *:8500
mode http
stats enable
stats realm "Haproxy\\ Statistics"
stats uri /stats
stats refresh 30s
http-request set-log-level silent
frontend fe_main_https_in
bind *:8080
acl is_api path /test
use_backend bk_2 if is_api
default_backend bk
backend bk
mode http
balance roundrobin
option httpchk GET /health
http-check expect status 200
http-send-name-header Host
http-response set-log-level silent if { status 200 }
default-server inter 2s fall 3 rise 2 ssl verify required ca-file /usr/local/etc/haproxy/cert/root.pem
server url1.com url1.com:443 check check-sni "url1.com" sni str("url1.com")
server url2.com url2.com:443 check check-sni "url2.com" sni str("url2.com")
server url3.com url3.com:443 check check-sni "url3.com" sni str("url3.com")
server url4.com url4.com:443 check check-sni "url4.com" sni str("url4.com")
server url5.com url5.com:443 check check-sni "url5.com" sni str("url5.com")
backend bk_2
mode http
balance roundrobin
option httpchk GET /health
http-check expect status 200
http-send-name-header Host
http-response set-log-level silent if { status 200 }
default-server inter 2s fall 3 rise 2 ssl verify required ca-file /usr/local/etc/haproxy/cert/root.pem
server url4.com url4.com:443 check check-sni "url4.com" sni str("url4.com")
server url5.com url5.com:443 check check-sni "url5.com" sni str("url5.com")
Are there any other configurations I should consider to ensure HAProxy forwards the load effectively, allowing the backend application to scale up as needed? Also, is it worth deploying HAProxy in 5 clusters the same as backend? (Using HAProxy 3.0.2)
Thank you for your assistance!