I have a docker-compose with 4 containers deployed in production.
I wanted to use docker scale for the nodejs part. (with nginx LB)
If the docker-compose scale is done on the host machine, how does it suppose to improve performance, I did not limit the resources for that container, it means that it can burst as much as the host allows it.

What docker-compose scale is good for anyway?


1 Answer 1


Scaling is increasing the number of containers for any specific service. This is primarily helpful for a cluster, not on a single host setup like yours. When you scale your application up in a cluster, multiple containers of the same service get spread across the cluster (Based on their availability (Resource or anyway)). This makes the distribution of load across containers an available benefit. In a single host environment, with limited resources, scaling won't do you much good as the processes are going to be the slave of the same schedular, so you won't have that parallel servicing.

So now your question, why does scale in docker-compose exist? From the top of my head in no specific order of value:

  • You can minimize your services' downtime (going as low as none) while upgrading with docker-compose's scale functionality.
  • If an app can handle only so many inputs, in other words, if there's a queue of inputs, you can essentially increase the available queue space by scaling the container up and have multiple containers handle a portion of the inputs, reducing input loss.
  • The more obvious one, if one container goes down, there will still be at least one replica left.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.