Should resources be limited in swarm?

Example:

resources:
        limits:
          cpus: "1"
          memory: "1300m"

Additionally, setting GOMAXPROCS and GOMEMLIMIT makes sense.

But should I also limit traefik via swarm resources?
In my humble opinion, it isn't really that necessary.

Using Traefik happily for 5 years in Swarm without limits.

But of course it makes sense to use it for security and a new Traefik version might introduce a memory consuming bug, then you are more in the safe side.

1 Like

I guess if traefik struggles with memory, limiting it won't help, as traffic might not get routed by traefik anymore.

I think the usual bugs manifest in simply not working or eating memory. That might impact other services on the same machine. Setting a memory limit would probably restart the faulty container at some point.

1 Like