Docker Community Forums

Share and learn in the Docker community.

SaaS, one service per user vs one task per user?

(Iceprogrammer) #1


I have a lightweight NodeJS app which i want to distribute as a SaaS model cloud.

So, the first scenario that came in my mind :

  • –There will be a service that will run separate instances of the container for each user.
    So if i have 10 users, the replication of service will be 10 and there will be 10 task running under the service.

  • –Each container has different user-specific configuration (that will be acquired from database when container starts)

  • –When a new user signs up, i will scale up the service and will have a new task dedicated to new user.

What is the issues then?
-Scaling down : When i want to remove a user, i can scale down the service and remove one of the tasks, however there is no way to tell service to stop an specific task which is related to that user. Scaling down could easily terminate another user’s task which is already running.
There was a proposal for supporting this kind of action, but unfortunately it wasnt approved:

Scenario 2:

  • Define a non-replicated service for each user. So there will be a service for each user.
    Then i can manage services individually and determine which service belongs to which user easily.


1-What is the recommended approach for this situation?
2- What are drawbacks of having like 100 services per node in comparision to having 100 tasks under a service?
3- Is there any limit on number of services in swarm mode?

*I might be on wrong path completely,i dont know, hopefully someone can make it clear.