SQL Azure Database – High Availability Jan 2018 – SQL Saturday Malaysia 2018 Nagaraj Venkatesan, Data Platform MVP, Singapore
SQL Azure DB – HA / DR High Availability Backup n Restore Active Geo Replication Active Geo Replication + Failover Groups Active Geo Repl + FG + Elastic Pools
Default Backup Options Automatic Full, differential and T Log Local and Geo redundant Automatic backup 7 days for basic, 35 for standard, premium Long Term Retention for extended retention Retention Local Redundant – Any time Geo Redundant – 1 hour, 12 hours recovery time RPO / RTO Not suitable for mission critical workload Can’t do load sharing Challenges
Geo Replication Fundamentals Primary Secondary Asynchronous Active Secondary Upto 4 secondary Read Only Queries Service Tier Available on all service tier Primary n Secondary – Same tier Pricing n DTU Secondary can have lesser DTU than primary Secondary Pricing – Same like Primary
Geo Replication Fundamentals Primary Secondary Asynchronous Avoiding Data Loss Exec sp_wait_for_database_copy_sync Sizing Secondary Log IO % * Primary DTU Sys.dm_db_resource_stats
Comparison – RTO, RPO Capability Basic tier Standard tier Premium tier Point in Time Restore from backup Any restore point within 7 days Any restore point within 35 days Geo-restore from geo-replicated backups ERT < 12h, RPO < 1h Restore from Azure Backup Vault ERT < 12h, RPO < 1 wk Active geo-replication ERT < 30s, RPO < 5s
Transparent & Auto Failover Failover Groups
Failover Groups – ( Preview ) What is it Transparent failover like always on Read Write and Read Only URL Secondary Max 2 secondary Same subscription Failover Automatic or Manual Multiple DBs GracePeriod - Wait time before failover with data loss
Failover Group Application FAILOVER GROUP LISTENER Intent = Read Only Intent = Read /Write Intent = Read Only Intent = Read /Write Primary Secondary Secondary Primary Asynchronous Synchronization Failure
Failover Groups - Monitoring sys.dm_geo_replication_link_status replication_state_desc – Expect to see “catch-up” replication_lag_sec – Time to sync up lag last_commit – Time upto which secondary has caught up sys.dm_operation_status; Geo Replication Setup details
Multiple databases – cost effective solution Elastic pools
Elastic Pools Elastic Pool 150 DTU DB1 100 DTU DB1 AVG usage – 40 DTU Peak – 80 DTU DB2 100 DTU DB2 DB3 100 DTU DB3
Assume 3 DBs peak simultaneously Elastic Pools Normal SQL Database 10 Databases 100 DTU each AVG: 40 DTU MAX: 80 DTU Total DTU = 100 * 10 = 1000 DTU COST: 1.5 * 1000= 1500 USD Elastic Pool Assume 3 DBs peak simultaneously 10 Databases AVG: 40 DTU MAX: 80 DTU Total DTU: (( 80 * 3 ) + ( 40 * 7 ) ) = 240 + 280 = 520 DTU = 2.25 * 520 = 1170 USD
Elastic Pools Multiple DB with Varying Workload Avoids over / under provisioning Elastic Pools Predictable price 1.5 times Single DB DTU cost Suitable for * Multiple DBs * Spikes with pattern * Db don’t’ spike in parallel
Configuring Elastic Pool with Failover Groups 2) Elastic Pool needs to exist on secondary as well 1) Elastic Pool to be created before FG Delete FG Delete secondary DB Create Epool on primary Import Primary DB into Epool Create Epool on Secondary Configure FG
References SQL Azure Database Pricing - https://azure.microsoft.com/en-us/pricing/details/sql- database/ Failover Groups - https://docs.microsoft.com/en- us/azure/sql-database/sql-database-geo-replication- overview https://docs.microsoft.com/en-us/azure/sql- database/sql-database-designing-cloud-solutions-for- disaster-recovery https://docs.microsoft.com/en-us/azure/sql- database/sql-database-disaster-recovery-strategies- for-applications-with-elastic-pool https://docs.microsoft.com/en-us/azure/sql- database/sql-database-business-continuity