In a microservice based multi-tenant web application, there are some cases of tenant specific logic where I am unclear about the proper strategy to handle them. Thank you for pointers.

These two cases I think I have a grasp on. They lie at opposite ends of a spectrum:

  • logic that can be well abstracted. e.g. call to rule engine as part of the request pipeline. the rules are the data. strategy: make the logic into data associated with the tenant
  • logic that is practically impossible to abstract. e.g. logic closely related to customers own interfaces. strategy: provide robust interface against which extensions can be built, consider extensions not part of the application

These two I am not sure about:

  • microservices which actually have logic as data. e.g. trading algo platforms where each user builds their own python script trading algo to let it run against historical data or even realtime. The logic is definitely unique-forever to this tenant and might on top even be their IP. feels wrong to put the code into a database, so how is it persisted, isolated, executed, ...?
  • CSS. It's not really logic, but probably does not belong in the database either. It feels wrong to just put a tenant specific folder into the webapp repository. Is it proper to manage css in a separate repo and treat it like a config (as in cac pattern)?
  • 1
    We can't really delve into the specifics here, but would you say that it is more accurate that (a) this logic will only ever matter for this tenant or (b) this logic is currently unique to this tenant but other (future) tenants could reasonably ask for this logic as well? (this distinction presumably doesn't quite apply for the CSS but it does make a difference for the actual code) – Flater Jun 12 '20 at 16:38
  • Thank you for the comment. The code in the first unclear pattern is definitely unique to the tenant. Even more, it might be the IP of the tenant. Also edited above. – tscherg Jun 12 '20 at 16:57
  • trading algo platforms where each user builds their own python script trading algo to let it run How would you accomplish this if your application were single-tenant? – John Wu Jun 12 '20 at 22:49
  • I get what you're trying to say @JohnWu - the problem I am describing still exists even with one tenant. I still don't have an answer, except maybe if there is definitely only one tenant, they could manage the whole code in their source control including their python scripts – tscherg Jun 15 '20 at 18:43
  • Thanks @tscherg. So I think your actual question is "How do I handle custom logic?" which is of course a hugely open-ended question. You could create a pluggable architecture, a scriptable application, create customization hooks or callbacks, etc. You could even invent your own language. To describe all the options would require a massive answer which may not be suitable for this type of forum. I think maybe you need to explore options and narrow them down a bit before asking a question here. – John Wu Jun 15 '20 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.