High Friction & Control Resources Dedicated Shared Low 100% of API, Virtualized Roll-your-own HA/DR/scale SQL Server in IaaS Virtualized Machine SQL Server Raw iron Scale-up Full h/w control Roll-your-own HA/DR/scale Auto HA, Fault-Tolerance Friction-free scale Self-provisioning, scale Virtualized Database SQL Database - PaaS Premium, up to 500GB Web/Business, up to 150GB
Reads are completed at the primary Writes are replicated to secondary replicas DB Single Logical Database Multiple synchronous replicas Transparent automatic failover P S S Write Ack Read Value Write Ack P S S High-Availability
Self-Service Restore Point-in-time Restore Restore points available up to 35 days back Creates a side-by-side database copy, non-disruptive REST API, PowerShell or Azure Portal Available in Premium edition Programmatic “oops recovery” of data deletion or alteration Geo- replicated Restore from backup Azure Storage SQL Database Backups sabcp01bl21
Self-service activation Create up to 4 readable secondary replicas Replicate to any Azure region Automatic data replication, asynchronous REST API, PowerShell or Azure Portal Available in Premium edition Active Geo-Replication Mission-critical business continuity on your terms
DMVValuesVisibility is _interlink connected Yes No sys.dm_database_copies Database state ONLINE COPYING sys.databases Replication state SEEDING CATCH_UP sys.dm_database_copies Replication lag Seconds sys.dm_continuous_copy_status Last_replication Timestamp sys.dm_continuous_copy_status TaskAPIDetails Start Continuous Copy PowerShell REST Optional RPO setting Stop Continuous Copy PowerShell REST Forced or friendly termination Get Status PowerShell REST T-SQL Retrieves DMV Geo- Replication Monitoring and Control
Master MSDB Temp MasterMSDB User DBTempDB Instance Collation Logins Credentials Linked Server Defs. CLR … Agent Replication DB Mail … … TempDB Collation Other Apps Other DBs User DB
DMVDetailsUse sys.dm_exec_query_statsCumulative view of query statisticsTotal and average resource consumption sys.dm_exec_query_sql_textReturns the text of the SQL batch that is identified by the specified sql_handle Provide overall batch text for statement sys.dm_exec_query_planReturns plan in XML for specified plan handleProvide plan for tuning and analysis sys.dm_exec_requestsCurrent requests executing on your DBCheck for blocking, contention related issues, convoys, etc Execute in isolation with STATISTICS (IO/TIME) ON
X X ? 1.Request has not yet reached the server Retry for reads and writes is safe 2.The request has reached the server Retry for reads is safe Retry for writes is NOT safe 1.Request is executed on the Server Retry for reads is safe Retry for writes is NOT safe
A general system wide back- off strategy is typically a good idea Query dependent back-off strategy to avoid overloading the system Low cost operationHigh cost operation Just re-executeRequires tracking of transaction ID Requires outer transaction ReadWrite
SELECT… SELECT… SELECT… SELECT… N N One client server roundtrip per execution N <N XML Delimited list Table Valued Parameter All executions in one batch
Performance is good No SQL Injection Requires SQLCLR Data is not strongly typed Cumbersome implementation Can be simplified by created one TVF per “list type” Can be strongly typed No SQL Injection Nice option if your data is already XML! Great flexibility Not strongly typed by default Performance is ok but not the best Less cumbersome than the delimited list but still somewhat cumbersome Strongly typed No SQL Injection Performance is great! Easy to use Allows for some level of streaming Less flexible than XML Allows for streaming, but only to the server Fully streaming Easy to use Poor performance Potential for SQL Injection attacks Roundtrip per execution
App DB Customer App DB Customer App DB Customer App DB Customer App DB Customer
SaaS Customer DB1 Customer DB2 Customer DB3 Customer DB N …
Data Model Sharding
Sharded Model
Directory Shard 1Shard
Usage Pattern Distribution of CSV Tenants Long Tail of Colder Databases CSV Goal: COGS Reduction Small but growing set of highly active users
Shard 1 Report Program Report Program Shard 2 Shard 3 Temp Storage Temp Storage 1 2 3,6,