Docker swarmMode refresh

Hi,

when running in swarmMode I observe the following:
in v1.7 I see:

evel=info msg="Skipping same configuration for provider docker"

I assume this is the swarmModeRefresh interval checking for changes.

But in v2 its seem like it always recreates everything every 15s:

time="2019-09-18T06:03:18Z" level=debug msg="Creating middleware" entryPointName=uu middlewareName=metrics-entrypoint middlewareType=Metrics
time="2019-09-18T06:03:18Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=metrics-entrypoint middlewareType=Metrics
time="2019-09-18T06:03:18Z" level=debug msg="Creating middleware" middlewareName=metrics-entrypoint middlewareType=Metrics entryPointName=http
time="2019-09-18T06:03:18Z" level=debug msg="Initial health check for backend: \"oo@docker\""
time="2019-09-18T06:03:18Z" level=debug msg="Initial health check for backend: \"pp@docker\""
time="2019-09-18T06:03:18Z" level=debug msg="Creating TCP server 0 at 10.0.2.228:873" serverName=0 entryPointName=uu routerName=rsyncd@docker serviceName=uu
time="2019-09-18T06:03:18Z" level=debug msg="Creating TCP server 1 at 10.0.2.223:873" routerName=uu@docker serviceName=uu serverName=1 entryPointName=uu

It seems like every health check etc get restarted etc.
Is this intentional?
Is the swarmModeRefresh still needed on docker 19.x?

Hello,

As far as I understood, with the swarm provider, we don't automatically receive all real time events (as opposed to with the docker provider, where we do). This is why the swarm mode still has a ticker to regularly refresh events, at the interval defined by swarmModeRefresh (see https://github.com/containous/traefik/blob/v2.0/pkg/provider/docker/docker.go#L197 for the details). So yes, with the swarm provider, you still need this option set to a sensible value.

hth,
Mathieu

Hi,

yes, might still be needed.
But I'm concerned about seeing "Creating", sounds lika a lot of overhead every 15 seconds.
In 1.17 it compared previous configuration to the new and only recreated if differed. (at least that's my understanding).

I was expecting the same being logged:

For completeness, adding here the info we talked about in the issue (https://github.com/containous/traefik/issues/5419):

  1. There was a bug, but it's being fixed.
  2. Even without this bug, one could end up observing the reported behaviour if one does not specify the network for their docker services, because swarm might balance containers between different networks, which would make the servers URLs "fluctuate" in the config. TL;DR: please do specify the network for each of your docker service.
1 Like