I want 50 connections create per server. But every time my maxconn is overloaded or exceeded. So it creates high CPU utilization and memory usage. How can i get rid of this problem?
Is that case how can we ensure the concurrent requests per second to backend servers?
Let’s say I want to allow max 100 requests/second to be landed at backend application server through HAProxy.
there is no “concurrent requests per second”. Either we are talking about concurrency or we are talking about per second numbers.
Your use-case is to limit CPU and memory usage. Then stop thinking about request per second, because that is the wrong approach to this.
You want to limit the actual number of in flight (that is - concurrent) requests, and that is what maxconn does.
You just need to think about it differently.
If haproxy only allows 50 connections, this means you can never have more than 50 requests in-flight (concurrency), and this is what helps you reduce CPU and memory usage.
The faster the server, the more request per second it will handle, but it will never exceed 50 in-flight transactions.
And this is the correct metric to limit CPU and memory on your backend servers.
Thinking about request per second numbers is wrong.