SlideShare a Scribd company logo
SQL Database Federations

 Scaling out relational data in Windows Azure




             NEIL MACKENZIE
Who Am I?

 Neil Mackenzie
 Azure Architect @ Satory Global


 Windows Azure MVP
 Blog: http://convective.wordpress.com/
 Twitter: @mknz


 Book:
 Microsoft Windows Azure Development Cookbook
Content

 Windows Azure Platform
 Motivation for SQL Database Federations
 Overview of SQL Database Federations
 Transact-SQL Statements
 DMVs
 Fan-out queries
Windows Azure

 Cloud Services:
   Platform-as-a-Service
         Web roles, worker roles
     Infrastructure-as-a-Service
         Virtual Machines, SQL Server 2012
 Connectivity
   Endpoints, Virtual Network, Service Bus

 Storage
   Windows Azure Storage Service

   Windows Azure SQL Database
SQL Database

 Database-as-a-Service
   Multi-tenanted

   Priced in GB/month

 Database
   One primary and two secondary databases

   Quorum commit

   Maximum size: 150GB

 Programmability
   TDS protocol

   SQL Server authentication

   Change connection string and go
Scalability

 Scale up
   Use more powerful hardware

   Price/performance problem

   Fails at internet scale

 Scale out
   Use commodity hardware

   Cost-effective way to increase performance

   Resilient towards failure
Scale-Out Data

 Use multiple databases (shards)
 Sharding provides:
   Larger data sizes

   Higher performance

 Issues:
   Data distribution

   Connection routing
SQL Database Federations


 Sharding-as-a-Service
 Federated database comprises:
   Root database

   Federation member databases (shards)

 Federation specified by:
   Federation name

   Distribution key

 Routing
   Connection pooling
Federation Members


 Federation member
   Federated data distributed by distribution key range

   Error to insert or update distribution key outside range

   Member databases can have:
     different sizes
     different schemas

 Distribution key in:
   Clustered index

   Each unique index
Table Types


 Federated tables
   In federation members

  CREATE TABLE ( … )
  FEDERATED ON (CustomerId = custId)
 Reference tables
   In federation members

  CREATE TABLE ( … )
 Common tables
   In root database
Federation Operations


 Transact SQL support for federations:
   CREATE FEDERATION

   USE FEDERATION

   ALTER FEDERATION

   DROP FEDERATION
CREATE FEDERATION


 CREATE FEDERATION federation_name
  (distribution_name <data_type> RANGE)
 Data types:
    INT
    BIGINT
    UNIQUEIDENTIFIER
    VARBINARY(n) - n<=900
 Root database can support several federations
   e.g. – customer federation, product federation
USE FEDERATION


   USE FEDERATION ROOT WITH RESET
       Routes connection to root database


   USE FEDERATION federation_name
    (distribution_name = value)
    WITH RESET, FILTERING={ON|OFF}
     Routes connection to appropriate federation member
     FILTERING= OFF allows connection to be used for any data in the
      federation member
     FILTERING=ON restricts connection to a specified distribution
      key
ALTER FEDERATION: SPLIT


   Range:   100                       400   500




ALTER FEDERATION CustomerFederation
SPLIT AT (CustomerId = 200)

   Range:   100    200                400   500
ALTER FEDERATION: DROP

    100     200              400      500


ALTER FEDERATION CustomerFederation
DROP AT (LOW CustomerId = 200)
    100     200              400      500



ALTER FEDERATION CustomerFederation
DROP AT (HIGH CustomerId = 200)
    100     200              400      500
Dynamic Management Views


 Definition
   e.g. sys.federation_member_distributions

 History
   e.g. sys.federation_member_distribution_history

 Operations
   e.g. sys.dm_federation_operations

 Operation errors
   e.g. sys.dm_federation_operation_errors
sys.federation_member_distributions


 Columns
   federation_id         int
   member_id             int          (database id)
   Distribution_name     sysname
   Range_low             sqlvariant
   Range_high            sqlvariant
 Range:
   includes Range_low

   excludes Range_high
Security Principal


 Root database
   CREATE USER user_name FROM LOGIN login_name



 Federation member
   CREATE USER user_name



 Security is otherwise like SQL Database
Fan-Out Queries


 Loop over:
   sys.federation_member_distributions.Range_low

 Perform queries in parallel
 Two-step process
   Member query

   Summary query (if necessary)
Summary


 SQL Database Federations
   Sharding-as-a-Service

   Elastic scalability for SQL Database databases

   Management support

   Developer support
More Information


 MSDN Wiki
  http://bit.ly/A7sUdo


 Cihan Biyikoglu blog:
  http://blogs.msdn.com/b/cbiyikoglu/


 Post based on this presentation:
  http://bit.ly/wqD4Xo

More Related Content

PPTX
Office 365 for Developers
PPTX
Windows Phone 7 Unleashed Session 2
PPTX
Microsoft Partner Benefits for Software Companies
PPTX
Windows Phone 7 Unleashed Session 1
PPT
Composite Applications Speaking Tour - Lap Around Office Business Architectures
PDF
Office 365 identity
PPTX
SharePoint 2010 developer overview (in Visual Studio 2010)
PPTX
Sp administration-training-prism
Office 365 for Developers
Windows Phone 7 Unleashed Session 2
Microsoft Partner Benefits for Software Companies
Windows Phone 7 Unleashed Session 1
Composite Applications Speaking Tour - Lap Around Office Business Architectures
Office 365 identity
SharePoint 2010 developer overview (in Visual Studio 2010)
Sp administration-training-prism

What's hot (20)

PPTX
SharePoint 2013 App Provisioning Models
PPTX
SharePoint 2013 Sneak Peek
PDF
Technical Overview of Microsoft SharePoint Online - Presented by Atidan
PPTX
SharePoint and Azure - A Match Made in the Clouds
PPTX
Intro to power apps
PPTX
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
PPTX
Development of skype for business and knowledge of
PDF
Intro to Force.com Webinar presentation
PPT
Session4-Sharepoint Online-chrismayo
PPTX
Office 365 Identity Management options
PPTX
SharePoint Saturday Sacramento Business Intelligence with SharePoint 2010
PPTX
#SPSottawa The SharePoint Framework and The Microsoft Graph on steroids with ...
PPTX
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
PPTX
Power apps portal out for public review
PPTX
TechEd Africa 2011 - OFC307: Architecting a Disaster Tolerant and Highly Avai...
PPT
Web Page Composer Webinar
PDF
Introduction to Force.com
ODP
Putting *Sparkle* in Your Social Applications! Customization and Branding wit...
PPTX
Internet Explorer 8 Deployment - IE8 Firestarter
PPTX
Kma share point 2010 overview infra and dev technical info
SharePoint 2013 App Provisioning Models
SharePoint 2013 Sneak Peek
Technical Overview of Microsoft SharePoint Online - Presented by Atidan
SharePoint and Azure - A Match Made in the Clouds
Intro to power apps
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Development of skype for business and knowledge of
Intro to Force.com Webinar presentation
Session4-Sharepoint Online-chrismayo
Office 365 Identity Management options
SharePoint Saturday Sacramento Business Intelligence with SharePoint 2010
#SPSottawa The SharePoint Framework and The Microsoft Graph on steroids with ...
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
Power apps portal out for public review
TechEd Africa 2011 - OFC307: Architecting a Disaster Tolerant and Highly Avai...
Web Page Composer Webinar
Introduction to Force.com
Putting *Sparkle* in Your Social Applications! Customization and Branding wit...
Internet Explorer 8 Deployment - IE8 Firestarter
Kma share point 2010 overview infra and dev technical info
Ad

Similar to Windows Azure SQL Database Federations (20)

PPTX
Multi-Tenant Approach
PPTX
Sql azure federations
PPTX
Why you should(n't) run your databases in the cloud
PPT
Normalisation having DBMS architecture h
PPT
Distributed Database System
PDF
PPT
Distributed database management systems
PDF
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
PPTX
Introduction to distributed database
PDF
PDF
A to z for sql azure databases
PDF
Db2 partitioning
PPTX
PPTX
Lec 8 (distributed database)
PDF
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
PPTX
DATA BASE MANAGEMENT IN CLOUD - UNIT -1 PPT
PPTX
Pmit 6102-14-lec1-intro
PPTX
Distributed dbms
PPTX
Azure Data platform
PDF
Ibm Informix Integration Through Data Federation Ibm Redbooks
Multi-Tenant Approach
Sql azure federations
Why you should(n't) run your databases in the cloud
Normalisation having DBMS architecture h
Distributed Database System
Distributed database management systems
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
Introduction to distributed database
A to z for sql azure databases
Db2 partitioning
Lec 8 (distributed database)
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
DATA BASE MANAGEMENT IN CLOUD - UNIT -1 PPT
Pmit 6102-14-lec1-intro
Distributed dbms
Azure Data platform
Ibm Informix Integration Through Data Federation Ibm Redbooks
Ad

More from Neil Mackenzie (8)

PPTX
Azure DocumentDB
PPTX
Project Orleans - Actor Model framework
PPTX
Windows Azure Virtual Machines
PPTX
Node.js on Windows Azure
PPTX
Windows Azure HDInsight Service
PPTX
Brokered Messaging in Windows Azure
PPTX
Windows Azure Diagnostics
PPTX
Introduction to Windows Azure AppFabric Applications
Azure DocumentDB
Project Orleans - Actor Model framework
Windows Azure Virtual Machines
Node.js on Windows Azure
Windows Azure HDInsight Service
Brokered Messaging in Windows Azure
Windows Azure Diagnostics
Introduction to Windows Azure AppFabric Applications

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Big Data Technologies - Introduction.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Artificial Intelligence
Big Data Technologies - Introduction.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Electronic commerce courselecture one. Pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Reach Out and Touch Someone: Haptics and Empathic Computing
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Windows Azure SQL Database Federations

  • 1. SQL Database Federations Scaling out relational data in Windows Azure NEIL MACKENZIE
  • 2. Who Am I?  Neil Mackenzie  Azure Architect @ Satory Global  Windows Azure MVP  Blog: http://convective.wordpress.com/  Twitter: @mknz  Book: Microsoft Windows Azure Development Cookbook
  • 3. Content  Windows Azure Platform  Motivation for SQL Database Federations  Overview of SQL Database Federations  Transact-SQL Statements  DMVs  Fan-out queries
  • 4. Windows Azure  Cloud Services:  Platform-as-a-Service  Web roles, worker roles  Infrastructure-as-a-Service  Virtual Machines, SQL Server 2012  Connectivity  Endpoints, Virtual Network, Service Bus  Storage  Windows Azure Storage Service  Windows Azure SQL Database
  • 5. SQL Database  Database-as-a-Service  Multi-tenanted  Priced in GB/month  Database  One primary and two secondary databases  Quorum commit  Maximum size: 150GB  Programmability  TDS protocol  SQL Server authentication  Change connection string and go
  • 6. Scalability  Scale up  Use more powerful hardware  Price/performance problem  Fails at internet scale  Scale out  Use commodity hardware  Cost-effective way to increase performance  Resilient towards failure
  • 7. Scale-Out Data  Use multiple databases (shards)  Sharding provides:  Larger data sizes  Higher performance  Issues:  Data distribution  Connection routing
  • 8. SQL Database Federations  Sharding-as-a-Service  Federated database comprises:  Root database  Federation member databases (shards)  Federation specified by:  Federation name  Distribution key  Routing  Connection pooling
  • 9. Federation Members  Federation member  Federated data distributed by distribution key range  Error to insert or update distribution key outside range  Member databases can have:  different sizes  different schemas  Distribution key in:  Clustered index  Each unique index
  • 10. Table Types  Federated tables  In federation members CREATE TABLE ( … ) FEDERATED ON (CustomerId = custId)  Reference tables  In federation members CREATE TABLE ( … )  Common tables  In root database
  • 11. Federation Operations  Transact SQL support for federations:  CREATE FEDERATION  USE FEDERATION  ALTER FEDERATION  DROP FEDERATION
  • 12. CREATE FEDERATION  CREATE FEDERATION federation_name (distribution_name <data_type> RANGE)  Data types:  INT  BIGINT  UNIQUEIDENTIFIER  VARBINARY(n) - n<=900  Root database can support several federations  e.g. – customer federation, product federation
  • 13. USE FEDERATION  USE FEDERATION ROOT WITH RESET  Routes connection to root database  USE FEDERATION federation_name (distribution_name = value) WITH RESET, FILTERING={ON|OFF}  Routes connection to appropriate federation member  FILTERING= OFF allows connection to be used for any data in the federation member  FILTERING=ON restricts connection to a specified distribution key
  • 14. ALTER FEDERATION: SPLIT Range: 100 400 500 ALTER FEDERATION CustomerFederation SPLIT AT (CustomerId = 200) Range: 100 200 400 500
  • 15. ALTER FEDERATION: DROP 100 200 400 500 ALTER FEDERATION CustomerFederation DROP AT (LOW CustomerId = 200) 100 200 400 500 ALTER FEDERATION CustomerFederation DROP AT (HIGH CustomerId = 200) 100 200 400 500
  • 16. Dynamic Management Views  Definition  e.g. sys.federation_member_distributions  History  e.g. sys.federation_member_distribution_history  Operations  e.g. sys.dm_federation_operations  Operation errors  e.g. sys.dm_federation_operation_errors
  • 17. sys.federation_member_distributions  Columns  federation_id int  member_id int (database id)  Distribution_name sysname  Range_low sqlvariant  Range_high sqlvariant  Range:  includes Range_low  excludes Range_high
  • 18. Security Principal  Root database  CREATE USER user_name FROM LOGIN login_name  Federation member  CREATE USER user_name  Security is otherwise like SQL Database
  • 19. Fan-Out Queries  Loop over:  sys.federation_member_distributions.Range_low  Perform queries in parallel  Two-step process  Member query  Summary query (if necessary)
  • 20. Summary  SQL Database Federations  Sharding-as-a-Service  Elastic scalability for SQL Database databases  Management support  Developer support
  • 21. More Information  MSDN Wiki http://bit.ly/A7sUdo  Cihan Biyikoglu blog: http://blogs.msdn.com/b/cbiyikoglu/  Post based on this presentation: http://bit.ly/wqD4Xo

Editor's Notes

  • #7: Performance / database sizeNew pricing model complicates things since price is not linear in DB sizeFlavorous example
  • #8: Data Distribution:Range partitioningRound robinHash bucketRouting:Database discoveryConnection managementFlavorusTo support the spike in first-day ticket sales, Flavorus used the Windows Azure platform to host 750 web role instances of the Jetstream application and 550 SQL Azure databases. The application wrote chunks of customer data to multiple sharded SQL Azure databases in parallel. Jetstream was live for two days, after which the company returned the event data to its on-premises servers and continued selling tickets.http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000011072
  • #10: A range distribution can be affected by:Data skew – data concentrated in one federation memberOperational skew – data operations concentrated in one federation member
  • #11: FederatedReferenceCommonIndividual members contain distinct schema
  • #14: DB_NAME() provides the name of the current federation member.FEDERATION_FILTERING_VALUE(DistributionName) provided the current FILTERING=ON valuehttp://msdn.microsoft.com/en-us/library/windowsazure/hh597465.aspxFederation atomic unit is explicitly not a security boundaryError to insert/update data in wrong member
  • #15: Only valid when connected to root databaseOrdering of uniqueidentity:00000000-0000-0000-0000-080000000000http://sqlblog.com/blogs/alberto_ferrari/archive/2007/08/31/how-are-guids-sorted-by-sql-server.aspx
  • #17: Metadatasys.federationssys.federation_memberssys.federation_distributionssys.federation_member_distributionssys.federation_historysys.federation_member_historysys.federation_distribution_historysys.federation_member_distribution_historysys.dm_federation_operationssys.dm_federation_operation_memberssys.dm_federation_operation_errorssys.dm_federation_operation_error_members
  • #20: LOW is in memberHIGH is NOT in memberIterate over LOW value for member distributions
  • #22: SQL Azure Federation Data Migration Wizardhttp://sqlazurefedmw.codeplex.com/