Real world In-Memory OLTP

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

Big Data Working with Terabytes in SQL Server Andrew Novick
Module 4 Working with Databases. Module Overview Overview of SQL Server Databases Working with Files and Filegroups Moving Database Files.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Meanwhile RAM cost continues to drop Moore’s Law on total CPU processing power holds but in parallel processing… CPU clock rate stalled… Because.
Keith Burns Microsoft UK Mission Critical Database.
Russ Houberg Senior Technical Architect, MCM KnowledgeLake, Inc.
Performance and Scalability. Performance and Scalability Challenges Optimizing PerformanceScaling UpScaling Out.
Exam QUESTION CertKiller.com has hired you as a database administrator for their network. Your duties include administering the SQL Server 2008.
Chapter 2: Designing Physical Storage MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide (70-443)
Key Perf considerations & bottlenecks Windows Azure VM characteristics Monitoring TroubleshootingBest practices.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Database Technical Session By: Prof. Adarsh Patel.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server.
Roy Ernest Manager of DBA Dept Pinnacle Sports Worldwide
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.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
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.
Connect with life Vinod Kumar Technology Evangelist - Microsoft
Session 1 Module 1: Introduction to Data Integrity
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Sofia Event Center November 2013 Margarita Naumova SQL Master Academy.
Your Data Any Place, Any Time Performance and Scalability.
Danny Tambs – Senior Consultant Microsoft.
Your Data Any Place, Any Time Always On Technologies.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
In-Memory OLTP The faster is now simpler in SQL Server 2016.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
SQL Server 2014: In-Memory OLTP Adoption Considerations Mike
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
Use Cases for In-Memory OLTP Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
Memory-Optimized Tables Querying at the speed of light.
Partial Database Availability
You Inherited a Database Now What?
In-Memory Capabilities
Temporal Databases Microsoft SQL Server 2016
In-Memory OLTP for DBA Management
Flash Storage 101 Revolutionizing Databases
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
UFC #1433 In-Memory tables 2014 vs 2016
Very Large Databases in your future
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Installation and database instance essentials
# - it’s not about social media it’s about temporary tables and data
TechEd /6/2018 7:34 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
# - it’s not about social media it’s about temporary tables and data
SQL Server In-Memory Internals
Introduction to SQL Server Management for the Non-DBA
Super Scaling The LMAX Queue Pattern.
Your Data Any Place, Any Time
Configuring SQL Server
SQL 2014 In-Memory OLTP What, Why, and How
KISS-Tree: Smart Latch-Free In-Memory Indexing on Modern Architectures
Very large Databases in your future Eric Peterson.
Configuring SQL Server
In Memory OLTP Not Just for OLTP.
In-Memory OLTP for Database Developers
You Inherited a Database Now What?
Bulk Load and Minimal Logging
SQL Server 2016 In-Memory OLTP for the DBA
Hybrid Buffer Pool The Good, the Bad and the Ugly
Presentation transcript:

Real world In-Memory OLTP Ned Otter| SQL Strategist #575 | Providence 2016

Passionate about SQL Server Obsessed with In-Memory OLTP About me SQL Server DBA since 1995 MCSE Data Platform Passionate about SQL Server Obsessed with In-Memory OLTP

KEY TAKEAWAYS ARCHITECTURE RTO RESOURCES

Express (352 MB) Web (16 GB) Standard (23 GB) Enterprise (OS limit) Editions, as of SQL 2016/SP1 Express (352 MB) Web (16 GB) Standard (23 GB) Enterprise (OS limit)

Desired workload characteristics Concurrency High Write level Intensive Latency/Contention “localized” Hot data Bounded Business logic in Database

Use cases Workload won’t scale Intensive business logic Low latency Session state TempDB bottleneck Interpreted TSQL bottleneck ETL staging

ARCHITECTURE

Lock free != WAIT FREE

Data/delta files 001 to 100 101 to 200 201 to 300 301 to 400

Data/delta files DATABASE FILEGROUP CONTAINER (FOLDER)

IN-MEM DB ARCHITECTURE FILEGROUPS MEMORY-OPTIMIZED Container1 DATA/DELTA Container2 PRIMARY MDF LDF OFFLINE CKPT THREAD

Data/delta files Shared CFP IFI

RECOVERY

Why is the number and placement of containers absolutely critical?

MEMORY-OPTIMIZED TABLES Recovery process MEMORY-OPTIMIZED TABLES CONTAINER 1 CONTAINER 2 CONTAINER 3 CONTAINER 4

Recovery events SQL service restart Server reboot RESTORE OFFLINE/ONLINE SQL service restart RESTORE Server reboot

Potential recovery issues In-Mem FG CPU bound FCI/AG

RESTORE

RESTORE (1)

RESTORE (2)

RESTORE FILELISTONLY RESTORE will fail without enough memory LogicalName PhysicalName Type FileGroupName Size MyDBData h:\SQLData\MyDB.mdf D PRIMARY 104857600 MyDBlog h:\SQLData\MyDB.ldf L NULL MyDBFG1 h:\SQLDATA\FG1 S FG1 30945575359 MyDBFG2 h:\SQLDATA\FG2 FG2 61891150718

CORRUPTION

Corruption: Detection and Recovery (1) Method Harddrive Memory CHECKTABLE YES NO CHECKDB Page-level restore (mirroring/AG) n/a Recover data from NC indexes Hack attach RESTORE … REBUILD LOG

Corruption: Detection and Recovery (2) BLOCK CHECKSUM

Corruption: Detection and Recovery (3) CHECKDB Alternative: BACKUP <mem-optimized FG> TO DISK = ‘nul’

ROW VERSIONS

Row versions (1) Memory-optimized Harddrive-based

Row versions (2) Row = version!!! INDEX MEMORY VERSION 1 V1 VERSION 2

Row versions (3) UPDATE DELETE

EXISTING ROW VERSIONS = 1 begin1 end1 201 to 300 DELETE EXISTING ROW VERSIONS = 1

Row versions (5) 201 to 300 DELETE TOTAL ROW VERSIONS = 1 VERSION 1 begin1 end1 2016-08-06 13:56:35 201 to 300 DELETE TOTAL ROW VERSIONS = 1

EXISTING ROW VERSIONS = 1 UPDATE VERSION 1 begin1 end1 EXISTING ROW VERSIONS = 1

EXISTING ROW VERSIONS = 1 INSERT DELETE = + VERSION 1 begin1 end1 UPDATE EXISTING ROW VERSIONS = 1

EXISTING ROW VERSIONS = 1 INSERT = + VERSION 1 begin1 end1 UPDATE DELETE 2016-08-06 13:56:35 EXISTING ROW VERSIONS = 1

Row versions (9) UPDATE = DELETE + INSERT TOTAL ROW VERSIONS = 2 begin1 end1 begin2 end2 UPDATE DELETE 2016-08-06 13:56:35 TOTAL ROW VERSIONS = 2

Row versions (10) … What could possibly go wrong???? VERSION 1 begin1 end1 VERSION 2 begin2 end2 … What could possibly go wrong????

Buffer Pool

RESOURCE GOVERNOR Initial binding Resource pool % Monitoring

GARBAGE COLLECTION

Garbage Collection: Identify ROWS IN MEMORY VERSION 1 VERSION 2 VERSION 3 INDEX V1 V3 V2 SCAN SELECT * FROM table WHERE col = x

Garbage Collection: Unlink ROWS IN MEMORY VERSION 1 VERSION 2 VERSION 3 INDEX V3 SCAN SELECT * FROM table WHERE col = x

Garbage Collection: Schedule SELECT * FROM table WHERE col = x SELECT * FROM table WHERE col = y SCH0 1..16 SCH1

Garbage Collection: Schedule SELECT * FROM table WHERE col = x SELECT * FROM table WHERE col = y SCH0 SCH1

Garbage Collection – review Background Self-throttling Shared workload Long/cancelled transactions Table variables

Memory usage COMPRESSION PAGING

Capacity planning MEMORY

Capacity planning, Memory Indexes Row versions Table variables Temporal/Staging Index/data growth Sorting (NC)

Capacity planning STORAGE

Data/delta files 001 to 100 101 to 200 201 to 300 301 to 400

Capacity planning, Storage FOOTPRINT GROWTH BACKUPS CONTAINERS WORKLOAD IO RTO

MIGRATING DATA

Loading data Item Hard Drive Memory- optimized Recovery model BULK n/a Create clustered index before load YES Drop nonclustered indexes before load NO Multiple clients to load

Considerations for migrating data SELECT INTO TLOG BUCKET COUNT DURABILITY

Benchmark - source table on SSD Sessions Rows in batch Duration Rows inserted 1 3 minutes 1,248,433 10 100 seconds 5 million 100 24 seconds 1000 13 seconds 2 17 seconds 10 million 3 15 million

Migrating data: cross-database (1) Source Destination Cross-database Disk table Memory table Not directly Disk*

Migrating data: cross-database (2)

Migrating data: cross-database (3)

ALTER TABLE

ALTER TABLE Can be single-threaded/fully logged Executes OFFLINE

HOT/COLD

Hot/Cold data requirements Hot data in-memory Cold data on harddrive Referential integrity

Referential Integrity requirements VALIDATE PARENTID NO ORPHANS

Sample tables CUSTOMERS ORDERS

CUSTOMERS (in-mem) HOT: ORDERS (in-mem) COLD: ORDERS (harddrive) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) COLD: ORDERS (harddrive) DISK

HOT: ORDERS (in-mem) CUSTOMERS (harddrive) COLD: ORDERS (harddrive) MEMORY HOT: ORDERS (in-mem) CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK

Scenario 1 PARENT TABLE IN-MEMORY

Sample scenario (1) A CUSTOMERS HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) COLD: ORDERS (harddrive) DISK

Sample scenario (1) B CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK

Sample scenario (1) C CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK

Sample scenario (1) D CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) FK MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK FK COLD: ORDERS (harddrive) DISK

Sample scenario (1) E CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) FK MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK FK COLD: ORDERS (harddrive) DISK

Scenario 2 PARENT TABLE IN-MEMORY

Sample scenario (2) A CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK

Sample scenario (2) B CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK TRIGGER

Sample scenario (2) C CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK TRIGGER

Sample scenario (2) D CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK TRIGGER

Sample scenario (2) E CUSTOMERS FK HOT: ORDERS (in-mem) (in-mem) MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK COLD: ORDERS (harddrive) DISK TRIGGER

Scenario 3 PARENT TABLE HARDDRIVE-BASED

Sample scenario (3) A HOT: ORDERS (in-mem) CUSTOMERS (harddrive) MEMORY HOT: ORDERS (in-mem) CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Sample scenario (3) B HOT: ORDERS (in-mem) TRIGGER CUSTOMERS MEMORY HOT: ORDERS (in-mem) TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Sample scenario (3) C HOT: ORDERS (in-mem) TRIGGER CUSTOMERS MEMORY HOT: ORDERS (in-mem) TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Sample scenario (3) D DML HOT: ORDERS (in-mem) TRIGGER CUSTOMERS MEMORY HOT: ORDERS (in-mem) TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Sample scenario (3) E DML HOT: ORDERS (in-mem) TRIGGER CUSTOMERS MEMORY HOT: ORDERS (in-mem) INTEROP PROC TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Sample scenario (3) F DML HOT: ORDERS (in-mem) TRIGGER CUSTOMERS MEMORY HOT: ORDERS (in-mem) INTEROP PROC TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Scenario 4 TEMPORAL

Sample scenario 4a: Temporal MEMORY CUSTOMERS (in-mem) Temporal ORDERS (in-mem) Temporal FK CUSTOMERS (harddrive) History ORDERS (harddrive) History DISK FK

Sample scenario 4b: Temporal MEMORY CUSTOMERS (in-mem) Temporal ORDERS (in-mem) Temporal FK HOT AND COLD DATA IN MEMORY CUSTOMERS (harddrive) History ORDERS (harddrive) History DISK FK

Scenario 5 DUPLICATE PARENT

Sample scenario 5: dupe parent MEMORY CUSTOMERS (in-mem) HOT: ORDERS (in-mem) FK TRIGGER CUSTOMERS (harddrive) COLD: ORDERS (harddrive) DISK FK

Hot/Cold data – possible approaches Partitioning: NO FK: YES, but… Triggers: YES , but… Temporal: NO

Hardware Log volume Data volume NUMA Soft NUMA

KEY TAKEAWAYS ARCHITECTURE RTO RESOURCES

Connect items Unknown memory requirements for restoring a backup containing memory-optimized data: http://bit.ly/1QntGy6 Excessive memory usage for memory- optimized table variable with RANGE index: http://bit.ly/28Nvm7t

Thanks! t: @NedOtter e: ned@nedotter.com http://www.nedotter.com Ned Otter | SQL Strategist #575 | Providence 2016