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.

Hi

You can read about swarm deployment strategies here: https://github.com/docker/docker.github.io/blob/master/swarm/scheduler/strategy.md
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:
https://success.docker.com/article/using-contraints-and-labels-to-control-the-placement-of-containers

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 https://kubernetes.io/, 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: