SQL Server 2014 In-Memory Overview Nilabja Ball Premier Field Engineer Microsoft India
Nilabja Ball Premier Field Engineer with Microsoft India 10 years of SQL Server Experience Speaker in SQL UG group, Microsoft Tech-Ed Closely works with Mission Critical Tier 1 Microsoft Customers
Session Objectives And Takeaways Tech Ready 15 9/18/2018 Session Objectives And Takeaways Session Objective(s): Understand SQL Server’s in-memory strategy Be able to identify which technology will best help customers be successful SQL Server has an integrated In-memory strategy that is more than isolated features © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
SQL Server 2014 Investments 9/18/2018 SQL Server 2014 Investments In-Memory Technologies Enhanced High Availability New Hybrid Scenarios Other investments In-Memory OLTP 5-25x performance gain for OLTP integrated into SQL Server In-Memory DW 5-25x performance gain and high data compression Updatable and clustered SSD Bufferpool Extension 4-10X of RAM and up to 3X performance gain transparently for apps Always On Enhancements Increased availability and improved manageability of active secondaries Online Database Operations Increased availability for index/partition maintenance Backup to Azure Easy to implement and cost effective Disaster Recovery solution to Azure Storage HA to Azure VM Easy to implement and cost effective high availability solution with Windows Azure VM Deploy to Azure Deployment wizard to migrate database Better together with Windows Server WS2012 ReFS support Online resizing VHDx Hyper-V replica Extending Power View Enable Power View on existing analytic models and support new multi-dimensional models. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
SQL Server 2014 In-Memory Technology 9/18/2018 SQL Server 2014 In-Memory Technology In-Memory Technologies Applicable to Transactional workloads: Concurrent data entry, processing and retrieval In-Memory OLTP 5-20X performance gain for OLTP integrated into SQL Server In-Memory DW 5-25X performance gain and high data compression Updatable and clustered SSD Bufferpool Extension 4-10X of RAM and up to 3X performance gain transparently for apps Applicable to Decision support workloads: Large scans and aggregates Applicable to Disk-based transactional workloads: Large working (data)set © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Business Trends Moore’s Law means more transistors and therefore cores, but… CPU clock rate stalled… Meanwhile RAM cost continues to drop Chart reference http://www.gotw.ca/publications/concurrency-ddj.htm © 2014 Microsoft Corporation Microsoft Confidential
In-Memory OLTP Architectural Pillars Principles Performance-critical data fits in memory Push decisions to compilation time Conflicts are Rare Built-In Architectural Pillars Main-Memory Optimized T-SQL Compiled to Native Machine Code Non-Blocking Execution SQL Server Integration Direct pointers to rows Indexes exist only in memory No buffer pool No write-ahead logging T-SQL compiled to machine code Procedure and its queries, becomes a C function Aggressive compile- time optimizations Multi-version optimistic Lock-free data structures No locks, latches or spinlocks Simple Management Integrated queries & transactions Integrated HA and backup/restore Results In-memory cache speed with capabilities of a database Queries & business logic run at native-code speed Transactions execute to completion without blocking Hybrid engine and integrated experience
Memory-Optimized Tables 200, ∞ John Beijing Timestamps Name Chain ptrs City Row format Hash index on City B P BW-tree index on Name J S 100, 200 John Paris 90,150 Susan Bogota 50, ∞ Jane Prague 70, 90 Susan Brussels Rows are multi-versioned, each has a valid time range indicated by two timestamps A version is visible if transaction read time falls within the version’s valid time Row can be part of multiple indexes, but there is only a single copy of the row
Create Database 10 | 9/18/2018 | Footer Goes Here
Create Memory Optimized Table Hash Index Collation BIN2 Range Index This table is memory optimized This table is durable © 2014 Microsoft Corporation Microsoft Confidential
Natively Compiled Procedures This proc is natively compiled Native procs must be schema-bound Execution context is required Atomic blocks Create a transaction if there is none Otherwise, create a savepoint Performing alter operations on natively compiled stored procedures is not supported as once again they are compiled into a DLL. One way to modify a natively compiled stored procedure is to drop and recreate the stored procedure: Generate script for the permissions on the stored procedure. Optional, generate script for the stored procedure and save as a backup. Drop the stored procedure. Create the altered stored procedure. Re-apply the scripted permissions to the stored procedure. Creation of a Natively compiled Stored procedure requires the following elements: SCHEMABINDING Natively compiled stored procedures must be bound to the schema of the objects it references. This means that table references by the procedure cannot be dropped. Tables referenced in the procedure must include their schema name, and wildcards (*) are not allowed in queries. EXECUTE AS Natively compiled stored procedures do not support EXECUTE AS CALLER, which is the default execution context. Therefore, specifying the execution context is required. The options EXECUTE AS OWNER, EXECUTE AS user, and EXECUTE AS SELF are supported. BEGIN ATOMIC The natively compiled stored procedure body must consist of exactly one atomic block. Atomic blocks guarantee atomic execution of the stored procedure. If the procedure is invoked outside the context of an active transaction, it will start a new transaction, which commits at the end of the atomic block. Atomic blocks in natively compiled stored procedures have two required options: TRANSACTION ISOLATION LEVEL. See Transaction Isolation Levels for supported isolation levels. LANGUAGE. The language for the stored procedure must be set to one of the available languages or language aliases. Session settings are fixed at create time © 2014 Microsoft Corporation Microsoft Confidential
Demo on In-Memory OLTP Table
SQL Engine With In-Memory
Types of candidate workloads Application has OLTP characteristics Relatively short transactions High degree of concurrency, transactions from many sessions Suited for in-memory processing Critical path data can fit in memory Currently encounter locking or latching bottlenecks Code Characteristics Stored procedures used Code can be modified and isolated to subset of tables or stored procedures © 2014 Microsoft Corporation Microsoft Confidential
Memory Optimized Table Limitations No FOREIGN KEY and no CHECK constraints No schema changes (ALTER TABLE) – need to drop/recreate table No add/remove index – need to drop/recreate table No DML triggers No XML and no CLR data types Rows are at most 8060 bytes – no off row data No Large Object (LOB) types like varchar(max) . 16 | 9/18/2018 | SQL Server 2014: In-Memory Overview
Each complete feedback form gives you a chance at the raffle We want your feedback Each complete feedback form gives you a chance at the raffle
Microsoft Corporation Our Gold Sponsors Microsoft Sri Lanka Pluralsight Microsoft Corporation Brought to you by: