Sunday, April 22, 2012

Multi Tenancy

I've spent some time on thinking about multi-tenancy and clarified some thing for myself.

I can see three types of multi-tenant applications:

  1. Like email or todo lists for more simplicity. Running same code base for different users, keeping all data of a multi-tenant application in a single database

    To avoid unnecessary repetition of a query criterium that selects only data for the current user. Here EclipseLink with VPD or Hibernate Filters can be used.

    Note, such multi tenant application may also be served on separate (virtual) host for each tenant, such as http://firsttenant.yourapp.com and http://secondtenant.yourapp.com.
     
  2. More complicated case, e.g. multi-store e-commerce platform - runs once, but serves different stores and is manged by different owners, all isolated. Known as OnDemand.

    Caution, such solutions can be implemented as non multi-tenant application, but as running on separate  (virtual) machines/hosts, however with the same code base.  Although, supertmarket/marketplace (buy/sell e-commerce) is not a multi-tenant app at all.
     
  3. Multi-tenant platform, e.g. salesforce.com - platform for developing business applications in multi-tenant environment, e.g. ERRP with multiple departments as tenants. Their multi tenant architecture -  http://wiki.developerforce.com/page/Multi_Tenant_Architecture - Pivot tables, object oriented immutable db schema - OrgId, UserId - FieldId, Values.
Where you are? :)

Let me know your comments.

And if anybody interested I may post more  details about some technical approaches for developing multi-tenant applications.