SQL Server 2014 Upgrade Case study featuring In-Memory OLTP and Hybrid-Cloud Scenarios Evgeny Ternovsky, Program Manager II, Data Platform Group Bill Kan, Service Engineer II, Data Platform Group
Background
SQL Server 2014 Feature Overview 3
Databases in Question Support the automated test system that is used within DPG at Microsoft Mission-critical Accessed mostly through automation, with limited manual reporting queries Originally built 10+ years ago with limited further engineering investment 4
Database
Architecture Problem Hardware is non-uniform specification and approaching end of warranty Need to upgrade to Windows Server 2012 R2 to allow for infrastructure standardization Performance bottlenecks expected given projected workload growth rate R2 Close to zero tolerance for Solution Perform a cross-cluster migration to new hardware, OS, and SQL Server version Results Migration completed with only 3 minutes of Primary Primary
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Primary Node 2 Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Primary Node 2 Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Primary Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Primary Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2008R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Primary Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2008R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Primary Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2008R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Primary Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2008R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Node 3 Node 4 Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 WSFC2008R2 R2 WSFC2012R2 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Node 3 Node 4 Primary Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the
Cross-Cluster Migration Procedure Procedure WSFC2008R2 R2 WSFC2012R2 Upgrade secondary SQL 2012 nodes to SQL 2014 Fail over to one of the 2014 nodes Upgrade the old primary to SQL 2014 Switch nodes 4, 5, and 6 to use remote WSFC 2008 R2 Add nodes 4, 5, and 6 to the AG: this is the data synchronization stage Node 1 Node 2 Node 3 Node 4 Primary Node 5 Node 6 Delete the AG listener: this is the start of the Set AG offline AlwaysOn Availability Group - AG Switch nodes 4, 5, and 6 to use the local WSFC 2012 R2 Create new AG, AG Create new AG listener, DB: this is the end of the AG Listener DB
Learnings and Recommendations Prepare Read the documentation. Then, read it again! Create a deployment walkthrough for your scenario Use scripts where possible to minimize manual errors Assess your infrastructure and features being used. Some examples of this include: Compatibility level (incl. new cardinality estimator in SQL Server 2014) Scheduled backup jobs DBCC update usage Transactional replication Migration Stick to your plan Have rollback plans ready for various points in the deployments in case something goes wrong
EventDB Database
Background Problem High load: data collected for 8,100 client machines on availability, exceptions, and service telemetry A load over 3,800 transactions/sec would cause backups due to latching, resulting in data gaps Backup is short-term local, long-term tape offsite, requiring costly management, facilities, & hardware Solution Implement In-Memory OLTP to address performance gaps Implement Managed Backup to make backup a minimal-touch operation Results 6x gains on input rate: can now handle 23,500 transactions/second Daily report execution times reduced by 30-80% No interaction with backup system required since introduction of Managed Backup
Hardware Architecture 4x Intel Xeon E7540 128 GB 4x Intel Xeon E5-4610 0 512 GB OS: 280GB RAID-1 SAS HDD MDF/LDF: 2.3TB Attached SAN OS: 280GB RAID-1 SAS HDD LDF: 750GB RAID-10 SATA SSD MDF: 1.8TB Attached SAN R2 Primary Primary
Service Architecture Standard T-SQL stored procedure Disk-based tables Standard T-SQL stored procedure Natively-compiled stored procedure In-Memory tables SQL Agent job Disk-based tables
Demo Managed Backup 23
Learnings and Recommendations Understand your workload and bottlenecks Use the management warehouse together with the Memory Optimization Advisor and Native Compilation Advisor tools to decide where the biggest benefits will be gained Perform workload replays Establish your baseline Understand your application Not all scenarios can take advantage of In-Memory OLTP Understand In-Memory OLTP implementation considerations Define your architectural pattern and implementation Perform targeted migration Perform targeted and staged migrations: first tables, then T-SQL code. Repeat Once the initial batch of bottlenecks is addressed, iterate on the process until metrics are acceptable.
SQLCommon Database
Background Problem The data in the DB is the value proposition: losing it is simply unacceptable Fast recovery from a disaster scenario is expected by the customers: time to recovery from off-site backups is unacceptable Solution Use the SQL Data Files in Windows Azure Storage feature to create a fast disaster recovery option
Final Architecture Private Cloud Primary (RO intent) Log and Data Files
Demo SQL Data Files in Windows Azure Storage 28
Learnings and Recommendations Prepare for deployment A lot of steps can be completed prior to deployment day. Take advantage of this! For instance, storage containers should be created through the Azure Portal prior to deployment Create one container per database for isolation Think about security Moving to the cloud generates keys, certificates, and other collateral that should be securely stored Determine an ongoing security protocol such as rotating keys and passwords Harness the Cloud Find the right balance of private cloud and Windows Azure architecture that works for your scenario.
Conclusion SQL Server 2014 A huge amount of opportunities are opened with this release. Performance, disaster recovery, and simplified backup are just some of the options demoed today. Planning With sufficient planning and the right approach, minimal or no is possible for both upgrade to SQL Server 2014 and deployment of product features. Migration Automate your migrations as much as possible, have rollback processes, and use a staged approach. 30
Useful Links TechEd 2014 presentation Cross-Cluster Migration whitepaper and scripts In-Memory OLTP: common workload patterns and migration considerations MSDN: In-Memory OLTP Managed Backup SQL Data Files in Windows Azure Storage
Questions?
Thank You for Attending