Implement own algorithms for load balancing among nodes

Hello All,
I am new to docker. I want to design an architecture using docker. There are various nodes in a network which have some IoT applications running. The nodes should be controlled by a manager. Where should I implement load balancing algorithm so that applications are not effected?