How can I support my use case for multi-tenant system?

I’m thinking to use temporal in my product and wanted to check with you how yo think I can use it for my product multi-tenancy requirements:

  1. I have a list of tenants that changes dynamically during the system runtime and I want the all the activities and workflows in the system to always apply to all of the tenants
  2. I want to make sure that even if one tenant starts many workflows it will never starve other tenant workflows and that each tenant get equivalent chance to get workers computation
  3. I will want some dashboard so I can easily view workflow per tenant
  4. More awesome but optional features - authentication per tenant & different configuration per tenant for how it processes workflows

From learning the concepts in temporal it seems I can do the following: domain serves as the tenant (and then I get 3+4) and different task queue for each domain to get (2) (is it needed or the domain already partitions the task queue for me ?).
My problem is with request (1) which should support dynamic configuration of domains. Right now each worker needs to register the activity to handle in a specific domain and there is no global registration. What’s the idea behind this ? Maybe I miss something with the architecture of temporal

The best solution I could find was to to register new domains in my system with the temporal client once I find about it and make all the worker clients poll once in few seconds for client.ListDomains and register activities in the new domains if they find some.
What do you think about this approach ? Is there a better way ?

What is the maximum number of tenants?

The approach you proposed of using a namespace per tenant provides the best isolation but worker processes would have a hard time supporting a large number of workers if the number of namespaces is large.

100 tenants probably.

Would the worker process have hard time supporting the namespaces or is it mainly a function of the amount of activities it serves ?
Is there any way to have a single worker that serve multiple namespaces or task queues ?

I think it will create problems with Java worker process resources. Each worker instance will have its own thread pools for polling and activity and workflow task executions.

Thanks a lot for the responses Maxim ! It completely makes sense.

I think these worker issues won’t be bother us in the near future but thinking more long term - do you think that creating\contributing a worker that is able to query several namespaces\task queues is possible or is it against temporal architecture and it’s not so really possible ?

I understand your requirements on a high level. Let me think about the best way to implement them in the long term. So far we assumed that workers for different namespaces are owned by separate processes and such fairness is not needed.

can i use sth like label(like “tenantId=xxx”) patch in workflow, then I can search workflows by tenantId.

I use search-attribute to solve my problem.