Say that I have the same server (i.e. name/hostname/port) being used for multiple backends. Is there a way to limit the total number of concurrent requests sent to that server, regardless of the specific backend? It seems to me that maxconn is enforced for a specific server in a specific backend. Is there a different option?
E.g. Say I have a server that can accept 30 requests, and is referenced in two backends. Is there a better option than to set its maxconn to 15 in each backend?
No, I don’t think there is any other option than to set server maxconn specific to a backend. Maxconn property can only be set in 3 different locations in HAProxy configuration (/etc/haproxy.cfg) file :
1. maxconn in global section: to limit the number of concurrent connections allowed per haproxy process. 2. maxconn in listen/frontend section: to limit the number of concurrent connections allowed per listener/frontend. 3. server maxconn: to limit the number of concurrent connections allowed per server in a backend.
Therefore going with your example, you would simply have to set the maxconn to 15 in each backend.