www.facebook.com/prpass
SQL Server 2014 In-Memory OLTP
Migration Overview
Jose L. Rivera
PASS Global Spanish VC Leader
MVP | MCTS | MCITP | MCSA
• Microsoft SQL Server MVP
• Líder del Capítulo Global PASS en Español
• VP - Puerto Rico PASS
• Profesional de Bases de Datos con mas de 10 años
usando SQL Server y tecnologías relacionadas
• Especializado en ETL e Inteligencia de Negocios
• Blog: http://sqlconqueror.com
• Email: jose@sqlconqueror.com
/SQLConqueror
 Weekly Meetings
 Different Time Zones
 Spanish speakers from
all over the globe!
/SpanishPASSVC
/user/SpanishPASSVC
/SpanishPASSVC
http://globalspanish.sqlpass.org
Agenda
 In-Memory OLTP Overview
 In-Memory Implementation
 Migration Scenarios
 Q&A
What’s in SQL Server 2014
In-Memory
Technologies
Hybrid
Scenarios
Enhanced
HA/DR
Other
Investments
In-Memory OLTP?
 Memory-optimized OLTP engine
 High performance
 Full integration into SQL Server
 Architected for modern hardware
Hardware Trends
 More complex CPUs
 CPU clock rate stalled
 Parallel processing
 RAM is really cheap!
 SSD: Minimize IO bottleneck
In-Memory OLTP Benefits
Reduce
Contention
Reduce
Logging
Minimize
execution
time
Lower
Latency
Pre-Implementation Requirements
 Enough memory and disk space
 cmpxchg16b instruction support (in most
64bit processors)
 Database should not exceed 250 GB
 At least 2 or 4 sockets and fewer than 60
cores
Limitations
 memory-optimized filegroup cannot be
deleted (Yes! DROP DATABASE)
 No triggers, LOBs, XML, CLR
 No FOREIGN KEY, CHECK
 No schema changes, add/remove index
(drop/recreate only)
Memory optimized Structures
• Tables, Indexes, SPs
Row Format
Row header Payload (table columns)
Begin Ts End Ts StmtId IdxLinkCount
8 bytes 8 bytes 4 bytes 2 + 2 (padding)
bytes
8 bytes * (IdxLinkCount)
Memory-Optimized Tables
90,150 Susan Bogota
50, ∞ Jane Prague
100, 200 John Paris
70, 90 Susan Brussels
200, ∞ John Beijing
Timestamps NameChain ptrs City
Hash index
on City
B
P
Row format
BW-tree
index on
Name
J
S
Memory-Optimized Indexes
90, 150 Susan Bogota
50, ∞ Jane Prague
Timestamps NameChain ptrs City
Hash index
on City
Hash index
on Name
100, 200 John Prague
200, ∞ John Beijing
f(John)
f(Jane)
f(Beijing) f(Bogota)
f(Prague)
Table Creation Process
CREATE TABLE DDL
Code generation and compilation
Table DLL produced
Table DLL loaded
Natively Compiled SPs
 It is ALL in
 All tables must be memory optimized
 CLR like
 Execution plan as a result of the TSQL is compiled
into native code (machine code)
SP Creation Process
CREATE PROC DDL
Query optimization
Code generation and compilation
Procedure DLL produced
Procedure DLL loaded
DEMO
In-Memory OLTP Basics
Workload
Migration Methodology
 Analyze Application
 Know your app
 Define goals
 Identify bottlenecks
 Test, Test, Test
 Examine Gains
In-Memory OLTP Patterns
Implementation Scenario Pattern Characteristics and
Challenge
Main Benefits of In-Memory
OLTP
High Data Insert Rate  Primarily append-only store
 Inability to ingest write workload
 Eliminate contention
 Minimize I/O logging
Read Performance and
Scale
 High performance read operations
 Unable to meet scale-up
requirements
 Eliminate contention
 Efficient data retrieval
 Minimize code execution time
o CPU efficiency for scale
Compute Heavy Data
Processing
 Insert/Update/Delete workload
 Heavy computation inside database
 Read and write contention
 Eliminate contention
 Minimize code execution time
 Efficient data processing
In-Memory OLTP Patterns
Implementation Scenario Pattern Characteristics and
Challenge
Main Benefits of In-Memory
OLTP
Low Latency  Require low latency business
transactions that typical database
solutions cannot achieve
 High concurrency exacerbates
latency
 Eliminate contention
 Minimize code execution time
 Efficient data retrieval
Session State
Management
 Heavy insert, update, and point
lookups
 User scale under load from multiple
stateless web servers
 Eliminate contention
 Efficient data retrieval
 Optional I/O
reduction/removal
Migration Approach
Identify bottlenecks in
tables
Address unsupported
constructs and migrate
data
Perform minimal
changes for
interpreted access
Identify performance
critical transaction
code
Address surface area
limitations and migrate
code
Migration Advisors
 Memory Optimization Advisor
 Identifies which tables in your database will
benefit
 Native Compilation Advisor
 Identifies interpreted stored procedures in your
database that will benefit
DEMO
ARM tool from MDW (Screenshots)
MDW Reports
Transaction Performance Analysis
Table Contention Analysis
MDW reports
DEMO
Migration Advisors
/SQLConqueror

SQL Server In-Memory OLTP Migration Overview

  • 1.
    www.facebook.com/prpass SQL Server 2014In-Memory OLTP Migration Overview Jose L. Rivera PASS Global Spanish VC Leader MVP | MCTS | MCITP | MCSA
  • 2.
    • Microsoft SQLServer MVP • Líder del Capítulo Global PASS en Español • VP - Puerto Rico PASS • Profesional de Bases de Datos con mas de 10 años usando SQL Server y tecnologías relacionadas • Especializado en ETL e Inteligencia de Negocios • Blog: http://sqlconqueror.com • Email: jose@sqlconqueror.com /SQLConqueror
  • 3.
     Weekly Meetings Different Time Zones  Spanish speakers from all over the globe! /SpanishPASSVC /user/SpanishPASSVC /SpanishPASSVC http://globalspanish.sqlpass.org
  • 4.
    Agenda  In-Memory OLTPOverview  In-Memory Implementation  Migration Scenarios  Q&A
  • 5.
    What’s in SQLServer 2014 In-Memory Technologies Hybrid Scenarios Enhanced HA/DR Other Investments
  • 6.
    In-Memory OLTP?  Memory-optimizedOLTP engine  High performance  Full integration into SQL Server  Architected for modern hardware
  • 7.
    Hardware Trends  Morecomplex CPUs  CPU clock rate stalled  Parallel processing  RAM is really cheap!  SSD: Minimize IO bottleneck
  • 8.
  • 9.
    Pre-Implementation Requirements  Enoughmemory and disk space  cmpxchg16b instruction support (in most 64bit processors)  Database should not exceed 250 GB  At least 2 or 4 sockets and fewer than 60 cores
  • 10.
    Limitations  memory-optimized filegroupcannot be deleted (Yes! DROP DATABASE)  No triggers, LOBs, XML, CLR  No FOREIGN KEY, CHECK  No schema changes, add/remove index (drop/recreate only)
  • 11.
    Memory optimized Structures •Tables, Indexes, SPs
  • 12.
    Row Format Row headerPayload (table columns) Begin Ts End Ts StmtId IdxLinkCount 8 bytes 8 bytes 4 bytes 2 + 2 (padding) bytes 8 bytes * (IdxLinkCount)
  • 13.
    Memory-Optimized Tables 90,150 SusanBogota 50, ∞ Jane Prague 100, 200 John Paris 70, 90 Susan Brussels 200, ∞ John Beijing Timestamps NameChain ptrs City Hash index on City B P Row format BW-tree index on Name J S
  • 14.
    Memory-Optimized Indexes 90, 150Susan Bogota 50, ∞ Jane Prague Timestamps NameChain ptrs City Hash index on City Hash index on Name 100, 200 John Prague 200, ∞ John Beijing f(John) f(Jane) f(Beijing) f(Bogota) f(Prague)
  • 15.
    Table Creation Process CREATETABLE DDL Code generation and compilation Table DLL produced Table DLL loaded
  • 16.
    Natively Compiled SPs It is ALL in  All tables must be memory optimized  CLR like  Execution plan as a result of the TSQL is compiled into native code (machine code)
  • 17.
    SP Creation Process CREATEPROC DDL Query optimization Code generation and compilation Procedure DLL produced Procedure DLL loaded
  • 18.
  • 19.
    Migration Methodology  AnalyzeApplication  Know your app  Define goals  Identify bottlenecks  Test, Test, Test  Examine Gains
  • 20.
    In-Memory OLTP Patterns ImplementationScenario Pattern Characteristics and Challenge Main Benefits of In-Memory OLTP High Data Insert Rate  Primarily append-only store  Inability to ingest write workload  Eliminate contention  Minimize I/O logging Read Performance and Scale  High performance read operations  Unable to meet scale-up requirements  Eliminate contention  Efficient data retrieval  Minimize code execution time o CPU efficiency for scale Compute Heavy Data Processing  Insert/Update/Delete workload  Heavy computation inside database  Read and write contention  Eliminate contention  Minimize code execution time  Efficient data processing
  • 21.
    In-Memory OLTP Patterns ImplementationScenario Pattern Characteristics and Challenge Main Benefits of In-Memory OLTP Low Latency  Require low latency business transactions that typical database solutions cannot achieve  High concurrency exacerbates latency  Eliminate contention  Minimize code execution time  Efficient data retrieval Session State Management  Heavy insert, update, and point lookups  User scale under load from multiple stateless web servers  Eliminate contention  Efficient data retrieval  Optional I/O reduction/removal
  • 22.
    Migration Approach Identify bottlenecksin tables Address unsupported constructs and migrate data Perform minimal changes for interpreted access Identify performance critical transaction code Address surface area limitations and migrate code
  • 23.
    Migration Advisors  MemoryOptimization Advisor  Identifies which tables in your database will benefit  Native Compilation Advisor  Identifies interpreted stored procedures in your database that will benefit
  • 24.
    DEMO ARM tool fromMDW (Screenshots)
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.