Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
TOP 10 Availability Groups Improvement in SQL 2016 Karol Papaj 10.12.2016 Thank you to our AWESOME sponsors! 10.12.2016 • Karol Papaj • SolidQ • SQL Server BI • SQL Server High Availability • SQL Server Relational Engine • Based in Slovakia • [email protected] 10 Workgroup clusters The Problems? Active Directory New-Cluster –Name "DomainlessCluster" -Node SQL1,SQL2 -AdministrativeAccessPoint DNS -StaticAddress 192.168.14.120 Active Directory Demo Workgroup clusters AG on workgroup clusters Demo SQL 2016 AG on Workgroup clusters Limitations Windows Server 2016 SQL Server 2016 Kerbero s AvailabilityGr oup 9 Basic HA in Standard Edition The Problem? Deprecated DB Mirroring CREATE AVAILABILITY GROUP [StdAG] WITH (BASIC) FOR DATABASE [DB1] … Deprecated DB Mirroring Source: https://www.brentozar.com/archive/2015/06/how-to-set-up-standard-edition-alwayson-availability-groups-insql-server-2016/ Deprecated DB Mirroring Deprecated DB Mirroring Limitations 2 replicas 1 DB Listen er Backup on secondary Read access to secondary 8 Group-managed Service Account The Problem? Password Synchronization ********* Automatic SPN’s registration gM Service Account New-ADServiceAccount -Name gMSASqlService -DNSHostName gMSASqlService.squ.com -PrincipalsAllowedToRetrieveManagedPassword SQLServers Install-ADServiceAccount gMSAsqlservice Demo Group-managed Service Account 7 Database seeding The Problem? Backup/Restore CREATE AVAILABILITY GROUP [SQLAG01] FOR REPLICA ON N'SQL3' WITH ( ENDPOINT_URL = N'TCP://SQL3.SQU.COM:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SEEDING_MODE=AUTOMATIC ), N'SQL4' WITH ( ENDPOINT_URL = N'TCP://SQL4.SQU.COM:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SEEDING_MODE=AUTOMATIC ); Backup/Restore ALTER AVAILABILITY GROUP [SQLAG01] JOIN GO ALTER AVAILABILITY GROUP [SQLAG01] GRANT CREATE ANY DATABASE GO ALTER AVAILABILITY GROUP [SQLAG01] ADD DATABASE DB1 GO ALTER AVAILABILITY GROUP [SQLAG01] ADD DATABASE DB2 GO Demo Database seeding 6 Load balancing of read-only replicas The Problem? Overloaded first read-only replica Overloaded first read-only replica ALTER AVAILABILITY GROUP [SQLAG01] MODIFY REPLICA ON N'SQL3' WITH ( PRIMARY_ROLE(READ_ONLY_ROUTING_LIST=( ('SQL5','SQL4‘ ),'SQL3')) ) Demo Load balancing of read-only replicas 5 Scalability The Problem? Synchronization Performance The Problems? Log transport Context switche s Compressio n Multiple Log Writers Redo Speed SQL 2012/2014 SQL 2016 SQL 2016 is > 5x better in log throughput 540 82 Before SQL 2016 Source: https://blogs.msdn.microsoft.com/psssql/2016/04/28/sql-2016-it-just-runs-faster-alwayson-log-transportreduced-context-switches/ SQL 2016 > 2x better in CPU Utilization 36 on secondary 17 Before SQL 2016 Source: https://blogs.msdn.microsoft.com/psssql/2016/05/03/sql-2016-it-just-runs-faster-alwayson-parallelcompression-improved-algorithms/ 4 AG failover when one db detected as unhealthy The Problem? AG Health Detection SQL 2014 AG Health Detection SQL 2016 AG Health Detection CREATE AVAILABILITY GROUP [SQLAG01] WITH (DB_FAILOVER = ON) FOR DATABASE [DB1],[DB2] … AG Health Detection Demo AG failover when one db detected as unhealthy 3 Increased # of replicas as a failover target The Problem? Failed first secondary replica Primary replica Secondary replica Secondary replica Demo Increased # of replicas as a failover target 2 DTC Support Cross-instance Cross-database The Problem? Transaction Integrity SQL 2012 & 2014 Begin Distributed Tx Rollback Failover DTC DTC RscMgr #1 Standalone ? RscMgr #2 RscMgr #3 Primary Secondary SQL 2016 Begin Distributed Tx Commit Failover DTC DTC RscMgr #1 RscMgr #2 Standalone RscMgr #2 Primary Secondary Transaction integrity CREATE AVAILABILITY GROUP [SQLAG01] WITH (DTC_SUPPORT = PER_DB) FOR DATABASE [DB1],[DB2] … Transaction integrity Source: https://www.brentozar.com/archive/2015/06/how-to-set-up-standard-edition-alwayson-availability-groups-insql-server-2016/ Cross-instance Cross-database 1 Distributed AG The Problem? Replication to remote DC SQL 2012 & 2014 2X 3X 1X Primary Secondary Secondary Secondary Secondary Secondary SQL 2016 1X Primary Primary Secondary Secondary Secondary Secondary Secondary Replication to Remote DC ALTER AVAILABILITY CREATE AVAILABILITYGROUP GROUP[SQLAG04] [SQLAG04] WITH (DISTRIBUTED) JOIN AVAILABILITY GROUP ON N'SQLAG02' WITH( LISTENER_URL = N'TCP://AG02Listener:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, SEEDING_MODE = AUTOMATIC ), N'SQLAG05' WITH ( LISTENER_URL = N'TCP://AG05Listener:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, SEEDING_MODE = AUTOMATIC ); Demo Distributed AG Limitations Secondary AG becomes read-only No automatic failover between AG’s Questions? 10.12.2016 Thank you! 10.12.2016