Scaling docker swarm services in pairs

Viewed 137

I am new to docker swarm and have an issue where I am trying to scale two services in a sort of pair. My environment is composed of:

  • queue for jobs(activemq)
  • a webservice that returns model results(tensorflow serving)
  • a cache to store results (memcached)
  • a broker which is custom java code written as glue code to take from the queue, process with the webservice and store in memcached.

I'd like to scale the broker and tensorflow webservice so that a broker can send to only one tensorflow serving instance, pairing the services together. I am able to create replicas of the broker and tensorflow webservice and get this working, but this is round robin-ing my requests to each tensorflow container.

What would I need to look into for pairing the broker and tensorflow webservice together so each broker only submits to one tensorflow service?

UPDATE 3/3/2020 10:02pm: It looks like I may be able to use service templates as talked about here:

But I tried to append the template below and the container is not pingable from another container in the cluster connected to the same network. while the other container aliases work.

   networks:
      ml-network:
        aliases:
          - "tensorflowserving{{.Task.Slot}}"

docker-ce version 19.03.6

0 Answers
Related