Anda di halaman 1dari 50

SQL Server 2016 Always On

Availability Groups Enhancements


Jimmy May, MCM
Thank You

microsoft.com hortonworks.com aws.amazon.com red-gate.com


Empower users with new Hortonworks develops, Amazon Relational Database Redgate makes ingeniously
insights through familiar tools distributes and supports the Service (Amazon RDS) simple tools for Microsoft
while balancing the need for only 100% open source makes it easy to set up, technology professionals
IT to monitor and manage distribution of Apache operate, and scale Microsoft working with SQL Server,
user created content. Deliver Hadoop explicitly architected, SQL Server databases in the .NET, Visual Studio, Azure,
access to all data types built and tested for enterprise cloud. TFS. Trusted by 91% of the
across structured and grade deployments. It is the Fortune 100.
unstructured sources. only Hadoop-based platform
available on both Linux and
Windows.

2
JOIN
PASS Access to
online training
Enjoy
discounted
PASS is a not-for-profit and content event rates
organization which offers
year-round learning
opportunities to data
professionals
Join Local Get advance
Chapters and notice of member
Membership is free, join today Virtual Chapters exclusives
at www.sqlpass.org

3
BIO

www.twitter.com/aspiringgeek
www.linkedin.com/in/aspiringgeek
jimmy.may@sandisk.com
jimmymay@outlook.com
http://sqlblog.com/blogs/jimmy_may
https://blogs.msdn.microsoft.com/jimmymay
Forward Looking Statements
During our meeting today, we may make forward-looking statements.

Any statement that refers to expectations, projections or other characterizations of future events or
circumstances is a forward-looking statement, including those relating to market position, market
growth, product sales, industry trends, supply chain, future memory technology, production capacity,
production costs, technology transitions, construction schedules, production starts, and future
products. This presentation contains information from third parties, which reflect their projections as of
the date of issuance. Actual results may differ materially from those expressed in these forward-looking
statements due to factors detailed under the caption “Risk Factors” and elsewhere in the documents
we file from time to time with the SEC, including our annual and quarterly reports. We undertake no
obligation to update these forward-looking statements, which speak only as of the date hereof.

©2014 SanDisk Corporation. All rights reserved. SanDisk is a trademark of SanDisk Corporation. Lightning, Lightning Eco, Lightning Ascend, Lightning Ultra, Optimus, Optimus
Eco, Optimus Ascend, Optimus Ultra, Optimus Extreme, CloudSpeed, CloudSpeed Eco, CloudSpeed Ascend, CloudSpeed Ultra, CloudSpeed Extreme, FlashSoft, ZetaScale,
Guardian Technology, FlashGuard, DataGuard, EverGuard, SanDisk ION Accelerator, Fusion ioMemory, Fusion ioSphere, Fusion ioTurbine, Fusion ioVDI, and others are
trademarks of SanDisk Enterprise IP LLC. Other brand names mentioned herein are for identification purposes only and may be the trademarks of their respective holder(s).

5
Agenda
HA/DR Overview
Always On Availability Groups (AGs) Overview
New! Improved! SQL Server 2016 AG Features
Including but not limited to:
SQL Server Standard Edition support
Direct Seeding (vs. Backup-&-Restore)
Log Transport Compression Options
Readable Secondaries Enhancements Perf Sneak Peek
Performance—many times faster than previous versions
Much, much, more!
Call to Action

6
How to use this deck
Lots of slide notes & several hidden
slides
For a full copy of the
PowerPoint deck (not .pdf),
contact me directly:
jimmy.may@sandisk.com
@AspiringGeek

To navigate the deck,


leverage PowerPoint “sections”

7
7
What is your HA/DR Plan?

http://dilbert.com/strip/2000-08-15
HA vs. DR
High Availability
 Ability of a system to service an application or service
 Ability of a system to quickly recover from a partial or full failure
 Being able to service a component without shutting down the entire operation
 System or component that is continuously operational for a long period of time
 Often quantified as percentage uptime
Disaster Recovery
 Plan/process to return to normal operations after a catastrophic event
 Plan/process to limit loss of data and/or operational continuity after a catastrophic event
 Often quantified with:
 Recovery Point Objective (RPO)
&
 Recovery Time Objective (RTO

10
HA/DR for Real: People, Processes, & Technology

App Design
Database Software
Connectivity
OS
HW

11
HA/DR: Backup & Restore
You don't have a backup until it's been restored.
—Kimberly Tripp

Shrödinger's Backup: The condition of


any backup is unknown until a restore is
attempted.
http://bit.ly/SchrondingersBackup
@nixcraft via @sqllensman

Pond’s Twelfth Law: In Your Pursuit of


Five Nines, Don’t Practice in Front of the CIO
http://bit.ly/Ponds12thLaw

12
Always On Availability Groups (AGs)
High availability requiring only local, non-shared storage
Establishes a relationship between a set of DBs (one or more)
Changes on the primary server are copied to secondary servers
A secondary server takes over if the primary server fails
 Multiple secondaries are possible (& common)
 Automatic failover can be implemented
 Sync or async log transport
Requires underlying Windows Server Failover Clustering (WFSC)
Replicas often implemented on single-node Failover Cluster Instance (FCI) on non-
shared storage
 Optionally, AGs can be combined with traditional multi-node WFSC on shared storage
DB(s) in an AG failover as a unit
Eliminates complex scripting solutions required for DBM
 FYI SQL Skill’s Glenn Barry makes it look easy
Azure integration

13
Always On AGs Technojargon (1)
Always On
 Historically, a marketeering term reflecting a spectrum of features
 For example:
 Evolution across versions of online indexing build options
 Table Partitioning, then Managed Lock Priority partition switching

AlwaysOn vs. Always On


 SQL Server 2012 & 2014 AlwaysOn FCIs & AlwaysOn AGs
 Note: no space in AlwaysOn
 SQL Server 2016: Always On FCIs & Always On AGs
 Note: New! Improved! name includes a space being added to Always On

 For more insight, see:


http://sqlha.com/2015/12/16/dear-microsoft-i-love-you-but-youre-driving-me-batty

14
Always On AGs Technojargon (2)
Availability Group
 Logical container for a set of databases—availability databases—that fail over together
 An AG resides on at least one SQL Server instance
 For failover, two or more (up to eight) instances may host an AG

Availability Group (AG) Replica


 The collection of availability DBs hosted on a specific SQL Server instance; each set of a databases is a replica
 The availability DBs on the primary & secondary instances are replicas

Primary vs. Secondary Replicas


 Primary: The “main” replica; read/write
 Secondary: Receives log traffic from the primary replica; optionally readable
All instances (NOT SERVERS) participating in a given AG are replicas, period. There’s zero ambiguity. It’s just a question of what role it is—
primary or secondary. When I write about AGs I talk about total number of replicas.
—Allan Hirt @sqlha www.sqlha.com

Readable Secondaries
 Replica configured to allow read-only workloads when running under the secondary role
 Used for reporting, analytics, backups, etc.

Learn More: BOL: AG Terms & Definitions

15
Other AG Components & Concepts
Endpoints
 URL/port on which an AG Listener communicates AG traffic
 Defined prior to AG creation

Listener
 Optional (but useful!)
 DNS Name
 Transparent to app
 No change to connection string (unlike Database Mirroring)
 Direct incoming connections to the primary replica (or a read-only secondary, if appropriate)

Quorum
 A component of WFSC
 Determines the number of failures that the cluster can sustain before shutting down
 Many options, out-of-scope for this presentantion
What's New in Failover Clustering in Windows Server
https://technet.microsoft.com/en-us/library/dn265972(v=ws.11).aspx

16
Failover Cluster Topology

Clients

Client PCs
Public Network
Public
Network
Private
Network

Cluster
Nodes

Redundant Fiber
Channel Switched
Fabric
Shared Disk
Storage
(typically SAN)
Availability Group Topology
Clients

Client PCs
Public Network
Public
Network
Private
Network

Cluster
Nodes

Non-
Non-
Shared
Shared
Storage
Storage
Prototypical Architecture of AGs with Local Non-Shared Storage

A
A A

Sync Log Async Log


Synchronization Synchronization

19
Best Practice: Hotfixes & Updates
Recommended hotfixes and updates for Windows Server 2012 R2-based
failover clusters
https://support.microsoft.com/en-us/kb/2920151

SQL Server Updates


http://sqlserverupdates.com

20
AGs Enhancements
Dependencies
Security
Failover
DTC
Direct Seeding (vs. Backup-&-Restore)
Distributed AGs
Log Transport Compression Options
Azure Integration
Readable Secondaries
Performance

21
AGs Enhancements: Dependencies
64-bit only
 SQL Server 2016 will not be released in a 32-bit version

.NET Framework 3.5x independent


 Ding, Dong – SQL Server’s Dependency on .NET Framework 3.5x is Dead
http://sqlha.com/2016/04/15/sqlserver-net-35-dependency-gone
4/15/2016

SQL Server Standard Edition support


 EE not required

Domain Independent AGs


AD not required

22
SQL Server Standard Edition Support
Now that DBM has been marked for deprecation, this is welcome news!
 Announced at Ignite (May 2015)
 SQL Server Team blog
https://blogs.technet.microsoft.com/dataplatforminsider/2015/12/15/enhanced-always-on-availability-groups-in-sql-
server-2016

“Basic Availability Group”


 The supported configuration is much like DBM
 Two nodes
 Secondary replica is not readable
 Each DB must be in its own AG

How to Set Up Standard Edition AlwaysOn Availability Groups in SQL Server 2016
 Brent Ozar
www.brentozar.com/archive/2015/06/how-to-set-up-standard-edition-alwayson-availability-groups-in-sql-server-2016

23
Domain Independent AGs (AD not required)
Prior to 2016, all AG nodes had to live in the same AD domain
 But enterprises may have multiple domains, trusted or not
 Some installations may reside outside context of AD
SQL Server 2016 provides four options:
 All nodes in a single domain
 Nodes in multiple domains with full trust
 Nodes in multiple domains with no trust
 Nodes in no domain at all
Pre-reqs:
 Secure cluster configuration
 Secure endpoint configuration
More info (& helpful scripts)
 Enhanced Always On Availability Groups in SQL Server 2016
http://bit.ly/SQLTeamBlogSQL2016AGs
Kevin Farlee, 12/15/2015

24
Azure Integration
Simplified Add Azure Replica Wizard

Automatic Listener
Configuration
 Former setup was manual
 Azure is for async secondaries

25
AGs Enhancements: Security
TDE
 Encrypted databases now supported
 Authentication required when adding encrypted DBs to AG

Group-managed service accounts (gMSAs) support


 Managed domain accounts
 MSA functionality now extended over multiple servers
 e.g., network load balancers, SharePoint farms, etc.—& now AGs
 Provide
 Automatic password management
 Simplified SPN management, including delegation of management to other administrators

Default endpoint encryption changed from RC4 to AES


 Difference Between AES and RC4
 http://bit.ly/1VXZv8B

26
AGs Enhancements: Failover
Automatic Failover Partners supported
 2014: 2 :: 2 Replicas: 1 Primary, 1 Secondary
 2016: 3 :: 3 Replicas: 1 Primary, 2 Secondaries

DB-level Failover Options


 Default behavior relies on the health of the SQL Server instance to trigger failover
 New configuration option: Failover automatically when a primary replica db goes offline

CREATE AVAILABILITY GROUP (Transact-SQL) or ALTER AVAILABILITY GROUP (Transact-SQL)


...WITH (
...
, DB_FAILOVER = ON --{ ON | OFF }
)

28
AGs Enhancements: DTC Support
The Challenge
 Prior to SQL 2016 DTC was not supported in AlwaysOn
availability groups as we could not guarantee the integrity of
the transaction
 However, DTC was required for features such as Linked
Servers, Remote Procedure Calls, BEGIN DISTRIBUTED
TRANSACTION, etc.
The Fix
 Registering a Resource Manager per availability DB
 Works with DTC service to keep track of the distributed
transaction
 Integrity of a distributed transaction can now be guaranteed
More information (including pre-reqs)
 SQL Server 2016 DTC Support In Availability Groups
https://blogs.technet.microsoft.com/dataplatform/2016/01/25/sql-server-
2016-dtc-support-in-availability-groups
 Cross-Database Transactions and Distributed Transactions for
AlwaysOn Availability Groups and Database Mirroring (SQL
Server)
https://msdn.microsoft.com/en-us/library/ms366279.aspx
29
AGs Enhancements: Direct Seeding
Backup-&-restore was required to configure AGs or add new secondaries in SQL Server 2012 & 2014

Direct Seeding
 SQL Server 2016 allows a secondary replica to be automatically “seeded” over the network directly from the
primary
 Eliminates need for backup-&-restore

Specified by setting SEEDING_MODE = AUTOMATIC


CREATE AVAILABILITY GROUP (Transact-SQL) or ALTER AVAILABILITY GROUP (Transact-SQL)
...WITH (
...
, SEEDING_MODE = AUTOMATIC --{ AUTOMATIC | MANUAL }
)

Connect: Direct Seeding Options for SQL Server 2016 Always On Availability Groups
 Add conventional backup-&-restore knobs:
 Stripe across devices (multi-threaded)
 MAXTRANSFERSIZE
 BUFFERCOUNT
https://connect.microsoft.com/SQLServer/feedback/details/2649614
http://bit.ly/DirectSeedingPerf

30
AGs Enhancements: Distributed AGs
Associate two AGs from different WFSC
 An AG of AGs

DR Scenario: AGs reside in separate data centers—each on their own WSFC cluster

More Info:
Distributed Availability Groups (Always On Availability Groups)
http://bit.ly/BOL-DistributedAGs

Alan Hirt www.sqlha.com «post pending»


31
Log Transport Compression Defaults & Options
By default:
SQL 2014: Compressed for Sync & Async secondaries
SQL 2016:
Uncompressed for Sync mode (to conserve CPU)
Compressed for Async mode (to maximize performance across the WAN)
Default behaviors can be modified via Trace Flags

SQL AVAILABILITY_MODE Log Stream Trace Flag


Server Default to Toggle
Version Default
2014 Sync/Async Compressed 1462

2016 Sync Unompressed 9592

2016 Async Compressed 1462


32
AGs Enhancements: Readable Secondaries
Secondary replica configured to accept read-only queries & backup
 Reporting, analytics, backups, etc.
 Offload work from primary to conserve resources
Enhancements:
 Round-robin load balancing in readable secondaries
 Azure support
 Clustered Columnstore support
Be aware:
 Readable Secondaries: RCSI & impact on primary
 Licensing implications
 Performance on flash

33
Readable Secondary Round-Robin Load
Balancing
By default, no connections are allowed on the Secondary

SQL 2014: Configure Read-Only Access on an Availability Replica (SQL Server)


 Read intent connections can be defined
 https://msdn.microsoft.com/en-us/library/hh213002.aspx

SQL 2016: Configure Read-Only Routing for an Availability Group (SQL Server)
 Previously, read-only routing always directed traffic to the first available replica in the routing
list.
 SQL Server 2016 allows for parenthetical list against which READ INTENT requests are round
robinned
 READ_ONLY_ROUTING_LIST = (('Server1', 'Server2', 'Server3‘), 'Server4', 'Server5')
 https://msdn.microsoft.com/en-us/library/hh710054(v=sql.130).aspx
34
Readable Secondary Round-Robin Load Balancing
DR Site Primary Site
Clients Local AGs
READ_ONLY_ROUTING_LIST= Computer2
(('COMPUTER2', 'COMPUTER3',
'COMPUTER4'), 'COMPUTER5') Computer1
(Primary—
Read/Write)
Computer5
Computer3

Computer4
Readable Secondary Azure Support

Introduced in SQL Server 2014

Enhanced in SQL Server 2016

Best practice: Async commit availability mode

More info (& lots of it):


Active Secondaries: Readable Secondary Replicas (Always On Availability Groups)
https://msdn.microsoft.com/en-us/library/ff878253.aspx

36
Clustered Columnstore & Read-Only Secondaries
SQL 2014 supported Clustered Columnstore on “passive” Secondaries
But not on Readable Secondaries
 Note: Non-updatable (nonclustered) columnstore was supported

The Challenge Described


 Paul's Ponderings, Paul Randal, 10/13/2014
https://www.sqlskills.com/InsiderContent/201410/20141013Newsletter.pdf

The Error Described


 Connect: Availability Group Database Snapshot Isolation Level Error 35371 on Readable Secondary
https://connect.microsoft.com/SQLServer/feedback/details/1348268/availability-group-database-snapshot-
isolation-level-error-35371-on-readable-secondary
 Blog: Availability Groups and Columnstore Indexes, Jonathan Kehayias, 5/20/2015
www.sqlskills.com/blogs/jonathan/availability-groups-and-columnstore-indexes

The Fix:
SQL 2016 fully supports Clustered Columnstore on Readable Secondaries

37
Read-Only Secondaries: Licensing & Performance

Licensing implications
 Licensing is complex...
 If you query it, you must license it
 EE licenses for a modern commodity two-socket server costs $200,000 to $600,000

Performance on flash
 In the Data Propulsion Lab, we’ve demonstrated scenarios in which in-server flash supports
workloads heretofore offloaded to Readable Secondaries
 Consider the savings to your organization by doing so

38
44
SQL Server 2012 & 2014 AlwaysOn AG Perf
Bottlenecks
AlwaysOn Availability Groups (AGs) functionality is based on
Database Mirroring (DBM)
DBM legacy code had two built-in performance bottlenecks
inherited by AGs:
1. Log transport: This is a process that encrypts and compresses log traffic
to secondary replica(s)

2. Redo thread: Think about it as a continuous restore thread, applying


changes made on the primary replica to secondary replica(s)
Always On Log Transport & Log Redo
Log transport: Process that Redo applies changes to
encrypts and compresses log primary replica to secondary
traffic to secondary replica(s) replica(s)

46
AlwaysOn AGs: SQL 2016 vs. SQL 2014
(Hekaton)
Server, Application, and SQL Log Performance
600

~5x log transfer to 500


501 498

secondary 400
 Enhanced RPO
300
 Data on primary hardened on
secondary immediately
200
146
104 103

More work done


91
100
21 22
0
 4x CPU % CPU (%) Transactions/sec (x1000) Bytes Sent to Transport Log Bytes Received
(MB/s) (MB/s)
 6x trans/sec SQL2014 SP1 SQL2016 RC1

47
Unleashing the Power of SQL Server 2016
Fusion ioMemory Performance
600
553

~3x IOPs 500

>4x throughput 400

288

<1ms latency
300

200
(~300-700μs)
100
35
19
0 1
0
Disk: IOPs (x1000) Disk: Thruput (MB/s) Disk: Latency (ms)

48
SQL 2014 vs. 2016: Log Transport Performance
(Engine)
350

300

250

200
MB/sec

150

100

50

0
SQL Server 2014 SP1 SQL Server 2016 RC2

49
SQL Server 2016 Async vs. Sync:
Network Bandwidth Support

700 645

600

500 446
MB/sec

400 357
319
300

200

100

0
AsynchronousCommit SynchronousCommit

Log Megabytes Flushed/sec Megabytes Sent to Transport/sec

50
SQL Server 2014 vs. 2016
CPU% on Primary vs. Transactions
(Sync, 3 Replicas, 3 Trials)

40 60,000
37 37 37
35
47,823 47,172 48,017 50,000

Transactions/sec
30
40,000
25
CPU %

20 26,095 25,771 25,045 30,000

15
11 11 11 20,000
10
10,000
5

0 0
1 2 3 1 2 3
SQL Server 2014 SP1 SQL Server 2014 SP1 SQL Server 2014 SP1 SQL Server 2016 RC2 SQL Server 2016 RC2 SQL Server 2016 RC2

52
SQL Server 2016 Always On AGs #DataDriven

Always On AGs enhancements in SQL Server 2016


http://bit.ly/1UX3j94 (11:29)
Always On Availability Groups References
SQLHA
 Allan Hirt @sqlha & Max Myrick
www.sqlha.com
 Mission Critical SQL Server Book
 Pre-Order today: http://sqlha.contentshelf.com/shop

Microsoft MTC: Mission Critical SQL Server 2016


 MTC Director Ross LoForte & SanDisk Architect Jimmy May
http://bit.ly/MTCPerf

Data Propulsion Laboratory posts on SanDisk IT Blog


itblog.sandisk.com

Books Online: Always On Availability Groups (SQL Server)


https://msdn.microsoft.com/en-us/library/hh510230.aspx

Microsoft White Paper:


AlwaysOn Architecture Guide: Building a High Availability and Disaster Recovery Solution by Using AlwaysOn Availability Groups

54
Always On Availability Groups Training
SQL Skills IEHADR
 https://www.sqlskills.com/sql-server-training/iehadr

SQLHA
 http://sqlha.com/training

55
Summary & Call to Action
SQL Server 2016 Always On AGs have been significantly improved
across a wide spectrum of areas

Simply upgrading from earlier versions of SQL Server will provide


significant functional & performance benefits—if you have the
infrastructure capable of taking advantage of it

Start experimenting now!

56
Flash: Don’t be this guy. Don’t be in this org.

Hat tip to Bob Pusateri (@SQLBob)


via Jason Horner (@jasonhorner) & Argenis Fernandez (@DBArgenis)
57

Anda mungkin juga menyukai