Loadbalancing with only 2 services

Hello everyone,

We are using traefik for quite some time now in our production deployment of https://orderlion.com.

We have 2 identical docker containers running our webapp/webserver, which are deployed behind a traefik load balancer.

The issue we are running into regularly is the following:

  1. Due to high load or maybe a bug, let's say instance #1 experiences a very high load over a longer period of time
  2. the traefik health check recognizes this, marks #1 as unhealthy and redirects traffic to instance #2
  3. we also have a docker healthcheck in place (with a longer timeout)
  4. if the CPU load stays high, also docker marks the container as unhealthy and restarts container #1
  5. since #1 is now offline, ALL traffic is rerouted to #2 and ALL users are now on #2
  6. after #1 is successfully restarted, ALL users stay in #2, because of sticky sessions
  7. now #1 is pretty much not used at all and #2 experiences all the load, making our app very slow

I hope this makes sense to you. --> how can we "force" traefik to, after #1 comes back online, also move some of the users back from #2 to #1 to "even out" the load?

Tech:

  • Ubuntu 20.04
  • up-to-date docker
  • traefik 2.9.6

Thank you, best
Patrick

Disable sticky sessions? Use 3 application servers?

We use 3 servers exactly for this reason, so we don't suddenly double the load when 1 fails.

Hi @Twisterking, thanks for your interest in Traefik!

Using three Docker containers, like suggested by @bluepuma77 works.

If that is not working for you, could you share your config?