Docker Community Forums

Share and learn in the Docker community.

Dynamically Adjust Replicas In Service

Hello,
I’m new here so apologies if I’m breaking general etiquette. My google-fu and YouTube searches have left me empty handed on this question. For a school project of mine, I wanted to create a DockerSwarm that hosted a website. The ultimate goal was to also implement Traefik proxy and make it so my swarm dynamically scales up and down the number of replicas the service has based on its load. There are two things I’m looking for answers for:

  1. 1.Are there commands to change the number of replicas in a service at runtime?

  2. 2 How can I monitor the requests/load to invoke a command to scale as mentioned in question #1

Thanks,
Crocodile

You might want to take a look at https://github.com/gianarb/orbiter and https://monitor.dockerflow.com/auto-scaling/.

Thank you very much! I just quickly glanced over the two but this is exactly what I need. These seem to be two different methods of going about doing it. Do you have any experience/preference over one or the other?
Thanks again.

Nope, never required horizontal scaling for swarm services so far.

You can dynamically increase or decrease the number of read replicas in your Redis replication group using the AWS Management Console, the AWS CLI, or the ElastiCache API. If your replication group is a Redis (cluster mode enabled) replication group, you can choose which shards (node groups) to increase or decrease the number of replicas in.