SQL Server 2014: In In-memory OLTP for Database Developers.

Slides:



Advertisements
Similar presentations
new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Advertisements

1. SQL Server 2014 In-Memory by Design Arthur Zubarev June 21, 2014.
In-Memory Technologies Enhanced High Availability New Hybrid Scenarios In-Memory OLTP 5-25x performance gain for OLTP integrated into SQL Server In-Memory.
Big Data Working with Terabytes in SQL Server Andrew Novick
6 SQL Server Integration Same manageability, administration & development experience Integrated queries & transactions Integrated HA and backup/restore.
SQL Server 2014 – Features Drilldown Tara Shankar Jana Senior Premier Field Engineer (Microsoft)
Project “Hekaton” adds in-memory technology to boost performance of OLTP workloads in SQL Server.
Dandy Weyn Sr. Technical Product Mkt.
Planning on attending PASS Summit 2014? The world’s largest gathering of SQL Server & BI professionals Take your SQL Server skills to the.
Microsoft Ignite /16/2017 3:29 PM
Meanwhile RAM cost continues to drop Moore’s Law on total CPU processing power holds but in parallel processing… CPU clock rate stalled… Because.
1 External Sorting for Query Processing Yanlei Diao UMass Amherst Feb 27, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Microsoft SQL Server x 46% 900+ For Hosting Service Providers
Evolving SQL Server for Modern Hardware Paul Larson, Eric N. Hanson, Mike Zwilling Microsoft plus to the many members of the Apollo and Hekaton teams Paul.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server today.
Key Perf considerations & bottlenecks Windows Azure VM characteristics Monitoring TroubleshootingBest practices.
SQL Server 2014: Overview Phil ssistalk.com.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server.
SQL Server 2014 adds in-memory technology to boost performance of OLTP workloads.
Sofia Event Center November 2013 Margarita Naumova
MapReduce and GFS. Introduction r To understand Google’s file system let us look at the sort of processing that needs to be done r We will look at MapReduce.
IN-MEMORY OLTP By Manohar Punna SQL Server Geeks – Regional Mentor, Hyderabad Blogger, Speaker.
Srik Raghavan Principal Lead Program Manager Kevin Cox Principal Program Manager SESSION CODE: DAT206.
Meet Kevin Liu Principal Lead Program Manager Kevin Liu has been with Microsoft and the SQL Server engine team for 7 years, working on key projects like.
Ἑ κατόν by Niko Neugebauer. Niko Neugebauer PASS EvangelistPASS Evangelist SQL Server MVPSQL Server MVP SQLPort ( founder & leaderSQLPort.
Moore’s Law means more transistors and therefore cores, but… CPU clock rate stalled… Meanwhile RAM cost continues to drop.
Buffer Pool Memory Optimized Tables Available Memory Buffer Pool Memory Optimized Tables Buffer Pool Memory Optimized Tables Buffer Pool Memory.
Sofia Event Center November 2013 Margarita Naumova SQL Master Academy.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server today.
CS 440 Database Management Systems Lecture 6: Data storage & access methods 1.
CS 540 Database Management Systems
In-Memory OLTP The faster is now simpler in SQL Server 2016.
PASS Virtual Chapter presentation March 27, 2014.
Vedran Kesegić. About me  M.Sc., FER, Zagreb  HRPro d.o.o. Before: Vipnet, FER  13+ years with SQL Server (since SQL 2000)  Microsoft Certified.
What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently and safely. Provide.
SQL Server 2014: In-Memory OLTP Adoption Considerations Mike
Redmond Protocols Plugfest 2016 Jos de Bruijn, Borko Novakovic SQL In-Memory OLTP Senior Program Manager.
Mladen Prajdić SQL Server MVP Hekaton The New SQL Server In-Memory OLTP Engine.
SQL Server 2016: Real-time operational analytics
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
Memory-Optimized Tables Querying at the speed of light.
In-Memory Capabilities
In-Memory OLTP for DBA Management
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
UFC #1433 In-Memory tables 2014 vs 2016
7/17/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
TechEd /6/2018 7:34 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
9/11/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
SQL Server In-Memory Internals
SQL Server 2014 In-Memory OLTP
SQL Server 2014 In-Memory Overview
Graeme Malcolm | Data Technology Specialist, Content Master
මොඩියුල විශ්ලේෂණය Buffer Pool Extension භාවිතය.
Super Scaling The LMAX Queue Pattern.
In-memory OLTP for the Database Administrator
Migrating a Disk-based Table to a Memory-optimized one in SQL Server
The Vocabulary of Performance Tuning
In-Memory OLTP (IMOLTP) What Can It Do For Me?
Real world In-Memory OLTP
SQL 2014 In-Memory OLTP What, Why, and How
1/3/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Microsoft Ignite /1/ :19 PM
Statistics for beginners – In-Memory OLTP
In-Memory OLTP for Database Developers
The Vocabulary of Performance Tuning
The Vocabulary of Performance Tuning
SQL Server 2014: In-Memory OLTP Overview
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Sunil Agarwal | Principal Program Manager
Presentation transcript:

SQL Server 2014: In In-memory OLTP for Database Developers

In-Memory Technologies Enhanced High Availability New Hybrid Scenarios 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 Buffer Pool 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 Windows “Blue” support Extending Power View Enable Power View on existing analytic models and support new multi- dimensional models. Other investments

In-Memory Technologies In-Memory OLTP 5-25X performance gain for OLTP integrated into SQL Server In-Memory DW 5-30X performance gain and high data compression Updatable and clustered SSD Buffer Pool Extension 4-10X of RAM and up to 3X performance gain transparently for apps

Market need for higher throughput and predictable lower latency OLTP at a lower cost Hardware trends demand architectural changes on RDBMS In-Memory OLTP is:  High performance,  Memory-optimized OLTP engine,  Integrated into SQL Server and  Architected for modern hardware trends

Decreasing RAM cost Moore’s Law on total CPU processing power holds but in parallel processing… CPU clock rate stalled…

SQL Server Integration Same manageability, administration & development experience Integrated queries & transactions Integrated HA and backup/restore Main-Memory Optimized Direct pointers to rows Indexes exist only in memory No buffer pool No write-ahead logging Stream-based storage High Concurrency Multi-version optimistic concurrency control with full ACID support Lock-free data structures No locks, latches or spinlocks No I/O during transaction T-SQL Compiled to Machine Code T-SQL compiled to machine code leveraging VC compiler Procedure and its queries, becomes a C function Aggressive compile-time Steadily declining memory price, NVRAM Many-core processors Stalling CPU clock rateTCO Hardware trends Business Hybrid engine and integrated experience High performance data operations Frictionless scale-up Efficient, business- logic processing Customer Benefits Hekaton Tech Pillars Drivers

Demo Business and User impact

Memory-optimized Table Filegroup Data Filegroup SQL Server.exe Hekaton Engine: Memory_optimized Tables & Indexes TDS Handler and Session Management Native- Compiled SPs and Schema Buffer Pool Execution Plan cache for ad-hoc T-SQL and SPs Application Transaction Log Query Interop Non-durable Table T1 T3 T2 T1 T3 T2 T1 T3 T2 T1 T3 T2 Table s Indexe s T-SQL Interpreter T1 T3 T2 T1 T3 T2 Access Methods Parser, Catalog, Optimizer Hekaton Compiler Hekaton Component Key Existing SQL Componen t Generated.dll 20-40x more efficient Reduced log contention; Low latency still critical for performance Checkpoints are background sequential IO No V1 improvements in comm layers

Despite 20 years of optimizing for existing OLTP benchmarks – we still get 2x on a workload derived from TPC-C Apps that take full advantage: e.g. web app session state Apps with periodic bulk updates & heavy random reads Existing apps typically see 4-7x improvement

CREATE TABLE [Customer]( [CustomerID] INT NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT = ), [Name] NVARCHAR(250) NOT NULL, [CustomerSince] DATETIME NULL INDEX [ICustomerSince] NONCLUSTERED ) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA); This table is memory optimized This table is durable Non-durable tables: DURABILITY=SCHEMA_ONLY Indexes are specified inline NONCLUSTERED indexes are supported Hash Index BUCKET_COUNT 1-2X nr of unique index key values

Demo Table and Stored Procedure Performance Gain

Row headerPayload (table columns) Begin Ts End Ts StmtId IdxLinkCount 8 bytes 4 bytes (padding) bytes 8 bytes * (IdxLinkCount)

50, ∞ JohnParis TimestampsNameChain ptrsCity Hash index on Name Transaction 100: UPDATE City = ‘Prague’ where Name = ‘John’ No locks of any kind, no interference with transaction , ∞ JohnPrague 90, ∞ Susan Bogota f(John) 100 Transaction 99: Running compiled query SELECT City WHERE Name = ‘John’ Simple hash lookup returns direct pointer to ‘John’ row Background operation will unlink and deallocate the old ‘John’ row after transaction 99 completes. Hekaton Principle: Performance like a cache Functionality like a RDMBS

PAGE Page Mapping Table PAGE , ∞ 1 50, Root Non-leaf pages leaf pages Data rows PageID-0 PageID-3 PageID-2 PageID -14  Page size- up to 8K. Sized to the row  Logical pointers  Indirect physical pointers through Page Mapping table  Page Mapping table grows (doubles) as table grows  Sibling pages linked one direction  Require two indexes for ASC/DSC  No in-place updates on index pages  Handled thru delta pages or building new pages  No covering columns (only the key is stored) Key Logical Physical 100,200 1

CREATE PROCEDURE DATETIME WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER AS BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'us_english') -- insert T-SQL here END This proc is natively compiled Native procs must be schema-bound Atomic blocks Create a transaction if there is none Otherwise, create a savepoint Execution context is required Session settings are fixed at create time

Natively Compiled Procs Access only memory optimized tables Maximum performance Limited T-SQL surface area When to use OLTP-style operations Optimize performance critical business logic Accessing Memory Optimized Tables Interpreted T-SQL Access Access both memory- and disk- based tables Less performant Virtually full T-SQL surface When to use Ad hoc queries Reporting-style queries Surface area not available in native

Buffer Pool Memory Optimized Tables Available Memory Buffer Pool Memory Optimized Tables Buffer Pool Memory Optimized Tables Buffer Pool Memory Optimized Tables

Demo Memory Usage and Control

Data File Delta File 0100 TS (ins)RowId TableId TS (ins)RowIdTableId TS (ins)RowIdTableId TS (ins)RowIdTS (del) TS (ins)RowIdTS (del) TS (ins)RowIdTS (del) Checkpoint File Pair Row pay load Transaction Timestamp Range Data file contains rows inserted within a given transaction range Delta file contains deleted rows within a given transaction range

Populating Data/Delta files via sequential IO only Offline Checkpoint Thread Memory-optimized Table Filegroup Range Range Range Range Range 500- New Inserts Delete 450 TS Delete 250 TS Delete 150 TS Data file with rows generated in timestamp range IDs of Deleted Rows (height indicates % deleted) Del Tran2 (TS 450) Del Tran3 (TS 250) Del Tran1(TS150 ) Insert into Hekaton T1 Log in disk Table Del Tran1 (row TS150) Del Tran2 (row TS 450) Del Tran3 (row TS 250) Insert into T1 SQL Transaction log (from LogPool) Data file has pre- allocated size (128 MB or 16 MB on smaller systems) Engine switches to new data file when the current file is full Transaction does not span data files Once a data file is closed, it becomes read- only Row deletes are tracked in delta file Files are append only

Memory-optimized data Filegroup Range Range Range Range Memory-optimized data Filegroup Files as of Time 600 Range Range Range Range Data file with rows generated in timestamp range IDs of Deleted Rows (height indicates % deleted) Merge Deleted Files Files Under Merge Files as of Time 500 Range Range Range Range

Delta map Recovery Data Loader Delta File1 Memory Optimized Tables Recovery Data Loader Delta map Data File1 Delta File2 Data File2 Delta File3 Data File3 filter Memory Optimized Container - 1Memory Optimized Container - 2

Optimal for V1Not Optimal for V1 Business logicIn database (as SPs)In mid-tier Latency and contention locations Concentrated on a sub-set of tables/SPs Spread across the database Client server communicationLess frequentChatty T-SQL surface areaBasicComplex Log IONot limiting factorLimiting factor Data sizeHot data fit in memoryUnbounded hot data size

Demo Analysis and Migration tools

TimeTransaction T1 (SNAPSHOT)Transaction T2 (SNAPSHOT) 1BEGIN 2 3UPDATE t SET c1=‘value2’ WHERE c2=123 4UPDATE t SET c1=‘value1’ WHERE c2=123 (write conflict) First writer wins

Disk-based tablesMemory-optimized tables Tab1TabnTab1Tabm Regular Tx contextMem-opt Tx context

Disk-basedMemory optimizedUsage recommendations READCOMMITTEDSNAPSHOT Baseline combination – most cases that use READCOMMITTED today READCOMMITTEDREPEATABLEREAD/ SERIALIZABLE Data migration Hekaton-only Interop REPEATABLEREAD/ SERIALIZABLE SNAPSHOT Memory-optimized table access is INSERT-only Useful for data migration and if no concurrent writes on memory-optimized tables (e.g., ETL) Disk-basedMemory optimized SNAPSHOT Any isolation level REPEATABLEREAD/ SERIALIZABLE REPEATABLEREAD/ SERIALIZABLE Supported isolation level combinations (V1) Unsupported isolation level combinations (V1)