Download presentation
Presentation is loading. Please wait.
Published byGerald Gipp Modified over 10 years ago
1
SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312
2
Understand how AlwaysOn (Availability Groups) Active Secondaries allow leveraging HA/DR hardware Read Workloads Backups
3
Offloading read workloads Offloading backups
4
AlwaysOn Active Secondaries allow using hardware for more than HA/DR: Offload work from primary Read workloads Backups
5
Active Secondaries Offloading Read Workloads
6
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 No failover of read workloads
7
DB2DB1 SQL Server DB2DB1 Primary Active Secondary Reports Log Synchronization DBs in active secondaries are readable Committed transactions are visible eventually When depends on log synchronization latency
8
DB2DB1 SQL Server Primary Up to 4 secondaries Sync or async
9
DB2DB1 SQL Server DB2DB1 Primary Secondary Log Synchronization Reports Primary Secondary Reports Manual Failover
10
NODon’t allow connections READ_ONLYOnly allow connections specifying READ_ONLY intent ALLAllow all connections ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_instance' WITH ( SECONDARY_ROLE ( ALLOW_CONNECTIONS = { NO | READ_ONLY | ALL } ) )
11
Clients can connect to readable secondary without changes Set ALLOW_CONNECTIONS = ALL 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
12
Configure Routing URL for each secondary ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_name' WITH ( SECONDARY_ROLE ( READ_ONLY_ROUTING_URL = ‘TCP://system-address:port’ ) )
13
ALTER AVAILABILITY GROUP ag_name MODIFY REPLICA ON 'server_name' WITH ( PRIMARY_ROLE ( READ_ONLY_ROUTING_LIST = {'server_name' [,..n]} ) )
14
demo AlwaysOn: Active Secondaries Offloading Read Workloads
16
Mitigations: Use Resource Governor No workload on auto failover target
17
DDL Redo can still be blocked by read workload XEvent lock_redo_blocked Contention between Redo and read workload avoided internally Workload executed on Snapshot Isolation Locking hints ignored Redo thread never a deadlock victim
18
Row versions must be created on the active secondary Stored in TempDB 14 bytes needed for version pointer Primary and secondary must have same physical structure If secondary is configured as active: 14 bytes added to rows on the primary (already if SI/RCSI enabled)
19
Query optimization relies on statistics Created by indexes and read workloads Statistics created on primary are redone on secondary But, read workloads at secondaries are different from primary workloads So, auto-create statistics on secondary Store on TempDB sys.stats: is_temporary=‘true’ Use most recent statistics Remove on failover, restart, or DROP STATISTICS
20
Active Secondaries Offloading Backups
21
PrimarySecondary Failed Backups Database Mirroring R/W workload Only on primary Impacts primary workload Fails after failover
22
R/W workload Primary Backups Active Secondary Backups Active Secondary Backups On primary or any secondary No need to configure secondaries as readable
23
Backup on sync or async secondaries Full Backup (Copy-Only) Log Backup Backup automation No Differential Backup
25
Full Backup (Copy-Only) and Log Backup on secondary If Differential Backup is needed: Full Backup and Differential Backup on primary Log Backup on secondary
26
Replica Priority 0 (never)... 100 (highest) Role Preference Primary Only Secondary Only Secondary If Possible None
27
Filter out replicas that are not online don’t meet role preference Select highest-priority replica Replica name as tie-breaker Not enforced by BACKUP Implemented as a system function sys.fn_hadr_backup_is_preferred_replica ('dbname') Used by Maintenance Plan Wizard Log Shipping Wizard
28
Use Recovery Advisor Store backups centrally
29
demo AlwaysOn: Active Secondaries Offloading Backups
30
Active Secondaries make AlwaysOn cost-effective Use hardware for more than HA/DR: Offload work from primary Read workloads Backups
31
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/
32
luis.vargas@microsoft.com social.msdn.microsoft.com/Forums/en-gb/sqlhadr/
34
Required Slide Complete an evaluation on CommNet and enter to win!
35
Scan the Tag to evaluate this session now on myTechEd Mobile
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.