SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Multi-Tenant Approach
Perfectial, LLC
info@perfectial.com
What is multi-tenancy ?
Multi-tenancy is an architecture in which a single instance of a software
application serves multiple customers.
Each customer is called a TENANT.
Tenants may be given the ability to customize some parts of the application,
such as color of the user interface (UI) or business rules, but they cannot
customize the application's code.
A software-as-a-service (SaaS) provider, for example, can run one instance
of its application on one instance of a database and provide web access to
multiple customers. In such a scenario, each tenant's data is isolated and
remains invisible to other tenants.
Multi-tenant data approaches
• Separate database
• Separate schema
• Partitioned (discriminator) data
• Data sharding
Separate database
Computing resources and application code are generally shared between all
the tenants on a server, but each tenant has its own set of data that remains
logically isolated from data that belongs to all other tenants.
Separate schema
Shared Database, Separate Schemas
This approach involves housing multiple
tenants in the same database, with each
tenant having its own set of tables that
are grouped into a schema created
specifically for the tenant.
Partitioned data
Shared Database, Shared Schema
In this approach, all tenants share the same set of
tables, and a Tenant ID associates each tenant with
the rows that it owns.
Data sharding
Sharding is a type of database partitioning that separates very large
databases the into smaller, faster, more easily managed parts called data
shards. The word shard means a small part of a whole.
Technically, sharding is a synonym for horizontal partitioning. In practice, the
term is often used to refer to any database partitioning that is meant to make
a very large database more manageable.
Simple example is splitting a customer database geographically. Customers
located on the East Coast can be placed on one server, while customers on
the West Coast can be placed on a second server.
Long story short: Sharding is basically the process of distributing tables into
different servers in order to balance the load equally.
SQL Azure Federations
Federations in Windows Azure SQL Database (SQL Database) are a way to
achieve greater scalability and manage capacity limitations in the database
tier of your application.
One or more tables within a database are horizontally partitioned across
multiple databases called federation members. This type of horizontal
partitioning is often referred to as ‘sharding’.
Federations structure
Federation Root Database
The federation root database is a SQL Azure database that contains metadata
about the federations.
CREATE DATABASE [fedRoot] COLLATE French_CI_AS (MAXSIZE = 100 GB, EDITION = 'business')
Any federations you create will inherit the properties of the root database.
Federation
The federation is where you define the data type (e.g., Customer ID, Product
ID) you’ll shard on.
CREATE FEDERATION <FederationName>(<DistributionKeyName> <DistributionType> RANGE)
<FederationName> is the name of the federation
<DistributionKeyName> is the name for the distribution key, and
<DistributionType> is the distribution data type that data will be sharded on.
The valid distribution data types are:
- int
- bigint
- uniqueidentifier
- varbinary (up to 900)
Federation member
The federation member is the shard (i.e., the database containing a specific
range of information). By default, a created federation contains one
federation member with a range of low to high (containing all the data).
Connect to federation member:
USE FEDERATION <federation_name>(<distribution_name> = value) WITH FILTERING={ON|OFF}, RESET
Connect to Root:
USE FEDERATION ROOT WITH RESET
Split federation
The ALTER FEDERATION is used to split a federation member and to drop a
federation member.
ALTER FEDERATION <FederationName> SPLIT AT (<DistributionKeyName>=<splitpoint>)
Drop federation
The ALTER FEDERATION is used to split a federation member and to drop a
federation member.
ALTER FEDERATION <FederationName> DROP AT ([LOW|HIGH] <DistributionKeyName> = <value>)
Creating a federation and a
federated table
CREATE FEDERATION CustomerFederation(cust_id BIGINT RANGE)
GO
USE FEDERATION CustomerFederation(cust_id=1) WITH RESET, FILTERING=OFF
GO
CREATE TABLE [dbo].[Customer](
[CustomerID] [bigint] NOT NULL,
[Title] [nvarchar](8) NULL,
[FirstName] [nvarchar](50) NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
[CompanyName] [nvarchar](128) NULL,
[EmailAddress] [nvarchar](50) NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_Customer_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF)
)FEDERATED ON (cust_id=CustomerID)
GO
Table types
• Federated
Federated tables contain the data that is federated across each federation
member. When the federation member is split, this data is distributed among
the two new federation members. A federated table is created by appending
FEDERATED ON to a CREATE TABLE statement.
• Reference
Reference tables are normal tables existing in each federation member and
their contents are copied to the new federation members formed when an
existing federation member is split.
• Common
Common tables are normal tables existing in the root database. They would
be typically be used for application data that does not need to be present in
each federation member.
Dynamic Management Views
There are various DMVs to support the management and use of SQL Azure
Federations:
• sys.federations
• sys.federation_members
• sys.federation_distributions
• sys.federation_member_distributions
• sys.federation_history
• sys.federation_member_history
• sys.federation_distribution_history
• sys.federation_member_distribution_history
• …
Perfectial, LLC
http://perfectial.com
info@perfectial.com

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Azure DDoS Protection Standard
Azure DDoS Protection StandardAzure DDoS Protection Standard
Azure DDoS Protection Standard
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 
Ansible
AnsibleAnsible
Ansible
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
1- Introduction of Azure data factory.pptx
1- Introduction of Azure data factory.pptx1- Introduction of Azure data factory.pptx
1- Introduction of Azure data factory.pptx
 
Azure storage
Azure storageAzure storage
Azure storage
 
Autonomous Data Warehouse
Autonomous Data WarehouseAutonomous Data Warehouse
Autonomous Data Warehouse
 
Multi Tenancy In The Cloud
Multi Tenancy In The CloudMulti Tenancy In The Cloud
Multi Tenancy In The Cloud
 
MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바
 
Couchbase training basic
Couchbase training basicCouchbase training basic
Couchbase training basic
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Apache HBase™
Apache HBase™Apache HBase™
Apache HBase™
 
Monoliths and Microservices
Monoliths and Microservices Monoliths and Microservices
Monoliths and Microservices
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Virtualization in cloud computing ppt
Virtualization in cloud computing pptVirtualization in cloud computing ppt
Virtualization in cloud computing ppt
 
CQRS in 4 steps
CQRS in 4 stepsCQRS in 4 steps
CQRS in 4 steps
 
Data models in NoSQL
Data models in NoSQLData models in NoSQL
Data models in NoSQL
 
NOSQL Databases types and Uses
NOSQL Databases types and UsesNOSQL Databases types and Uses
NOSQL Databases types and Uses
 

Ähnlich wie Multi-Tenant Approach

Sql azure federations
Sql azure federations Sql azure federations
Sql azure federations
Pavel Tsukanov
 
Data Virtualization Primer -
Data Virtualization Primer -Data Virtualization Primer -
Data Virtualization Primer -
Kenneth Peeples
 

Ähnlich wie Multi-Tenant Approach (20)

Windows Azure SQL Database Federations
Windows Azure SQL Database FederationsWindows Azure SQL Database Federations
Windows Azure SQL Database Federations
 
Sql azure federations
Sql azure federations Sql azure federations
Sql azure federations
 
Microsoft SQL Azure - Scaling Out with SQL Azure Whitepaper
Microsoft SQL Azure - Scaling Out with SQL Azure WhitepaperMicrosoft SQL Azure - Scaling Out with SQL Azure Whitepaper
Microsoft SQL Azure - Scaling Out with SQL Azure Whitepaper
 
Data Virtualization Primer -
Data Virtualization Primer -Data Virtualization Primer -
Data Virtualization Primer -
 
dvprimer-concepts
dvprimer-conceptsdvprimer-concepts
dvprimer-concepts
 
Database Management System (DBMS) | Computer Science
Database Management System (DBMS) | Computer ScienceDatabase Management System (DBMS) | Computer Science
Database Management System (DBMS) | Computer Science
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
 
dvprimer-architecture
dvprimer-architecturedvprimer-architecture
dvprimer-architecture
 
Azure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full CourseAzure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full Course
 
Pptofdistributeddb
PptofdistributeddbPptofdistributeddb
Pptofdistributeddb
 
Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
 
Stretch db sql server 2016 (sn0028)
Stretch db   sql server 2016 (sn0028)Stretch db   sql server 2016 (sn0028)
Stretch db sql server 2016 (sn0028)
 
Scaling apps using azure cloud services
Scaling apps using azure cloud servicesScaling apps using azure cloud services
Scaling apps using azure cloud services
 
CirrusDB Offerings
CirrusDB OfferingsCirrusDB Offerings
CirrusDB Offerings
 
PPT SQL CLASS.pptx
PPT SQL CLASS.pptxPPT SQL CLASS.pptx
PPT SQL CLASS.pptx
 
Exploring Microsoft Azure Infrastructures
Exploring Microsoft Azure InfrastructuresExploring Microsoft Azure Infrastructures
Exploring Microsoft Azure Infrastructures
 
Domain logic patterns of Software Architecture
Domain logic patterns of Software ArchitectureDomain logic patterns of Software Architecture
Domain logic patterns of Software Architecture
 
NoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseNoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to Couchbase
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
Introduction To Sql Services
Introduction To Sql ServicesIntroduction To Sql Services
Introduction To Sql Services
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Multi-Tenant Approach

  • 2. What is multi-tenancy ? Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers. Each customer is called a TENANT. Tenants may be given the ability to customize some parts of the application, such as color of the user interface (UI) or business rules, but they cannot customize the application's code. A software-as-a-service (SaaS) provider, for example, can run one instance of its application on one instance of a database and provide web access to multiple customers. In such a scenario, each tenant's data is isolated and remains invisible to other tenants.
  • 3. Multi-tenant data approaches • Separate database • Separate schema • Partitioned (discriminator) data • Data sharding
  • 4. Separate database Computing resources and application code are generally shared between all the tenants on a server, but each tenant has its own set of data that remains logically isolated from data that belongs to all other tenants.
  • 5. Separate schema Shared Database, Separate Schemas This approach involves housing multiple tenants in the same database, with each tenant having its own set of tables that are grouped into a schema created specifically for the tenant.
  • 6. Partitioned data Shared Database, Shared Schema In this approach, all tenants share the same set of tables, and a Tenant ID associates each tenant with the rows that it owns.
  • 7. Data sharding Sharding is a type of database partitioning that separates very large databases the into smaller, faster, more easily managed parts called data shards. The word shard means a small part of a whole. Technically, sharding is a synonym for horizontal partitioning. In practice, the term is often used to refer to any database partitioning that is meant to make a very large database more manageable. Simple example is splitting a customer database geographically. Customers located on the East Coast can be placed on one server, while customers on the West Coast can be placed on a second server. Long story short: Sharding is basically the process of distributing tables into different servers in order to balance the load equally.
  • 8. SQL Azure Federations Federations in Windows Azure SQL Database (SQL Database) are a way to achieve greater scalability and manage capacity limitations in the database tier of your application. One or more tables within a database are horizontally partitioned across multiple databases called federation members. This type of horizontal partitioning is often referred to as ‘sharding’.
  • 10. Federation Root Database The federation root database is a SQL Azure database that contains metadata about the federations. CREATE DATABASE [fedRoot] COLLATE French_CI_AS (MAXSIZE = 100 GB, EDITION = 'business') Any federations you create will inherit the properties of the root database.
  • 11. Federation The federation is where you define the data type (e.g., Customer ID, Product ID) you’ll shard on. CREATE FEDERATION <FederationName>(<DistributionKeyName> <DistributionType> RANGE) <FederationName> is the name of the federation <DistributionKeyName> is the name for the distribution key, and <DistributionType> is the distribution data type that data will be sharded on. The valid distribution data types are: - int - bigint - uniqueidentifier - varbinary (up to 900)
  • 12. Federation member The federation member is the shard (i.e., the database containing a specific range of information). By default, a created federation contains one federation member with a range of low to high (containing all the data). Connect to federation member: USE FEDERATION <federation_name>(<distribution_name> = value) WITH FILTERING={ON|OFF}, RESET Connect to Root: USE FEDERATION ROOT WITH RESET
  • 13. Split federation The ALTER FEDERATION is used to split a federation member and to drop a federation member. ALTER FEDERATION <FederationName> SPLIT AT (<DistributionKeyName>=<splitpoint>)
  • 14. Drop federation The ALTER FEDERATION is used to split a federation member and to drop a federation member. ALTER FEDERATION <FederationName> DROP AT ([LOW|HIGH] <DistributionKeyName> = <value>)
  • 15. Creating a federation and a federated table CREATE FEDERATION CustomerFederation(cust_id BIGINT RANGE) GO USE FEDERATION CustomerFederation(cust_id=1) WITH RESET, FILTERING=OFF GO CREATE TABLE [dbo].[Customer]( [CustomerID] [bigint] NOT NULL, [Title] [nvarchar](8) NULL, [FirstName] [nvarchar](50) NOT NULL, [LastName] [nvarchar](50) NOT NULL, [CompanyName] [nvarchar](128) NULL, [EmailAddress] [nvarchar](50) NULL, [ModifiedDate] [datetime] NOT NULL, CONSTRAINT [PK_Customer_CustomerID] PRIMARY KEY CLUSTERED ( [CustomerID] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) )FEDERATED ON (cust_id=CustomerID) GO
  • 16. Table types • Federated Federated tables contain the data that is federated across each federation member. When the federation member is split, this data is distributed among the two new federation members. A federated table is created by appending FEDERATED ON to a CREATE TABLE statement. • Reference Reference tables are normal tables existing in each federation member and their contents are copied to the new federation members formed when an existing federation member is split. • Common Common tables are normal tables existing in the root database. They would be typically be used for application data that does not need to be present in each federation member.
  • 17. Dynamic Management Views There are various DMVs to support the management and use of SQL Azure Federations: • sys.federations • sys.federation_members • sys.federation_distributions • sys.federation_member_distributions • sys.federation_history • sys.federation_member_history • sys.federation_distribution_history • sys.federation_member_distribution_history • …