Warm up delay (for LB servicing requests) on rolling update in Swarm mode


I’m using Docker (v. 19.03.5, CentOS 3.10.0-1062.9.1.el7.x86_64) in Swarm mode and I’m using the following deploy params in stack yml:

  replicas: 2
    delay: 25s

But Swarm’s load balancer almost instantly starts to serve (load balance) requests to a newly updated replica. But what I need is that Swarm (or LB) give some time for the service to warm up (it’s a SpringBoot backend service). The idea is to not interrupt serving requests from frontends, i.e. first of all load balance to the second replica (with old image), then roll update first replica, give it a time to warm up, then switch ingress requests to the newly updated replica, then update second replica, give it a time to warm up and only then include it to a list of services that are load balanced.

I assume you didn’t declare are health check for this container?

As far as I remember, ingress will only route traffic to healthy containers.

@meyay Thanks a lot for a quick and right response.