Our system is multi-tenant and it has been running in production for a couple of years. We are re-evaluating current strategy to make sure it scales as we expect our number of tenants to increase drastically.
This is mainly for subscription to read model.
Options considered:
Option 1. Catch-up subscription per tenant (we do have an eventstore projection that will create a stream per tenant) and we do use one catch-up subscription per tenant - each will subscribe to the tenant’s stream. This is the current approach which is working fine with current number of tenants of 100. But this number could increase to thousands (potentially 10,000 soonish), our concern is the number of open connections/subscription. Is it safe to assume eventstore will handle this number of connections/subscriptions with no main performance impact? We prefer this approach as we can horizontally scale subscribers (we are using akka.net).
Option 2. One catch-up subscription for the entire app using one connection to eventstore, but that means we need to push the events in a scalable way instead of processing all events of all tenants in one place. Potentially in that option we might need to use some sort of bus/queue to push each event to it’s relevant queue/topic and fan out to different subscribers.
Note that this is regarding running the read model handlers so we need to guarantee message orders.
What is your recommendations / thoughts?