Docker Community Forums

Share and learn in the Docker community.

Is a customized load-balancer possible?

I am deploying my application which contains three services by using Docker Swarm. As what i’ve read so far, Docker Swarm has a load-balancer to distribute container over Worker nodes automatically based on some internal factors. That is cool! but what i really need is a load-balancer which uses a set of parameters provided by me to distribute containers. Is it possible or it is too ambitious?
A set of parameters i mentioned here is obtained by running a script or code which calculate cpu usage, bandwidth, etc. Then its results will be passed to the load-balancer for distribution decision.

Thanks everyone for reading my post.


You can read about swarm deployment strategies here:
Where you can read:

The spread and binpack strategies compute rank according to a node’s available CPU, its RAM, and the number of containers it has

But you can also tell your application that it can only deploy, fx. to nodes with some tags or roles, check:

But to code your own scheduler using swarm mode is not possible, fx. what do you want to happen if the node you assigned containers, dies, then swarm will try to reschedule those containers to other nodes by itself.

You could try and use, which will provide a more advanced scheduler :slight_smile:

1 Like

thanks man, i will take a look at your recommended sites :slight_smile: yeah … i want to customize a bit in the default scheduler, hope it is not too hard, otherwise i gotta find another way :frowning: