Download presentation
Presentation is loading. Please wait.
Published byDouglas Trevor Fleming Modified over 6 years ago
1
6/1/ :10 AM BRK3120 Learning from MYOB: design patterns for SaaS applications on SQL Database Principal Program Manager, Azure SQL Database © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
Session objectives and takeaway
6/1/ :10 AM Session objectives and takeaway Equip you… To select the best database model for your SaaS scenarios With patterns that can reduce development, management and resource costs, and time-to-market for SaaS apps With a sample application and scripts that embody these patterns Takeaway Rich scale features, combined with best practices and patterns, make SQL Database scalable, flexible and cost-efficient data platform for multi-tenant SaaS applications © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
3
Agenda SaaS data management concerns Wingtip SaaS – sample SaaS app
Microsoft Build 2017 6/1/ :10 AM SaaS data management concerns Wingtip SaaS – sample SaaS app Data models for multi-tenant SaaS apps Design and management patterns, explored with the Wingtip SaaS app Agenda © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
4
SaaS data management concerns
Build 2015 6/1/ :10 AM SaaS data management concerns Per-tenant cost Tenant isolation Security, performance, lifetime management, etc. Scale Number of tenants, data volume, workload Business continuity, disaster recovery Tenant-level customization (sometimes) © 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
5
Wingtip SaaS app Web app for small venues that host events and want to sell tickets directly Multi-tenant app, backed by SQL Database Each venue gets a customized experience
6
Database models for multi-tenant SaaS apps
Tenant Isolation Low High Single-tenant Every tenant gets its own DB #1 #2 #3 #4 #5 #1 #2 #3 #4 #5 #1 #2 #3 #4 #5 Sharded multi-tenant Multiple tenants per DB, sharded across many DBs 1-99 1-n Multi-tenant All tenants in a single (large) database 1-n 1-n
7
Hybrid model blends benefits of MT/ST
Tenant Isolation Low High Single-tenant Every tenant gets its own DB #23 #39 #144 #211 #265 move/split Sharded multi-tenant Multiple tenants per DB, sharded across many DBs 1-99 Multi-tenant All tenants in a single (large) database
8
Single-tenant vs multi-tenant: pros and cons
Strong tenant isolation (security, performance management, monitoring, index tuning, auditing, schema customization, lifetime management, etc.) Simpler schema/app design Provisioning standalone dbs for peaks is expensive Overkill for small data volumes Not practical at extreme scale (millions of tenants) #1 #2 #3 #4 #5 #1 #2 #3 #4 #5 #1 #2 #3 #4 #5 #23 #39 #144 #211 #265 1-99 Multi-Tenant Supports extreme scale with low per-tenant data volumes Lowest per-tenant cost Weak isolation (security, privacy, performance, etc.) More complex schema/app design Cumbersome lifetime management, etc.
9
Pools are cost-effective for unpredictable workloads
0:00 12:00 23:59 Mon Tue Wed Thu Fri Sat Sun 9:00 9:15 10:00 9:30 9:45 2015 2016 2017 Hourly share resources Daily Weekly Yearly Elastic Pool Individually unpredictable Collectively stable and predictable Expensive, must provision each db for peaks Cost effective, scale pool up/down based on trends
10
Demo Wingtip SaaS app -> Database-per-tenant version
Microsoft Build 2017 6/1/ :10 AM Wingtip SaaS app -> Database-per-tenant version -> Hybrid multi-tenant version Demo © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
11
MYOB ….and not a DBA in sight !
6/1/ :10 AM MYOB Australian accounting ISV, targeting SMBs Migrated an established desktop app to a hybrid rich-client/cloud app Single-database desktop app migrated easily to a single-tenant model Initially used standalone databases Considered using a multi-tenant database solution (did a POC) Elastic pool-based solution had lower TCO, let them focus on their business 150,000 tenant databases, growing at 3-5K/month 300+ eDTU elastic pools, with 485 databases per pool ….and not a DBA in sight ! © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
12
MYOB elastic pool usage example
385 dbs in 200 DTU pool, per-database max at 100 DTUs
13
Learning from MYOB and other ISVs
Microsoft Build 2017 6/1/ :10 AM Learning from MYOB and other ISVs Developed SaaS patterns that address key design and management scenarios that are important at scale © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
14
Patterns compose into E2E SaaS scenario
6/1/ :10 AM Patterns compose into E2E SaaS scenario Geo-replication, failover groups Tenant self service Geo-replicate dbs for fastest recovery Geo-restore, aliases Reactive Restore from geo-redundant backup Tenant self service Azure Automation Pro-active Authentication, access control Azure Active Directory Scheduled Active/active cross-replication PITR Managed recovery of tenants at scale Recover tenant data after tenant error Reactive Handle intense isolated tenant workload SQL DW SQL DB + ColumnStore Pro-active Elastic Jobs Geo-distributed tenant dbs Handle fluctuating aggregate workload BCDR Azure Search Extract and analyze tenant data Search Scheduled Database per Tenant PowerBI Cross-tenant Analytics Azure Automation + ARM templates Query across tenant databases Manage performance Provision database and schema Elastic Query Monitoring and alerting ARM template, bacpac, db-copy Elastic Pools Scale databases Manage schema change Elastic Jobs Portal + OMS Catalog tenants and databases Monitor app and data layer Manage schema versioning via catalog Auto-provision databases Elastic Database Client Library, Shard Management schema Load-balance Browse tenants Pre-provision databases to reduce tenant onboarding latency Manage extended tenant meta data Connect app to tenant database Elastic Pools © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
15
Patterns compose into E2E SaaS scenario
6/1/ :10 AM Patterns compose into E2E SaaS scenario Geo-replication, failover groups Tenant self service Geo-replicate dbs for fastest recovery Geo-restore, aliases Reactive Restore from geo-redundant backup Tenant self service Azure Automation Pro-active Row-level security Azure Active Directory Scheduled Active/active cross-replication PITR Managed recovery of tenants at scale Authentication, access control Recover tenant data after tenant error Reactive Handle intense isolated tenant workload SQL DW SQL DB + ColumnStore Pro-active Elastic Jobs Geo-distributed tenant dbs Handle fluctuating aggregate workload BCDR Azure Search Extract and analyze tenant data Search Scheduled Multi-tenant Database PowerBI Cross-tenant Analytics Azure Automation + ARM templates Query across tenant databases Manage performance Provision database and schema Elastic Query Monitoring and alerting ARM template, bacpac, db-copy Elastic Pools Scale databases Manage schema change Elastic Jobs Portal + OMS Catalog tenants and databases Monitor app and data layer Manage schema versioning via catalog Auto-provision databases Elastic Database Client Library, Shard Management schema Load-balance Browse tenants Pre-provision databases to reduce tenant onboarding latency Manage extended tenant meta data Connect app to tenant database Elastic Pools Split-Merge service © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
16
Canonical database-per-tenant SaaS app
6/1/ :10 AM Canonical database-per-tenant SaaS app Scalable, load balanced Apps Catalog Tenant Catalog Holds mapping of tenants to databases plus tenant meta data Tenant databases in elastic pools for cost effective resource sharing, or stand-alone, depending on workloads Tenant A Tenant B Tenant C Tenant D Tenant N Tenant Databases All databases have same schema, no sharding key required in tables © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
17
Canonical hybrid multi-tenant SaaS app
6/1/ :10 AM Canonical hybrid multi-tenant SaaS app Scalable, load balanced Apps Catalog Tenant Catalog Holds mapping of tenants to databases plus tenant meta data Tenants1 Tenants2 TenantsN Tenant databases host single or multiple tenants depending on isolation/cost objectives. Databases in pools or stand-alone, scaled to aggregate load. Tenant A Tenant B Tenant C Tenant D … Tenant Databases All databases have same schema, sharded tables include tenant id as sharding key in PK © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
18
Wingtip SaaS sample app
Azure Web app (ASP.NET Core + EF Core) Deploys to Azure in under 5 mins Uses database-per-tenant with elastic pools Hybrid multi-tenant version in development Management scenarios implemented in PowerShell All code on GitHub Tutorials online Wingtip SaaS sample app © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
19
supported scenarios and patterns
6/1/ :10 AM Tenant provisioning and cataloging using Elastic Datable Client Library Tenant database connection via catalog Performance monitoring, alerting using Portal and OMS Performance management using a load generator (incl. scale/load balance pool, isolate heavily loaded database) Schema management using Elastic Jobs Distributed cross-tenant query using Elastic Query Tenant data extract and analysis (using SQL DB or SQL DW + PowerBI for data visualization) Restore tenant data after tenant error DR using geo-restore and tenant aliases (in work) DR using geo-replication and failover groups (in work) Wingtip SaaS sample app supported scenarios and patterns © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
20
Exploring the patterns
6/1/ :10 AM Exploring the patterns A look at some of the design and management patterns explored in the Wingtip SaaS tutorials © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
21
Provisioning tenants Apps Tenant Catalog Tenant Databases Catalog
6/1/ :10 AM Provisioning tenants Apps Catalog Tenant Catalog Cust 1 Cust 2 Cust 3 Cust N Tenant Databases © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
22
Provisioning tenants Apps Tenant Catalog Elastic Data Client Library
Tenant Onboarding Application flow A. Venue signs up as new tenant 1. User connects to the app 2. App gets/computes key, looks up tenant in catalog B. App provisions new tenant db Apps 3. …then connects to correct tenant database C. …registers tenant key, db location in catalog EDCL 4. On subsequent requests, uses database location cached in EDCL Tenant bacpac Base TenantDB Catalog ARM / SQL Database Tenant Catalog Cust 1 Cust 2 Cust 3 Cust 4 Cust N EDCL Elastic Data Client Library .NET/Java (preview) Tenant Databases
23
Managing unpredictable tenant workloads
1. Provisioning service creates pool 2. …pre-provisions databases 3. As tenants register they are assigned databases Apps 4. Service pre-provisions next pool and databases 5. Pool is scaled to handle more load/databases Catalog ARM / SQL Database 6. Databases are moved to load-balance pools 7. Databases can be moved out if they become very active pool1 pool2 pool3 Cust 10 Cust 11 Cust 4 Cust 17 Cust 1 Cust 2 Cust 3 Cust 12 Cust 13
24
Monitor Elastic Pool and Database usage using portal or OMS
Microsoft Build 2017 6/1/ :10 AM Monitor Elastic Pool and Database usage using portal or OMS Load generator allows several scenarios to be explored © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
25
Schema management at scale
Manage 1000s of databases as one Azure Portal Apps Job Account T-SQL CREATE TABLE… CREATE INDEX… INSERT INTO… SELECT * FROM… T-SQL Job Catalog Tenant Catalog Elastic Jobs Cust 1 Cust 2 Cust 3 Cust 4 Cust N T-SQL T-SQL T-SQL T-SQL T-SQL Tenant Databases
26
Distributed query across tenant databases
Query all tenants as if they are in a single database PowerBI Query from any client Apps Elastic Query Database locations are retrieved from catalog Adhoc Analytics External tables project data from tenant dbs Catalog Tenant Catalog Cust 1 Cust 2 Cust 3 Cust 4 Cust N Distributed query plan Tenant Databases
27
Extract tenant data into an analytics DB or DW
Unlock operational and application insights PowerBI Query from any client Azure Portal Apps Job Account T-SQL CREATE TABLE… CREATE INDEX… INSERT INTO… SELECT * FROM… T-SQL Job Catalog Adhoc Analytics Tenant Analytics Tenant Catalog Elastic Jobs SQL DB with ColumnStore or SQL DW Cust 1 Cust 2 Cust 3 Cust 4 Cust N T-SQL T-SQL T-SQL T-SQL T-SQL Tenant Databases
28
Wrap up and call to action
6/1/ :10 AM Wrap up and call to action You should now be equipped… To match your scenarios to common SaaS data models To explore SaaS-specific patterns that can reduce development, management and resource costs, and time-to-market Takeaway Rich scale features, combined with best practices and patterns, make SQL Database scalable, flexible and cost-efficient data platform for multi-tenant SaaS applications Install the sample, try the tutorials, send us feedback © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
29
Microsoft Build 2017 6/1/ :10 AM Resources Blog post GitHub repo Tutorials Getting started guide - installing and exploring the app © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
30
Please evaluate this session
Tech Ready 15 6/1/2018 Please evaluate this session From your Please expand notes window at bottom of slide and read. Then Delete this text box. PC or tablet: visit MyIgnite Phone: download and use the Microsoft Ignite mobile app Your input is important! © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
31
6/1/ :10 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.