# Maxconn for server used in multiple backends

**URL:** <https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311>\
**Category:** Help!\
**Created:** [March 27, 2018, 8:50am UTC](https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311 "2018-03-27T08:50:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaplun](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/kaplun/32/447_2.png) [@kaplun](https://discourse.haproxy.org/u/kaplun)\
**Post date:** [March 27, 2018, 8:50am UTC](https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311/1 "2018-03-27T08:50:55Z")

</div>

Hi!

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?

Thanks a lot,  
Samuele

---

<div class="post-metadata">

**Author:** ![shivharsh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/shivharsh/32/388_2.png) [@shivharsh](https://discourse.haproxy.org/u/shivharsh)\
**Post date:** [March 27, 2018, 9:33am UTC](https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311/2 "2018-03-27T09:33:18Z")

</div>

Hi Samuele,

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.

Thanks,  
Shivharsh

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [March 27, 2018, 12:21pm UTC](https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311/3 "2018-03-27T12:21:29Z")

</div>

> [@shivharsh](#):
>
> 1. maxconn in listen/backend section: to limit the number of concurrent connections allowed per backend.

Frontend, not Backend here.

---

<div class="post-metadata">

**Author:** ![shivharsh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/shivharsh/32/388_2.png) [@shivharsh](https://discourse.haproxy.org/u/shivharsh)\
**Post date:** [March 28, 2018, 4:17am UTC](https://discourse.haproxy.org/t/maxconn-for-server-used-in-multiple-backends/2311/4 "2018-03-28T04:17:24Z")

</div>

> [@lukastribus](#):
>
> Frontend, not Backend here.

Apologies for the typo there… I too meant frontend !  
Edited the actual post to correct the typographical error.

Thanks,  
Shivharsh
