# Race Condition between two frontends

**URL:** <https://discourse.haproxy.org/t/race-condition-between-two-frontends/10206>\
**Category:** Help!\
**Created:** [September 10, 2024, 3:12pm UTC](https://discourse.haproxy.org/t/race-condition-between-two-frontends/10206 "2024-09-10T15:12:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhaujosh](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bhaujosh](https://discourse.haproxy.org/u/bhaujosh)\
**Post date:** [September 10, 2024, 3:12pm UTC](https://discourse.haproxy.org/t/race-condition-between-two-frontends/10206/1 "2024-09-10T15:12:32Z")

</div>

Hello,

I have configured two Frontend in my haproxy config. My service is running on ECS Container.

```auto
global
  maxconn 2000
  maxsessrate 700

frontend monitoring
  bind localhost:8080
  mode http
  maxconn 200
  monitor-uri /

frontend service
  mode tcp
  maxconn 1000
  rate-limit sessions 500

```

Monitoring Frontend been using to confirm that Haproxy running on ECS task is healthy, we are sending periodically traffic on localhost:8080 if the output is not 200 then we will kill the Task assuming Haproxy is not healthy and spin up a new one.

So while doing the load test on my ECS task, I’m sending high amount of traffic on `service` Frontend and due to that all queue is full with the traffic coming for `service` Frontend .  
Since, queue is full connection request to `monitoring` Frontend is rejected or getting delayed. On this condition no response been received back from `monitoring` and due to that we mark ECS task as unhealthy.

My backend is only consuming ~500 connections.

Can someone help how I can I resolve this issue?

Thank You  
Bhavesh

---

<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:** [September 10, 2024, 4:04pm UTC](https://discourse.haproxy.org/t/race-condition-between-two-frontends/10206/2 "2024-09-10T16:04:05Z")

</div>

global maxconn must account for _both_ frontend _and_ backend sesssion.

Considering that you have 1000 maxconn on the service frontend, which is production traffic, you are saturating the 2000 global maxconn connections with service traffic alone.

Bump global maxconn to 2200 for this math to check out.

---

<div class="post-metadata">

**Author:** ![bhaujosh](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bhaujosh](https://discourse.haproxy.org/u/bhaujosh)\
**Post date:** [September 10, 2024, 4:08pm UTC](https://discourse.haproxy.org/t/race-condition-between-two-frontends/10206/3 "2024-09-10T16:08:13Z")

</div>

thank you lukastribus,

My backend is only consuming ~500 connection. So i should have ~500 connection available for monitoring frontend.
