Presentation is loading. Please wait.

Presentation is loading. Please wait.

| Basel SQL Server 2014: In- Memory OLTP Stéphane Haby - Stéphane Savorgnano Consultant dbi services.

Similar presentations


Presentation on theme: "| Basel SQL Server 2014: In- Memory OLTP Stéphane Haby - Stéphane Savorgnano Consultant dbi services."— Presentation transcript:

1 | Basel SQL Server 2014: In- Memory OLTP Stéphane Haby - Stéphane Savorgnano Consultant dbi services

2 Agenda Introduction How to process? Memory optimized objects Concurrency control Demo Conclusion

3 | Basel Introduction Chapter 1/6

4 Introduction Stéphane Savorgnano Consultant Mobile Stéphane Haby Delivery Manager Senior Consultant Mobile

5 Introduction dbi services Experts At Your Service  30 specialists in IT infrastructure  Certified, experienced, passionate Based In Switzerland  100% self-financed Swiss company  More than CHF 3 mio. in sales Leading In Infrastructure Services  Over 70 customers in CH, D, & F  30 SLAs dbi FlexService signed

6 Introduction Project Hekaton Delivering the feature In-Memory OLTP  Algorithms optimized for accessing in-memory data  Optimistic concurrency control: eliminate logical locks due to automatic snapshot isolation with multiple versioning  Lock free and latch free structures to access data Started around 4 years ago The goal Boost performance of OLTP workloads  Using new memory optimized technology

7 Introduction

8 | Basel How to process? Chapter 2/6

9 How to process?

10 | Basel Memory Optimized Objects Chapter 3/6

11 Filegroup

12 Memory Optimized Objects New kind of filegroup have been created  To contain memory optimized objects  Filegroup Container is first similar to filestream

13 Memory Optimized Objects Internal representation

14 Tables and Indexes

15 Memory Optimized Objects Tables and indexes can be created by script as usual A new type of index appear: Hash index  It is a non clustered index  Need the option bucket_count to know the size of the index (twice the size of the rows expected)

16 Memory Optimized Objects Table creation When the script is executed  A CREATE TABLE DDL code is generated  This CREATE TABLE DDL is transformed in a C program  This C program is compiled  A DLL is produced  The DLL is loaded in memory Files created for each table:

17 Memory Optimized Objects Hash Indexes  Use Hash function(f)  Maps randomly values to buckets  Defined in the system  Bucket_count  Number of slot in the hash index  Array of 8-byte memory pointers Hash mapping(with Bucket_count = 8): f(Yann) f(Greg) f(Steph) f(Audi) f(Mercedes), f(VW) Hash Collisions

18 Memory Optimized Objects 40, ∞ StephAudi TimestampsNameChain ptrsCarMaque Hash index on CarMaque Hash index on name 80, ∞ GregMercedes f(Greg) f(Steph) f(Audi) f(Mercedes)

19 Memory Optimized Objects 40, ∞ StephAudi TimestampsNameChain ptrsCarMaque Hash index on CarMaque Hash index on name 80, ∞ GregMercedes f(Audi) 90, ∞ YannAudi f(Yann) T90: Insert(Yann, Audi)

20 Memory Optimized Objects 40, ∞ StephAudi TimestampsNameChain ptrsCarMaque Hash index on CarMaque Hash index on name 80, ∞ GregMercedes 90, ∞ YannAudi T120: Delete(Greg, Mercedes) 80, 120

21 Memory Optimized Objects 40, ∞ StephAudi Timestamps Name Chain ptrsCarMaque Hash index on CarMaque Hash index on name 80, ∞ GregMercedes 90, ∞ YannAudi T180: Update(Yann, Audi) to (Yann, Mercedes) 80, , ∞ YannMercedes 90, 180 f(Yann) f(Mercedes)

22 Memory Optimized Objects 40, ∞ StephAudi Timestamps Name Chain ptrsCarMaque Hash index on CarMaque Hash index on name T220: Garbage collector 80, ∞ GregMercedes80, , ∞ YannMercedes 90, ∞ YannAudi90, 180 f(Yann) f(Mercedes) f(Audi) f(Steph)

23 Memory Optimized Objects Limitations on tables for version CTP1 No foreign key and check constraints No identity (now available with CTP2, just (1,1)) Cannot alter table, need to drop and recreate the table Cannot add or remove an index, need to drop and recreate table No LOB(Large Object) like nvarchar(max) Max size for a row is 8060 bytes(optimized for in–memory) No DML Triggers No XML or CLR data types

24 Stored Procedures

25 Memory Optimized Objects Stored procedure can be created by script with special arguments No alter procedure possible, need to drop and recreate the procedure

26 Memory Optimized Objects When the script is executed  A CREATE PROC DDL code is generated  The query is optimized  A C program is generated for CREATE PROC DLL  This C program is compiled  A DLL is produced  The DLL is loaded in memory Files created for each Stored procedure(same files than for a table)

27 Memory Optimized Objects How to work with in-Memory tables T-SQL  Possibility to access in the same script in-memory and disk based tables  Less efficient  But all T-SQL Surface When to use  Adhoc queries  Reporting queries  Migration queries Natively compile Stored Procedures  Cannot access disk tables, only in- memory tables  Very efficient  Limited T-SQL Surface(or, outer join…) When to use  OLTP style operations  Critical performance operations

28 | Basel Concurrency control Chapter 4/6

29 Concurrency control In-Memory table  Multi-version: each tables can have multiple versions of each rows  Transaction isolation level is snapshot based  Transaction semantic is optimistic: always assume that a transaction is going to commit(no locks, no latches)  Conflict detection to ensure isolation(no deadlocks) Disk based table  Locking and blocking to guaranty isolation (even with snapshot or read committed snapshot you use locking for write)

30 | Basel Demo Chapter 5/6

31 Demo

32 | Basel Conclusion Chapter 6/6

33 Conclusion New memory optimized tables New hash indexes New natively compiled stored procedures Bring best performance Multi-versioned rows, snapshot based isolation Optimistics: no locking, conflict detection T-SQL limitations Cannot alter in-memory tables Cannot alter natively compiled stored procedures

34 Conclusion SQL Server 2014 web site SQL Server 2014 CPT2 download SQL Server 2014 CTP2: In-Memory Advisor for Tables and Stored

35


Download ppt "| Basel SQL Server 2014: In- Memory OLTP Stéphane Haby - Stéphane Savorgnano Consultant dbi services."

Similar presentations


Ads by Google