Server-template limitations, is tcp supported?

I wasn’t able to specifically get this information from docs & didn’t find any specific section here: HAProxy version 2.3.3 - Configuration Manual

Is there a limit on the total number of hosts we can load via HAProxy? I am observing that HAProxy isn’t able to load more than 243 servers.

When I use dig, dig falls back to TCP mode and returns 507 responses.

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24886
;; flags: qr rd ra; QUERY: 1, ANSWER: 507, AUTHORITY: 0, ADDITIONAL: 51

Config below:-

resolvers mydns
        parse-resolv-conf
        hold valid 10s
        accepted_payload_size 8192


defaults
        mode tcp
        maxconn 8000
        timeout connect 5s
        timeout server 30s
        timeout queue 30s
        timeout client 30s
        balance roundrobin
        option redispatch
        option  log-health-checks
        option httpchk GET /admin
        http-check expect string GOOD
        log global

frontend public_tcp_http
        bind *:8080
        default_backend lx_http


frontend public_tcp_https
        bind *:8443
        default_backend lx_https

backend lx_https
        default-server send-proxy check check-ssl resolvers mydns resolve-prefer ipv4 init-addr none
        server-template lxproxy_https 500 traffic.ats.prod.atd.prod.abc.com:22272

Haproxy does not support resolving DNS via TCP. When the response size crosses accepted_payload_size you will get that behavior.

@lukastribus Thank you for your reply. It really surprised me that HAProxy is still on UDP.
Do you happen to know any elegant solutions to manage a dynamic list of hosts?

Workarounds could be make hostnames extremely short to conserve byte space in responses, therefor increasing efficiency.

However if you want to have certainty with a large amount of hosts, then you need to stick to classic configuration. Whether you provision it manually or via some form of automation and orchestration depends on your environment.

@lukastribus I see. Reducing server hostname size is not an option.

I was also able to dig this: Using the Data Plane API | HAProxy Enterprise 1.9r1

It has a section of adding “backends”. Let me explore that as well (I’m on the community version and it looks like it’s supported in that as well Using the Data Plane API | HAProxy Enterprise 1.9r1)