Presentation is loading. Please wait.

Presentation is loading. Please wait.

AlwaysOn Introduction in Denali November 27 th, 2011.

Similar presentations


Presentation on theme: "AlwaysOn Introduction in Denali November 27 th, 2011."— Presentation transcript:

1

2 AlwaysOn Introduction in Denali November 27 th, 2011

3 Seventh Activity Activities Brief Introduce the AlwaysOn features of SQL2011 – Denali Deep dive of AlwaysOn characters

4 Attendees Tony Wu Eric Xia (Microsoft) Hua Zhu (Microsoft) Simon Liao

5 Introducing AlwaysOn Active Secondary

6 Active Secondary: Enabling Backup On Secondary Kevin Farlee

7 Active Secondary: Enabling Backup on Secondary Today’s Story Architecture Features and Limitations Backup Automation Demo

8 Agenda Database Mirroring Backups Backup On Secondary Features and Limitations Backup Automation – Current Solutions – Backup On Secondary Solution – Configuring Backup Preferences – Example Configurations Demo

9 Database Mirroring Backups Backups are only allowed on Primary Secondary cannot be leveraged for backups Backup Workload impacts production Server

10 Active Secondary: Offloading Backup Backups are allowed on any replica – Primary and secondary can be leveraged for backups Backup workload does not impact production server Highly requested feature

11 Database Mirroring Backups SQL 2008 Database Mirroring R/W workload PrimarySecondary Failed Backups

12 Active Secondary: Enabling Backup On Secondary R/W workload Primary Backups Secondary Backups Secondary Backups

13 Capabilities Backups can be done on any replica of a database Secondary replica may be synchronous or asynchronous Backups on primary replica still works Log backups done on all replicas form a single log chain Recovery Advisor makes restores simple

14 Log backups done on all replicas form a single log chain Replica 1 Log back up Log Bac kup LSN 1 - 10 LSN 21 - 30 Replica 2 Log Bac kup LSN 11 - 20 LSN 31 - 40

15 Restrictions, cautions, and gotchas Differential backups are not supported on secondary Only Copy-only full backups are supported on secondary The only distinction is the differential bitmap clearing Advisable for backups to be stored centrally

16 Automated Backups How to choose which replica to use for a backup? DBM: Only the primary would work Now: Backups succeed on all replicas Solution: Declarative policy

17 Declarative Policy Preference for which role to use: – Primary Only – Secondary Only – Secondary (but use Primary as fallback) – Don’t care Relative Priority for each replica

18 Declarative Policy Logic: – Filter out replicas which are not up & online – Filter out replicas which don’t meet the policy for role – Select the highest priority replica among the remaining set – Use instance name as tie-breaker

19 Session Code | Session Title19

20 Declarative Policy Policy is advisory only (NOT enforced) Automatically used by Maintenance Plans and Log Shipping Implemented as a system function (returns boolean)

21 DEMO Backup On Secondary Session Code | Session Title21

22 Active Secondary: Off-loading Reporting Workload Sunil Agarwal

23 Agenda Readable Secondary – Reporting Workloads Today – Value Proposition – Architecture – Impact and Performance – Demo – Application Connectivity

24 Reporting Workloads Today Database Mirroring Transactional Replication Run all workloads including reporting on Primary Impacts primary workload Resource/Blocking Run reporting on mirror with snapshots. Data Latency Additional management overhead No application failover Performance Impact during snapshot Most widely used for offloading reporting scenarios today Pros: Large number of subscribers, Filtering of data Reporting work load specific indexes Cons: Need replication expertise to manage and tune environment

25 Readable secondary allow offloading read queries to secondary Low data latency. After failover, the read applications can be automatically redirected to the new Secondary (require explicit connection request) Not a replacement for replication scenarios DB2DB1 SQLservr.exe InstanceA DB2DB1 Primary Secondary Database Log Synchronization InstanceB Reports Primary Secondary Reports ReadSec: Reporting Workload CRASH

26 Log Cache Secondary read is always behind primary during transaction activity DB1 DB1 Log DB1 Primary Secondary Log Capture Log Recieve DB1 Data Network Redo Thread Redo Pages DB1 Log DB1 Data Log Hardened Log Flush Commit Acknowledge Commit Log Pool ReadSec – Data Latency Log Capture

27 Impact on RTO Reporting workload can take resources away from REDO thread – Can impact the recovery time(RTO) Mitigation – User resource-governor to control resources taken by reporting workload – If using combination of sync/Async secondary, offload reports to Async Secondary. Log Cache DB1 Log Apply Redo Thread Redo Pages DB1 Log DB1 Data Reports Resource Intensive (IO, Memory, CPU) Resource Intensive (IO, Memory, CPU) ReadSec: Impact of Read Workload Secondary

28 Impact on RTO (cont.) Concurrency and Blocking – REDO can get blocked by reporting workload – REDO thread and read workload can deadlock Solution – Internally map read workload to non blocking isolation levels (no application changes required) Read Uncommitted  Snapshot Isolation Read Committed  Snapshot Isolation Repeatable Read  Snapshot Isolation Serializable  Snapshot Isolation Ignore all locking hints – Never choose REDO as deadlock victim Result – Blocking and deadlock between Reporting workload (i.e. Query) and REDO thread is eliminated – No issues with DML (INSERT/DELETE/UPDATE) as it is not allowed – Will incur additional cost of row versioning. ReadSec: Impact of read workload

29 Support Snapshot Isolation Mapping – Row versions must be created on the secondary replica Rule: – Primary and Secondary replica (i.e. database(s) must have the same physical structure Implications: – 14 bytes must be added to data/index row on the primary replica – Not an issue if SI or RCSI is already enabled on the primary replica – Does not require enabling SI/RCSI on primary Data Row XSN RID RID 6 bytes 8 bytes SI Mapping and Row Versioning

30 Row Versioning Optimizations

31 On standalone SQL Server – Query can block (even with NOLOCK) a concurrent DDL Same can happen on Readable Secondary – REDO can block Reporting Workload – Read workload can block REDO thread Mitigation – DDL not common in production environment – You may have flexibility in scheduling maintenance jobs with concurrent Reporting Workload – Tools to identify blocking An XEvent is generated when REDO is blocked. You can choose to kill Reporting workload Query the DMV to find the blocked thread in the database Primary ReplicaSecondary Replica Start Reporting workload on table T1 Takes SCH-S lock on table T1 Execute DDL operation on table T1 REDO processes the DDL log record Requests SCH-M lock on table T1 Reporting Workload completes Blocked DDL and Reporting Workload

32 Optimized Query Plans Goal: Comparable query plan on Readable Secondary Query Optimization and Statistics – SQL Server uses cost based optimizer that heavily relies on object statistics – If statistics are missing, SQL Server automatically creates them and persists Auto-stat on readable secondary will require physical Changes – Example: Table T1 (C1, C2, C3) Query on primary with predicate (C3 > 10). SQL Server auto-create the statistics, if needed, on column C3 on primary replica Won’t work on Readable Secondary as it will cause physical changes to the database. – Similar issue if the statistical information is stale on the secondary replica. Solution – Auto-create statistics on the secondary replica but persist them in TempDB – Existing catalog views (e.g. sys.stats) show temporary statistics Query Performance on Secondary

33 Auto Stats: Permanent vs. Temp SQL Memory On RS Stats blob T1/C1

34 RS: Ghost Cleanup Issue – Cannot remove the ghost row if needed on RS by active query Solution – Expose low_water_mark_for_ghosts for each database – Ghost can only be removed when it is safe to. – If RS preventing ghost clean up, user action is required.

35 DEMO Session Code | Session Title35 Readable Secondary

36 Setting up Readable Secondary

37 ApplicationIntent – A New Connection Property – Used to gate access to secondary – Applicable when Secondary Replica set with ALLOW_CONNECTIONS =READ_ONLY Connection String – Connect directly to a secondary instance Server=N2; Database=Db1; ApplicationIntent = ReadOnly Read-Only Routing – Connection behavior optimized for automatic routing of read only applications to secondary Application Connectivity

38 Catalog Views – Sys.availability_replicas (used to see if secondary allows READ) – Sys.stats New column to indicate if the statistics is temporary DMVs – Sys.dm_hadr_database_replica_states Xevents – REDO Blocked – REDO Unblocked PerfMon – REDO blocking Supportability

39 Better return on hardware investment – Primary workload can better use available resources – Reporting workload can use secondary replicas Comparable query plans on secondary replica Easy to manage and setup Summary

40 Complete the Evaluation Form to Win! Win a Dell Mini Netbook – every day – just for submitting your completed form. Each session evaluation form represents a chance to win. Pick up your evaluation form: – In each presentation room – Online on the PASS Summit website Drop off your completed form: – Near the exit of each presentation room – At the Registration desk – Online on the PASS Summit website Sponsored by Dell 40Session Code | Session Title

41 Thank you for attending this session and the 2011 PASS Summit in Seattle

42 42Session Code | Session Title Microsoft SQL Server Clinic Work through your technical issues with SQL Server CSS & get architectural guidance from SQLCAT Microsoft SQL Server Clinic Work through your technical issues with SQL Server CSS & get architectural guidance from SQLCAT Microsoft Product Pavilion Talk with Microsoft SQL Server & BI experts to learn about the next version of SQL Server and check out the new Database Consolidation Appliance Microsoft Product Pavilion Talk with Microsoft SQL Server & BI experts to learn about the next version of SQL Server and check out the new Database Consolidation Appliance Ask The Experts @ Dev Pods Meet Microsoft SQL Server Engineering team members & SQL MVPs Ask The Experts @ Dev Pods Meet Microsoft SQL Server Engineering team members & SQL MVPs Hands-on Labs Get experienced through self-paced & instructor-led labs on our cloud based lab platform - bring your laptop or use HP provided hardware Hands-on Labs Get experienced through self-paced & instructor-led labs on our cloud based lab platform - bring your laptop or use HP provided hardware Room 611Expo Hall6 th Floor LobbyRoom 618-620


Download ppt "AlwaysOn Introduction in Denali November 27 th, 2011."

Similar presentations


Ads by Google