Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312.

Similar presentations


Presentation on theme: "SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312."— Presentation transcript:

1 SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312

2 Understand how AlwaysOn Active Secondaries allow leveraging HA/DR hardware Read Workloads Backups

3 Offloading read workloads Offloading backups

4 Pre-existent Server failover Shared Storage (SAN / SMB) Failover takes minutes Multi-Node Clustering Passive secondary nodes Failover Cluster Instances for servers Failover Cluster Instances for servers New Multi-database Failover Direct attached storage Failover takes seconds Multiple Secondaries Active Secondaries Availability Groups for groups of databases Availability Groups for groups of databases Failover Cluster Instances for servers Failover Cluster Instances for servers Availability Groups for groups of databases Availability Groups for groups of databases Active Secondaries

5

6 Active Secondaries allow using hardware for more than HA/DR: Offload work from primary Read workloads Backups

7 Active Secondaries Offloading Read Workloads

8 Database Mirroring Transactional Replication Run on primary Impacts workload Run on mirror w/snapshots Data Staleness Additional management No failover of read workloads Run on a subscriber Pros: Large number of subscribers Targeted indexes Cons: Separate solution to configure/manage Replication latency No failover of read workloads

9 DB2DB1 SQL Server DB2DB1 Primary Active Secondary Reports Log Synchronization DBs in active secondaries are readable Committed transactions visible eventually (depends on log synchronization latency) Same data center:<1s Different data center:1-5s

10 DB2DB1 SQL Server Primary Up to 4 secondaries Sync or async

11 DB2DB1 SQL Server DB2DB1 Primary Secondary Log Synchronization Reports Primary Secondary Reports Manual Failover

12 NODon’t allow connections ALLAllow all connections READ_ONLYOnly allow connections specifying READ_ONLY intent ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_name' WITH ( SECONDARY_ROLE ( ALLOW_CONNECTIONS = { NO | ALL | READ_ONLY } ) )

13 Clients can connect to readable secondary without changes Set ALLOW_CONNECTIONS = ALL If possible, use Application Intent New connection string property Specifies workload type: READ_ONLY / READ_WRITE Opens new capabilities Disallow connections Automatically route READ_ONLY connections to an active secondary

14 Configure Routing URL for each secondary Endpoint for read-only connections ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_name' WITH ( SECONDARY_ROLE ( READ_ONLY_ROUTING_URL = ‘TCP://system-address:port’ ) )

15 ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_name' WITH ( PRIMARY_ROLE ( READ_ONLY_ROUTING_LIST = {'server_name' [,..n]} ) )

16 demo AlwaysOn: Active Secondaries Offloading Read Workloads

17

18 Mitigations: Use Resource Governor No workload on auto failover target

19 Contention between Redo and read workload avoided internally Workload executed on Snapshot Isolation Locking hints ignored Redo thread never a deadlock victim DDL Redo can still be blocked by read workload DDL is infrequent - if possible run when low activity XEvent lock_redo_blocked

20 Query optimization relies on statistics Created by indexes and read workloads Auto-create statistics on secondary Store on TempDB sys.stats: is_temporary=‘true’ Use most recent statistics Remove on failover, restart, or DROP STATISTICS Statistics created on primary are redone on secondary But, read workloads at secondaries are different from primary workloads

21 Active Secondaries Offloading Backups

22 PrimarySecondary Failed Backups Database Mirroring R/W workload Only on primary Impacts primary workload Fails after failover

23 R/W workload Primary Backups Active Secondary Backups Active Secondary Backups On primary or any secondary No need to configure secondaries as readable

24 Backup on sync or async secondaries Full Backup (Copy-Only) Log Backup Backup automation No Differential Backup 

25

26 Full Backup (Copy-Only) and Log Backup on secondary If Differential Backups are needed: Full Backup and Differential Backup on primary Log Backup on secondary

27 Replica Priority 0 (never)... 100 (highest) Role Preference Primary Only Secondary Only Secondary If Possible None

28 Filter out replicas not online don’t meet role preference Select highest-priority replica Break ties with replica name Not enforced by BACKUP command Implemented as a system function sys.fn_hadr_backup_is_preferred_replica ('dbname') Used by Maintenance Plan Wizard Log Shipping Wizard

29 Use Recovery Advisor Easier to restore to point in time Store backups centrally Easier to track

30 demo AlwaysOn: Active Secondaries Offloading Backups

31 announcing - Read Workloads - Backups - DR are not Active Secondaries in Windows Azure

32 Active Secondaries make AlwaysOn cost-effective Use hardware for more than HA/DR: Offload work from primary Read workloads Without client changes With Application Intent: Read-only Routing (provides HA) Backups Full Backup (copy-only) and Log Backup Automation supported Windows Azure support is coming

33 AlwaysOn Resource Center http://msdn.microsoft.com/en-us/sqlserver/gg490638.aspx SQL Server 2012 Whitepapers http://msdn.microsoft.com/en-us/library/hh403491 AlwaysOn Team Blog http://blogs.msdn.com/b/sqlalwayson/

34 luis.vargas@microsoft.com social.msdn.microsoft.com/Forums/en-gb/sqlhadr/

35 @sqlserver @teched_europe #msTechEd mva Microsoft Virtual Academy SQL Server 2012 Eval Copy Get Certified! Hands-On Labs

36 Connect. Share. Discuss. http://europe.msteched.com Learning Microsoft Certification & Training Resources www.microsoft.com/learning TechNet Resources for IT Professionals http://microsoft.com/technet Resources for Developers http://microsoft.com/msdn

37 Evaluations http://europe.msteched.com/sessions Submit your evals online

38


Download ppt "SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312."

Similar presentations


Ads by Google