Presentation is loading. Please wait.

Presentation is loading. Please wait.

In-Memory OLTP in SQL Server 2016 and Azure SQL Database

Similar presentations


Presentation on theme: "In-Memory OLTP in SQL Server 2016 and Azure SQL Database"— Presentation transcript:

1 In-Memory OLTP in SQL Server 2016 and Azure SQL Database
Microsoft Ignite 2016 2/4/2018 8:58 PM BRK3097 In-Memory OLTP in SQL Server 2016 and Azure SQL Database Jos de Senior Program Manager © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Agenda Motivation and review of In-Memory OLTP
In-Memory OLTP in Azure SQL DB Improvements in SQL Server 2016

3 There’s an opportunity to drive smarter decisions with data
The explosion of data sources... 25B 4.0B 1.3B 2010 2013 2020 There’s an opportunity to drive smarter decisions with data …drives an explosion of data CAGR = 41% …which drives businesses to learn more and do more faster Source: Forecast: Internet of Things, Endpoints and Associated Services, Worldwide, Gartner. Oct Source: IDC “Digital Universe”, Dec. 2012

4 SQL In-Memory Technologies
2/4/2018 SQL In-Memory Technologies SQL Real-Time Analytics In 2016 and Azure DB Faster Transactions Faster Analytics + IN-MEMORY OLTP + IN-MEMORY DW Up to 30x faster transaction processing with In-Memory OLTP Over 100x query speed and significant data compression with In-Memory ColumnStore Using the same tables © 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.

5 Why In-Memory OLTP Customer demand for ever higher concurrency and lower latency, at a lower cost Hardware trends demand architectural changes on RDBMS to meet those demands (large memory, many CPU cores) In-memory OLTP is: High performance, Memory-optimized OLTP engine, Integrated into SQL Server and Architected for modern hardware

6 SQL Server In-Memory OLTP
Optimized for OLTP workloads Memory-optimized data structures for efficient data access Lock/Latch free access for linear scaling Native Compilation of T-SQL Modules for efficient execution Fully integrated into SQL Server No new license or product Familiar tools Integrated Security and High Availability No/Limited Application Changes Available in SQL Server and Azure SQL DB Performance numbers Up to 30X performance improvement compared with traditional tables and stored procs Actual gain depends on app pattern; typical gains: 2X-10X Perf numbers in testing (4S server): 10M rows ingested per second 1.2GB/s of log generation 360K transactions per second for order processing workload bwin.party experiences with ASP.NET session state Consolidate 18 servers -> 1 in production 1M requests/sec in testing

7 In-Memory OLTP features
TechReady 23 2/4/2018 8:58 PM In-Memory OLTP features Memory-Optimized Tables Data storage in memory-optimized structures Compiled into DLLs for efficient data access Default SCHEMA_AND_DATA (fully logged); support SCHEMA_ONLY (not logged) Memory-Optimized Table Types Memory-optimized table variables live in memory, in user DB (no tempdb, no IO) Can be used for TVPs and table variables in all stored procs (not just native) Natively Compiled Stored Procedures Optimize performance of OLTP-style operations Not suitable for reporting/analytics style queries Natively Compiled Scalar User-Defined Functions Do not require memory-optimized tables if there is no data access © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

8 Customer Performance Gains
Data insertion at NoSQL speeds, with real-time analytics Bwin.party – consolidate 18 SQL Servers -> 1; 1M requests/sec with 2016 EdgeNet – 10X perf gain for data ingestion SBI Liquidity – 2X throughput; 4X latency improvement CJ E&M – 35X transaction throughput

9 In-Memory OLTP Perf Gain Demo
Sources: In-Memory OLTP perf demo Memory-optimized table variables and temp tables

10 Memory-Optimized Indexes
Exist only in memory Rebuilt on database startup (except for columnstore) Do not contain data rows Indexes contain memory pointers to the data rows All indexes are covering (no bookmark lookups, no included columns) Indexes are self-maintaining Nonclustered Indexes Dynamic index – grows/shrinks with data No need to specify any options Optimized for range and ordered scans Hash Indexes Static index – size does not change Specify bucket_count – usually 1-2X the number of unique index keys Optimized for point-lookups and inserts Columnstore Indexes Secondary copy of data, in compressed columnstore format Optimized for analytics: large scans and aggregation – see BRK3071

11 Index Considerations Choosing HASH vs. NONCLUSTERED
TechReady 18 2/4/2018 Index Considerations Choosing HASH vs. NONCLUSTERED NONCLUSTERED is the safe baseline, as it supports all operations Use HASH to optimize inserts and point lookups – inequality seeks and ordered scans not supported You can have both types of indexes on the same columns Hash Index Bucket Count Choose at least as many buckets as unique index key values – over-sizing is usually OK Automatically rounds up to the next power of 2 In case of many duplicates use a NONCLUSTERED index Hash Index Key Columns Does not support seek on subset of key columns Index key must include exactly the columns you are searching on Nonclustered Index Key: Choose direction (ASC/DESC) that conforms to ORDER BY requirement © 2014 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.

12 Accessing Memory Optimized Tables
TechReady 16 2/4/2018 Accessing Memory Optimized Tables Natively Compiled Stored Procs Access only memory optimized tables Maximum performance for OLTP Not suitable for analytics Limitations on T-SQL surface area When to use OLTP-style operations DML (insert/update/delete) Queries touch limited number of rows The more statements and the more complex the logic in a single proc -> the better the perf benefits Interpreted T-SQL Access Access both memory- and disk-based tables Maximum performance for analytics Virtually full T-SQL surface When to use Ad hoc queries Reporting-style queries Queries touching large nrs of rows (e.g., table scans) Parallel queries (native modules are single-threaded) Recommendation: Use native compilation for most perf-critical stored procedures Test performance of native vs. interpreted T-SQL © 2013 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.

13 In-Memory OLTP in Azure SQL Database

14 In-Memory OLTP for Azure SQL DB
In Public Preview for New Premium Databases Planned: GA (H2 CY2016) to support Elastic Pools Managed Service No need to manage filegroup No need to bind database to a resource pool for memory management Data size: P1 – 1GB user data size P2 – 2GB user data size P6 – 8GB user data size P11 – 14GB user data size P15 – 30GB user data size Full In-Memory OLTP Surface Area Includes all SQL Server 2016 features New features are released to Azure SQL DB as soon as they are completed CASE and sp_rename in the pipeline

15 Tooling Improvements

16 Performance improvements
Throughput: Sustained log generation rate 1GB/s Numerous improvements under the hood Persisted Main Memory for Tail of the Log Parallel plans and parallel scan of memory-optimized tables and indexes Heap scan

17 Programmability improvements
Tables Collations: Full collations support in index key columns All code pages supported for (var)char columns Constraints FOREIGN KEY CHECK UNIQUE constraints and indexes LOB types: [n]varchar(max) and varbinary(max) Row size >8060 bytes NULLable index key columns DML triggers on memory-optimized tables (AFTER) Row-Level Security Always Encrypted Temporal Tables (history lives on-disk) MARS (Multiple Active Result Sets) support Native Compilation Full collations support in native modules Query surface area {LEFT|RIGHT} OUTER JOIN Disjunction (OR, NOT) UNION [ALL] SELECT DISTINCT Subqueries (EXISTS, IN, scalar) Nested Stored procedures (EXECUTE) Natively Compiled Scalar UDFs Access from both native and interop Improves perf of scalar UDFs in traditional workload if no table access is required Natively Compiled Inline TVFs EXECUTE AS CALLER Query Store

18 Manageability improvements
Improved SSMS experience Lightweight Performance Analysis in SSMS Generate migration checklists to evaluate all tables/procedures for migration ALTER support for procedures and tables Full ALTER TABLE/PROCEDURE support Index management through ALTER TABLE … ADD/ALTER/DROP INDEX Limitation: ALTER TABLE offline for now; ALTER of 10GB table takes 1.5 minutes in RTM (improvements inbound) No ALTER between disk-based and memory-optimized TDE (Transparent Data Encryption) All on-disk data files are now encrypted once TDE is enabled Stats improvements: auto-update and sampled stats Statistics management is not on par with disk-based tables No limits on data size SQL2014 limitation: 256GB in durable tables SQL2016 has no limitation, other than available storage (i.e., memory) Windows Server 2016 supports up to 24TB of memory

19 New T-SQL surface area Jos de Bruijn

20 Remaining Unsupported Features
Tables DDL triggers and Transactional DDL Data types: XML, Spatial, CLR types, datetimeoffset, rowversion, sql_variant ALTER TABLE ONLINE Cross-container transaction limitations: snapshot/snapshot, serializable/serializable; SAVEPOINT Online Migration of disk-based tables to memory- optimized Sp_rename Interpreted T-SQL: cross-database queries, MERGE INTO, locking hints Native Compilation CASE, MERGE, JOIN in UPDATE/DELETE; VIEWs Natively Compiled Table-Valued Functions Automatic and statement-level recompile Access to disk-based tables Must be schema-bound; no dynamic T-SQL Parallelism; limitations in query operators (hash join/agg, merge join) Management: replication; DB snapshot; CDC; compression

21 Recap In-Memory OLTP offers extreme transaction processing performance
Memory-optimized data access and native compilation for low latency Lock- and latch-free architecture for linear scaling with hardware resources SQL Server 2016 offers big improvements Much easier to use due to programmability and manageability improvements Big enhancements in performance and scalability Now in Azure SQL Database (Premium DB) Now in Preview; general availability soon*

22 Related Content Where and how to use In-Memory OLTP
9/27 9am BRK3030: Review Columnstore Index in SQL Server 2016 and Azure SQL DB 9/27 10:45am BRK3097: Review In-Memory OLTP in SQL Server 2016 and Azure SQL DB 9/27 2:15pm BRK3071: Enable operational analytics in SQL Server 2016 and Azure SQL DB 9/28 2:00pm BRK2231: Understand how ChannelAdvisor is using SQL Server 2016 9/28 4pm BRK2007: Accelerate SQL Server 2016 HTAP performance with Windows 2016 and HPE 9/29 9am BRK3223: Understand how Attom Data Solutions is using SQL Server 2016 to accelerate their business 9/29 2:15pm BRK3103: Explore In-Memory OLTP architectures and customer case studies 9/30 10:45am BRK2083: Hear customer success stories with columnstore index in SQL Server 2016 9/30 12:30pm BRK3094: Accelerate SQL Server 2016 to the max: lessons learned from customer engagements Where and how to use In-Memory OLTP

23 Resources Samples Documentation Migrating apps Related videos
2/4/2018 8:58 PM Resources Samples Perf demo WideWorldImporters sample DB IoT sample leveraging temporal tables (release page) Azure DB Sample Enable database for In-Memory OLTP SQL Server Samples GitHub Repository Documentation Blog on In-Memory OLTP in SQL 2016 Memory-optimized table variables and temp tables MSDN Documentation for In-Memory OLTP Azure DB documentation for In-Memory What’s new in SQL2016 Migrating apps In-Memory OLTP Common Workloads and Migration Considerations Migrating to In-Memory OLTP Guidelines for using Indexes Related videos Microsoft Virtual Academy talks Recent investments in In-Memory OLTP © 2013 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.

24 Appendix: demo script use WideWorldImporters go -- verify indexes
-- new table functionality DROP TABLE IF EXISTS dbo.Products GO DROP TABLE IF EXISTS dbo.Orders ProductID int IDENTITY PRIMARY KEY NONCLUSTERED, ( CREATE TABLE dbo.Products -- character column with non-Latin code page -- multiple large columns ListPrice numeric(34,18) NULL, Name varchar(100) COLLATE Frisian_100_CI_AI NOT NULL, Annotations nvarchar(4000), Description nvarchar(4000), Notes nvarchar(max), -- LOB columns Comments nvarchar(4000), CONSTRAINT CHK_ProductListPrice CHECK (ListPrice >= 0), -- CHECK constraint INDEX ix_Name (Name) -- index on non-BIN2 column(s) ) WITH (MEMORY_OPTIMIZED=ON) -- add index after table creation ADD INDEX ix_ListPrice (ListPrice) ALTER TABLE dbo.Products -- index on nullable column(s) CREATE TABLE dbo.Orders Quantity int NOT NULL, ProductID int NOT NULL INDEX ix_ProductID, OrderID bigint IDENTITY, NONCLUSTERED HASH (OrderID) WITH (BUCKET_COUNT= ), CONSTRAINT PK_Orders PRIMARY KEY -- foreign key FOREIGN KEY (ProductID) REFERENCES dbo.Products(ProductID) CONSTRAINT FK_Orders_ProductID -- change hash index bucket count REBUILD WITH (BUCKET_COUNT= ) ALTER INDEX PK_Orders ALTER TABLE dbo.Orders SELECT name, index_id, bucket_count -- verify hash indexes WHERE object_id=OBJECT_ID(N'dbo.Orders') FROM sys.hash_indexes CREATE FUNCTION dbo.ufn_GetSalesOrderStatusText tinyint) -- natively compiled scalar user-defined function AS WITH NATIVE_COMPILATION, SCHEMABINDING RETURNS nvarchar(15) BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'English') RETURN 'Approved' RETURN 'In Process' RETURN 'Shipped' RETURN 'Rejected' RETURN 'Backordered' RETURN 'Cancelled' RETURN '** Invalid **' END -- =============================================================== auto-update stats -- inspect plan select * from dbo.Orders o join dbo.Products p on o.ProductID=p.ProductID DBCC SHOW_STATISTICS ('dbo.Orders', ix_ProductID) -- inspect stats SET NOCOUNT ON -- insert dummy data INSERT dbo.Products (Name) VALUES ('Product1') BEGIN TRAN BEGIN < 10000 int = 0 += 1 INSERT dbo.Orders VALUES (1,1) COMMIT

25 Free IT Pro resources To advance your career in cloud technology
Microsoft Ignite 2016 2/4/2018 8:58 PM Free IT Pro resources To advance your career in cloud technology Plan your career path Microsoft IT Pro Career Center Cloud role mapping Expert advice on skills needed Self-paced curriculum by cloud role $300 Azure credits and extended trials Pluralsight 3 month subscription (10 courses) Phone support incident Weekly short videos and insights from Microsoft’s leaders and engineers Connect with community of peers and Microsoft experts Get started with Azure Microsoft IT Pro Cloud Essentials Demos and how-to videos Microsoft Mechanics Connect with peers and experts Microsoft Tech Community © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

26 Please evaluate this session
2/4/2018 8:58 PM Please evaluate this session Your feedback is important to us! From your PC or Tablet visit MyIgnite at From your phone download and use the Ignite Mobile App by scanning the QR code above or visiting © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

27 Thank you!


Download ppt "In-Memory OLTP in SQL Server 2016 and Azure SQL Database"

Similar presentations


Ads by Google