Today I started looking into adding multi-tenant abilities to my application. I thought I would share some resources I’ve been learning from, and maybe in a future post, show you the choices I made when implementing this.
What Is Multi-tenancy?
This wikipedia page describes multi-tenancy like so:
Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client-organizations (tenants).
When to use Multi-tenancy:
If we had say, a company photography album application we built, that allowed each company to collect and edit various office photos. We wouldn’t want to allow employee 12 from company 2 to have an ability to look at and/or certainly not edit/delete photos that were associated with any information (photos and the like) from company 1. To prevent these sorts of occurrences, we need to create a solution that scopes each group of employes and photos by company. In other words we need to be able scope or hide data from company to company.
Besides data separation and managing multiple accounts, some additional scenarios when multi-tenancy could be a viable strategy to implement includes when you need to customize the experience on a per client basis and also when you want to optimize resources.
When NOT to use Multi-tenancy:
There are times when you may not consider multi-tenancy a good choice. These instances include scenarios when you’re just building a simple web site (I’m making an assumption that simple website and mostly static website are synonymous here). Social networking sites by their very nature depend on interaction between users and accounts to some extent. The last two examples of when multi-tenancy may be a bad idea are when building public applications (heres a link to the definition), or shared data applications.
I plan on looking more into this over the coming weekend, in order to determine the various solutions available that make sense for my application. If you’re also interested in this topic, here are a list of resources I’ve been learning from lately:
- Writing Multi-Tenant Applications in Rails (< 36 minute confreaks video)
- Adding Multi-tenancy to your Rails app with
- Multitenancy in Rails by: David Lesches
- Multi-tenancy in Rails by: Allerin consulting and design
Categories: Ruby on rails