Scaling parallel pipelines using docker swarm

I have been trying to scale my application recently. Consider my application having 3 services which work fine with a docker-compose file.

As a first step, I was able to scale them across devices using docker-swarmand replicafactor. With this, the docker swarm was able to run a few services in a few devices and few other services in a few other devices. These were working fine as intended. In this use-case any replica of service1 talks to any replica of sevice2 and any replica of service2 talks to any replica of service3.

Now I want a modification to this architecture as shown in the link below:

Architecture image

As you can see, here each replica talks within itself and do not talk with the other replica. In other words Service1.1 should talk only with Service2.1 and should not talk with Service2.2, Service2.3 and Service2.4. How can I make this possible with the help of a docker swarm?

submitted by /u/kptikku
[link] [comments]
Source: Reddit