Nuestro buen amigo Javier Caceres nos comparte su artículo:
Multitenancy is one of the Software As A Service –SAAS- concerns and although the concept is clearly defined there are many questions and gaps about how to design end to end multitenant software, so here there are some reviews and insights about approaches and implementations.
A common first step is starting from the ground in the data layer to separate the records by using a key (usually the TenantId). Our friends in the Java EE side use some well-known tools like Hibernate’s filters and Eclipse’s discriminators columns for this task. Many people think like “7.Tenant encapsulation and framework level connection string management such that your developers do not have to worry about tenant IDs while writing queries”.
I disagree with that because the stand alone task of placing a where clause in all the queries is not a good reason to use a framework; a good design should abstract and encapsulate it. By other hand those frameworks are supposed to make implementations easier and still scalable enough but most of them create one database per tenant “dynamically”. Bear in mind that if you use different databases per tenants you’re not using the full potential of sharing resources in the economy of scale. A sample PostgreSQL implementation of such “dynamc” database creation is as follows:
Ver más aquí.
Fernando García Loera (Community Program Manager – Latin America Region)