lundi 10 avril 2017

Multi-tenant Application using ASP.NET


"Software Multitenancy refers to a software architecture in which a single instance of a software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant with a dedicated share of the instance including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants" (Wikipedia)
==> It's simple: build one central web application (single instance) that will house multiple websites able to serve multiple users.

Our goal from this article and video is to build create SaaS (Software-as-Service) applications that support multiple domains (or tenants) applying best practices from both a server-side and client-side perspective.

In Multi-tenant Application, we have many approaches in the deployment, database design, and structure. 
1- Many Deployment  in different database: 
 If we run one instance of the application for each tenant with the different database we can let many tenants able to work on a single server. 
Having many instances should not conflict with each other in the same server environment.
==> Security and maintenance problems.
2- One Deployment - many Database:
we have to run a single instance of the application in a server. We have a master (host) database to save tenant metadata (for example the tenant name and its subdomain) in a separated database for every tenant. Once we identify the current tenant (for example; from a subdomain or from a user login form), then we can switch to that tenant's database to perform operations.
==>Seperated database, separate backup separately from other tenants.
3- One Deployment - one  Database:
This the best multi-tenancy architecture. We just deploy a single instance of the application with a single database into the same server.
We use an Id field for the Tenant in each table (for a RDBMS) which is used to identify a tenant's data from others.
==>Easy to setup and maintain
4-Single Deployment - Hybrid Databases:
We would like to store tenants in one database, but we want to create separate databases for every tenant. For example, we can store tenants with big data in their own databases, but we can store all other tenants in a single database.
5-Many Deployment - One to more/Hybrid Database
It's like a combination of previous cases, we can deploy our web application to more than one server.This is independent from the database approach.

 We have 3 choices: 
1-Scale a single multi-tenant site by increasing the dedicated hardware. 
==>Offer increased flexibility.
2-Scale by adding multiple servers in a web form configuration.
==>Define the software architecture to an abstract common shareable functionality of each tenant across the multi-tenant application.  
3- Call by adding multiple virtual machines or adding cloud pass resources.
==>Develop a plan for isolation and security of each tenant in a multi-tenant solution. In this module, we reviewed all those considerations.

Let's start a project and choose the right way to work.

AlloTabib is a cloud platform, actually was used by only Tunisian doctors, we will work in this example to let all doctors in the world use it without any impact on its performance.
We will together build one website that supports multiple countries. 
The common interests of each tenant, or in our case country, is the country itself.
The group of users (patients) of each tenant are those users interested in that particular Country to get the convenient doctors.
Our goal is to build a robust, scalable, multi-tenant or single tenant web application.
We will use the following frameworks:

  • ASP.NET MVC and ASP.NET Web API as Web Frameworks.
  • Entity Framework as ORM.
  • Angularjs as SPA framework.
  • Bootstrap as HTML/CSS framework.
Will show you the way to include ASP.NET custom routing with MVC Razor, building AngularJS with Node.js in Gulp, deploying to on-premise Azure and AWS, and using Redis in server memory for cache. 


- Building the Core Components of Multi-tenancy
- Publishing Sites on Premise Azure and AWS Including Redis Cache

Next article is a video ! Keep Tuned !!

0 commentaires:

Enregistrer un commentaire