SlideShare una empresa de Scribd logo
1 de 24
SQL 2014 In-
Memory OLTP
Amber Keyse
Database Administrator
Email: hantsuksqlserverusergroup@gmail.com
20th October
Why now?
• Increase in memory capacity.
• Increasing number of cores available in processor(s).
In-Memory OLTP data
processing types available in
market
• The 2 main types:
• Main-memory databases
• Application caches or key-value stores
What is SQL In-Memory OLTP?
• New feature in SQL 2014.
• Integrated within the SQL Server engine.
• Designed to improve SQL performance.
• Enable users to create data in memory optimized tables and
indexes in RAM.
• Available in SSMS and TSQL.
• It uses filestream filegroup(s). Reading and writing to this file
is sequential.
• An update is implemented as a delete followed by an insert.
The deleted rows are removed using MERGE background
process.
2 SQL In-Memory OLTP main
data structures
• Memory -optimized tables and indexes
• Natively -compiled stored procedures
In-Memory OLTP
Architecture
• In-Memory is integrated into SQL
Engine.
• Clients connect to TDS handler
and Session Management for
memory optimized and disk based
tables. Also for natively compile
and T-SQL stored procedures.
• Query Interop enables
interpreted T-SQL and stored
procedures use memory
optimized tables.
• Native compiler creates an
abstract tree to represent T-SQL
sp.
• Storage Engine manages user data
and indexes for memory
optimized tables.
Diagram and info from:
https://www.mssqltips.com/sqlservertip/31
06/sql-server-2014-inmemory-oltp-
architecture-and-data-storage
SQL In-Memory OLTP
Architecture –Data Storage
• Disk based data row
structure
• Row data stored In-
Memory structure
Diagrams from
https://technet.microsoft.com/en-
us/library/ms190969(v=sql.105).aspx
Diagram from
https://www.mssqltips.com/sqlservertip/3106
/sql-server-2014-inmemory-oltp-
architecture-and-data-storage/
Durability options in SQL In-
Memory OLTP
• SCHEMA_ONLY
• SCHEMA_AND_DATA
Advantages of SQL In-Memory
OLTP
• Speed!
• ACID Support.
• Integrated into SQL Instance.
• User databases can contain both In-Memory OLTP and disk
based schemas.
• Available in SQL On premise and Azure SQL databases.
• SQL Support and Manageability tools provided.
Disadvantages of SQL In-
Memory OLTP
• Very new.
• Tricky to troubleshoot future performance problems.
• Sharing RAM with SQL Instance.
• Limited SQL object support.
• RAM requirement.
Possible suitable workload
• Lock or latch contention.
• Excessive page I/O, latch waits or waits reading from or
writing to disk
• Transaction Logging.
• Hardware resource limitations.
• High volume of INSERTS and SELECTs
• CPU-intensive operations
• Extremely fast business transactions
• Session state management
Demo - Implement In-Memory
in Management studio
SQL Support and
Manageability –AMR tool
• Integrated into SSMS.
• Designed to help identify which tables and stored procedures
will benefit the most from In-Memory OLTP.
• AMR tool consists of;
• Transaction performance collector
• Memory Optimization Advisor
• Native Compilation Advisor
AMR – Transaction
Performance Collector
• Collects information about the SQL Instance workload.
• Imports the data to a Management Data Warehouse.
• The collection sets include;
• Stored procedure usage analysis
• Table usage analysis
Demo – Transaction
Performance Collector
AMR – Memory Optimization
Advisor
• Provides a Wizard within SSMS.
• Starts with reviewing table(s) you could migrate.
• Reports any violation errors for disk-based tables.
• Identify changes required to convert table to In-Memory OLTP
table.
• Generate code to migrate the table and/or migrate table for
you.
Demo – Using Memory
Optimization Advisor
AMR – Native Compilation
Advisor
• Integrated into SSMS.
• Provides advise about what should be changed in a stored
procedure.
• Gives a Wizard and generated a report.
• It relies on the DBA to rewrite or update the sp.
Demo - Native Compilation
Advisor
Calculate RAM for In-
Memory
Size of the Table + Sum of all Index sizes + row versioning
• Only estimate for initial size.
• What about next 18 months?
• Need to estimate RAM requirement for other SQL
Instance transactions.
• Example calculation from
http://thomaslarock.com/2014/06/estimating-memory-
requirements-in-sql-server-2014/
Configure Memory Quota for In-
Memory Optimized Dbs
From https://www.mssqltips.com/sqlservertip/3368/setup-a-memory-
quota-for-sql-server-memory-optimized-databases/
The sys.dm_os_sys_info DMV
Demo Set Memory Quota for In-
Memory Optimized Dbs
Further reading
• Free Redgate PDF version of SQL Server Internals - In Memory OLTP by Kalen Delaney: https://www.red-
gate.com/library/sql-server-internals-in-memory-oltp
• Disadvantages of In-Memory OLTP by Klaus Aschenbrenner, published 2015:
http://www.sqlpassion.at/archive/2015/03/11/dont-yet-recommend-memory-oltp-customers/
• Microsoft SQL Server Team – Getting Started with SQL Server 2014 In-Memory OLTP:
https://blogs.technet.microsoft.com/dataplatforminsider/2013/06/26/getting-started-with-sql-server-
2014-in-memory-oltp/
• Comparing Disk-Based Table Storage to Memory-Optimized Table Storage:
https://msdn.microsoft.com/en-us/library/dn553126(v=sql.120).aspx
• Defining Durability for Memory-Optimized Objects: https://msdn.microsoft.com/en-
us/library/dn553122(v=sql.120).aspx
• Demo steps for using Azure In-Memory OLTP for Azure SQL DB by Channel 9:
https://channel9.msdn.com/Shows/Data-Exposed/In-Memory-OLTP-for-Azure-SQL-DB
• Determine which tables and sps would benefit from In-Memory OLTP: http://sqlmag.com/sql-server-
2014/sql-server-2014-analysis-migrate-report-tool-amr
• Microsoft Memory Optimization Advisor: https://msdn.microsoft.com/en-
gb/library/dn284308(v=sql.120).aspx
• SQL Server 2014 CTP2 –Memory Optimization Advisor: https://www.pythian.com/blog/sql-server-2014-
ctp2-memory-optimization-advisor
• In-Memory Native compilation Advisor in SSMS: http://sqlserver-help.com/tag/native-compilation-
advisor/
• Estimate Memory requirement: http://thomaslarock.com/2014/06/estimating-memory-requirements-in-
sql-server-2014/
• Delete a Resource Pool: https://msdn.microsoft.com/en-us/library/hh510193(v=sql.120).aspx
Questions

Más contenido relacionado

La actualidad más candente

Tips and Tricks for SAP Sybase IQ
Tips and Tricks for SAP  Sybase IQTips and Tricks for SAP  Sybase IQ
Tips and Tricks for SAP Sybase IQ
Don Brizendine
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server side
Howard Marks
 

La actualidad más candente (20)

Configuring Sage 500 for Performance
Configuring Sage 500 for PerformanceConfiguring Sage 500 for Performance
Configuring Sage 500 for Performance
 
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
 
4. (mjk) extreme performance 2
4. (mjk) extreme performance 24. (mjk) extreme performance 2
4. (mjk) extreme performance 2
 
X-DB Replication Server and MMR
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMR
 
Optimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best PracticesOptimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best Practices
 
Tips and Tricks for SAP Sybase IQ
Tips and Tricks for SAP  Sybase IQTips and Tricks for SAP  Sybase IQ
Tips and Tricks for SAP Sybase IQ
 
Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017
 
Maximum Availability Architecture with Fusion Middleware 12c and Oracle Datab...
Maximum Availability Architecture with Fusion Middleware 12c and Oracle Datab...Maximum Availability Architecture with Fusion Middleware 12c and Oracle Datab...
Maximum Availability Architecture with Fusion Middleware 12c and Oracle Datab...
 
Performance dreams of sql server 2014
Performance dreams of sql server 2014Performance dreams of sql server 2014
Performance dreams of sql server 2014
 
Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs
 
Manageability Enhancements of SQL Server 2012
Manageability Enhancements of SQL Server 2012Manageability Enhancements of SQL Server 2012
Manageability Enhancements of SQL Server 2012
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server side
 
Sql2017 in memory oltp for developers
Sql2017 in memory oltp for developersSql2017 in memory oltp for developers
Sql2017 in memory oltp for developers
 
Optimize MySQL performance for developers
Optimize MySQL performance for developersOptimize MySQL performance for developers
Optimize MySQL performance for developers
 
AUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePointAUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePoint
 
EnterpriseDB's Best Practices for Postgres DBAs
EnterpriseDB's Best Practices for Postgres DBAsEnterpriseDB's Best Practices for Postgres DBAs
EnterpriseDB's Best Practices for Postgres DBAs
 
Postgresql in Education
Postgresql in EducationPostgresql in Education
Postgresql in Education
 
EnterpriseDB BackUp and Recovery Tool
EnterpriseDB BackUp and Recovery ToolEnterpriseDB BackUp and Recovery Tool
EnterpriseDB BackUp and Recovery Tool
 
Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4
 
SQL Server Memory Pressure
SQL Server Memory PressureSQL Server Memory Pressure
SQL Server Memory Pressure
 

Destacado

hydrogen powered car and its application and its parts working
hydrogen powered car and its application and its parts workinghydrogen powered car and its application and its parts working
hydrogen powered car and its application and its parts working
Hemanth kumar
 
Moral casais juan_francisco_lu2_tarea_global2
Moral casais juan_francisco_lu2_tarea_global2Moral casais juan_francisco_lu2_tarea_global2
Moral casais juan_francisco_lu2_tarea_global2
juan moral
 
Pillars for Carolina 2014 One Year Marketing Plan
Pillars for Carolina 2014 One Year Marketing PlanPillars for Carolina 2014 One Year Marketing Plan
Pillars for Carolina 2014 One Year Marketing Plan
Camden Wiggins
 

Destacado (18)

SQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL ServerSQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL Server
 
In memory OLTP
In memory OLTPIn memory OLTP
In memory OLTP
 
Eca Ilustrado
Eca IlustradoEca Ilustrado
Eca Ilustrado
 
Brenda torres
Brenda torresBrenda torres
Brenda torres
 
Alice Kellaway work
Alice Kellaway workAlice Kellaway work
Alice Kellaway work
 
Some Training Certificates
Some Training CertificatesSome Training Certificates
Some Training Certificates
 
Fauna mexicana bien
Fauna mexicana bienFauna mexicana bien
Fauna mexicana bien
 
Vegetation Plan
Vegetation PlanVegetation Plan
Vegetation Plan
 
hydrogen powered car and its application and its parts working
hydrogen powered car and its application and its parts workinghydrogen powered car and its application and its parts working
hydrogen powered car and its application and its parts working
 
TALLER AUTODIAGNÓSTICO
TALLER AUTODIAGNÓSTICOTALLER AUTODIAGNÓSTICO
TALLER AUTODIAGNÓSTICO
 
Fernando dafonte
Fernando dafonteFernando dafonte
Fernando dafonte
 
Spectrum presentation
Spectrum presentationSpectrum presentation
Spectrum presentation
 
descripción
descripción descripción
descripción
 
Power point tice
Power point ticePower point tice
Power point tice
 
Net and protection
Net and protectionNet and protection
Net and protection
 
Template 2-customer
Template 2-customerTemplate 2-customer
Template 2-customer
 
Moral casais juan_francisco_lu2_tarea_global2
Moral casais juan_francisco_lu2_tarea_global2Moral casais juan_francisco_lu2_tarea_global2
Moral casais juan_francisco_lu2_tarea_global2
 
Pillars for Carolina 2014 One Year Marketing Plan
Pillars for Carolina 2014 One Year Marketing PlanPillars for Carolina 2014 One Year Marketing Plan
Pillars for Carolina 2014 One Year Marketing Plan
 

Similar a SQL 2014 In-Memory OLTP

Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Microsoft
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
kaziul Islam Bulbul
 
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
SQL Server 2014 Mission Critical Performance - Level 300 PresentationSQL Server 2014 Mission Critical Performance - Level 300 Presentation
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
David J Rosenthal
 

Similar a SQL 2014 In-Memory OLTP (20)

Investigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock HolmesInvestigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock Holmes
 
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
 
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL Server
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL ServerGeek Sync I Need for Speed: In-Memory Databases in Oracle and SQL Server
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL Server
 
Sql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su AzureSql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su Azure
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdf
 
Breaking data
Breaking dataBreaking data
Breaking data
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi Vončina
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015
 
What SQL DBA's need to know about SharePoint-St. Louis 2013
What SQL DBA's need to know about SharePoint-St. Louis 2013What SQL DBA's need to know about SharePoint-St. Louis 2013
What SQL DBA's need to know about SharePoint-St. Louis 2013
 
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
 
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
SQL Server 2014 Mission Critical Performance - Level 300 PresentationSQL Server 2014 Mission Critical Performance - Level 300 Presentation
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
 

Último

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Último (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 

SQL 2014 In-Memory OLTP

  • 1. SQL 2014 In- Memory OLTP Amber Keyse Database Administrator Email: hantsuksqlserverusergroup@gmail.com 20th October
  • 2. Why now? • Increase in memory capacity. • Increasing number of cores available in processor(s).
  • 3. In-Memory OLTP data processing types available in market • The 2 main types: • Main-memory databases • Application caches or key-value stores
  • 4. What is SQL In-Memory OLTP? • New feature in SQL 2014. • Integrated within the SQL Server engine. • Designed to improve SQL performance. • Enable users to create data in memory optimized tables and indexes in RAM. • Available in SSMS and TSQL. • It uses filestream filegroup(s). Reading and writing to this file is sequential. • An update is implemented as a delete followed by an insert. The deleted rows are removed using MERGE background process.
  • 5. 2 SQL In-Memory OLTP main data structures • Memory -optimized tables and indexes • Natively -compiled stored procedures
  • 6. In-Memory OLTP Architecture • In-Memory is integrated into SQL Engine. • Clients connect to TDS handler and Session Management for memory optimized and disk based tables. Also for natively compile and T-SQL stored procedures. • Query Interop enables interpreted T-SQL and stored procedures use memory optimized tables. • Native compiler creates an abstract tree to represent T-SQL sp. • Storage Engine manages user data and indexes for memory optimized tables. Diagram and info from: https://www.mssqltips.com/sqlservertip/31 06/sql-server-2014-inmemory-oltp- architecture-and-data-storage
  • 7. SQL In-Memory OLTP Architecture –Data Storage • Disk based data row structure • Row data stored In- Memory structure Diagrams from https://technet.microsoft.com/en- us/library/ms190969(v=sql.105).aspx Diagram from https://www.mssqltips.com/sqlservertip/3106 /sql-server-2014-inmemory-oltp- architecture-and-data-storage/
  • 8. Durability options in SQL In- Memory OLTP • SCHEMA_ONLY • SCHEMA_AND_DATA
  • 9. Advantages of SQL In-Memory OLTP • Speed! • ACID Support. • Integrated into SQL Instance. • User databases can contain both In-Memory OLTP and disk based schemas. • Available in SQL On premise and Azure SQL databases. • SQL Support and Manageability tools provided.
  • 10. Disadvantages of SQL In- Memory OLTP • Very new. • Tricky to troubleshoot future performance problems. • Sharing RAM with SQL Instance. • Limited SQL object support. • RAM requirement.
  • 11. Possible suitable workload • Lock or latch contention. • Excessive page I/O, latch waits or waits reading from or writing to disk • Transaction Logging. • Hardware resource limitations. • High volume of INSERTS and SELECTs • CPU-intensive operations • Extremely fast business transactions • Session state management
  • 12. Demo - Implement In-Memory in Management studio
  • 13. SQL Support and Manageability –AMR tool • Integrated into SSMS. • Designed to help identify which tables and stored procedures will benefit the most from In-Memory OLTP. • AMR tool consists of; • Transaction performance collector • Memory Optimization Advisor • Native Compilation Advisor
  • 14. AMR – Transaction Performance Collector • Collects information about the SQL Instance workload. • Imports the data to a Management Data Warehouse. • The collection sets include; • Stored procedure usage analysis • Table usage analysis
  • 16. AMR – Memory Optimization Advisor • Provides a Wizard within SSMS. • Starts with reviewing table(s) you could migrate. • Reports any violation errors for disk-based tables. • Identify changes required to convert table to In-Memory OLTP table. • Generate code to migrate the table and/or migrate table for you.
  • 17. Demo – Using Memory Optimization Advisor
  • 18. AMR – Native Compilation Advisor • Integrated into SSMS. • Provides advise about what should be changed in a stored procedure. • Gives a Wizard and generated a report. • It relies on the DBA to rewrite or update the sp.
  • 19. Demo - Native Compilation Advisor
  • 20. Calculate RAM for In- Memory Size of the Table + Sum of all Index sizes + row versioning • Only estimate for initial size. • What about next 18 months? • Need to estimate RAM requirement for other SQL Instance transactions. • Example calculation from http://thomaslarock.com/2014/06/estimating-memory- requirements-in-sql-server-2014/
  • 21. Configure Memory Quota for In- Memory Optimized Dbs From https://www.mssqltips.com/sqlservertip/3368/setup-a-memory- quota-for-sql-server-memory-optimized-databases/ The sys.dm_os_sys_info DMV
  • 22. Demo Set Memory Quota for In- Memory Optimized Dbs
  • 23. Further reading • Free Redgate PDF version of SQL Server Internals - In Memory OLTP by Kalen Delaney: https://www.red- gate.com/library/sql-server-internals-in-memory-oltp • Disadvantages of In-Memory OLTP by Klaus Aschenbrenner, published 2015: http://www.sqlpassion.at/archive/2015/03/11/dont-yet-recommend-memory-oltp-customers/ • Microsoft SQL Server Team – Getting Started with SQL Server 2014 In-Memory OLTP: https://blogs.technet.microsoft.com/dataplatforminsider/2013/06/26/getting-started-with-sql-server- 2014-in-memory-oltp/ • Comparing Disk-Based Table Storage to Memory-Optimized Table Storage: https://msdn.microsoft.com/en-us/library/dn553126(v=sql.120).aspx • Defining Durability for Memory-Optimized Objects: https://msdn.microsoft.com/en- us/library/dn553122(v=sql.120).aspx • Demo steps for using Azure In-Memory OLTP for Azure SQL DB by Channel 9: https://channel9.msdn.com/Shows/Data-Exposed/In-Memory-OLTP-for-Azure-SQL-DB • Determine which tables and sps would benefit from In-Memory OLTP: http://sqlmag.com/sql-server- 2014/sql-server-2014-analysis-migrate-report-tool-amr • Microsoft Memory Optimization Advisor: https://msdn.microsoft.com/en- gb/library/dn284308(v=sql.120).aspx • SQL Server 2014 CTP2 –Memory Optimization Advisor: https://www.pythian.com/blog/sql-server-2014- ctp2-memory-optimization-advisor • In-Memory Native compilation Advisor in SSMS: http://sqlserver-help.com/tag/native-compilation- advisor/ • Estimate Memory requirement: http://thomaslarock.com/2014/06/estimating-memory-requirements-in- sql-server-2014/ • Delete a Resource Pool: https://msdn.microsoft.com/en-us/library/hh510193(v=sql.120).aspx

Notas del editor

  1. Next user group meetings 20th October. Register interest using the link; https://www.eventbrite.co.uk/e/oct-hants-sql-user-group-meeting-tickets-25771056925?utm_source=eb_email&utm_medium=email&utm_campaign=event_reminder&utm_term=eventname
  2. Increase in memory capacity: Rise in 64 bit process and fall in memory prices. Cost per GB of RAM dropped to a few £. Number of cores on processors increasing. The In-Memory data structures designed to use very large number of cores.
  3. Other vendors offering In-Memory OLTP data processing. Main-memory databases: Oracle TimesTen, IBM SolidDB, Microsoft SQL Server that target embedded database space. Applications caches or key-value stores: The Velocity, App Fabric Cache and Gigaspaces uses middle-tier memory to offload work from databases by offering transactions, range indexing, query.
  4. Pre 2014: Traditional SQL Server engine write 8KB data pages into memory and then back out to disk can incur higher latency cost. SQL was designed originally when memory was expensive and followed the disk-based tables . Used locks and latches to prevent interference between concurrent transaction on the same data rows, thus preserve ACID (Atomic, Consistency, Insolation, Durable) characteristics.
  5. 1) Memory -optimized tables and indexes: whole table and its indexes are stored in memory all the time. It is using multiple versions of each row's data. It is characterized as non-blocking multi-version optimistic concurrency control. Eliminates both locks and latches to make it faster. Referred to as MVCC model (Multi-version Concurrency Control) 2) Natively-compiled stored procedures: Only access memory-optimized data structures e.g. memory-optimized tables, table variables. The key features - Rows in table read/written to memory, entire table in memory, Non-blocking multi-version optimistic concurrency control, have option of durable (second copy on disk) & non-durable data, in memory data only read from disk in DR.
  6. Disk based Extents: 8 physically contiguous pages or 64 KB. SQL DB has 16 Extents per MB. Each table : Data stored in data or index 8K pages. Each database can contain 128 pages per MB. Each page starts with a 96-byte header, consisting system information about the page (page number, page type, amount of free space, allocated unit ID of object that owns page). A page stores only rows from the same table. DML operation requires page to be loaded into buffer-pool, which resides in RAM. In–Memory data store New row format. Uses multi-version for each record. Rows are stored as individual rows. 2 rows in a data file can belong to different memory optimized tables.
  7. SCHEMA_ONLY: (non-durable table): If SQL restarted data is lost as the Schema is recreated to avoid transaction logging and checkpoint reducing I/O operations. SCHEMA_AND_DATA: Durability for schema and data. 2 Levels of data durability available - fully durable or delayed durability. Full durable tables same as the disk-based table. Delay durability is quicker but risk of data loss if server crash/fail over.
  8. Speed – 1) Faster data access compared to disk based tables. 2) T-SQL compiled to machine code so fewer instructions/layers so business logic process faster. Full ACID (Atomicity, Consistency, Isolation, Durability) Support – Ensure all database transaction are reliably processed. Obey to process all actions within the transaction or non rule. Integrated into SQL Instance: Can deploy using T-SQL or SSMS for new or existing DBs. SQL Support and Manageability tools provided – 1) Native Compilation Advisor: Shows sps that are incompatible with natively compiled procedures. 2) Resource Governor: Provide ability to set memory quota. 3) Memory usage SSMS standard database report. 4) Metadata Enhancements –Catalogue view enhancements (sys.table and sys.table) and Dynamic Management Objects (sys.dm_db_xtp_checkpoint_stats, sys.dm_xtp_gc_stats). 5) Extended Events – 3 extended event packages help monitor and troubleshooting. 6) Performance Counters. 7) AMR (Analysis, Migrate, Report) tool
  9. Very New: 1) Not supported pre-2014. 2) Not all applications will support In-Memory even if they support SQL 2014. 3) Cannot use replication, mirroring and database snapshots. 4) Only available in premium service Azure SQL instance and ones created after In-Memory launched. Large organisations tend to use a lot of 3rd party applications, therefore little/no control over source database. If QQ alter 3rd party application user databases could violate software support agreements. Troubleshoot future performance problems: 1) No Execution Plans available as it uses compiled assembly instructions so no execution plan created. 2) No Recompile, therefore have to drop and recreate stored procedures and lose permissions. Sharing RAM with SQL Instance: 1) In Memory OLTP bedded within SQL Server. 2) Setting SQL Max memory sets it for both SQL Instance and In-Memory OLTP engine. 3) Both engines compete for same resources – ENTIRE SQL INSTANCE CRASHES? Limited SQL object support: 1) replication, mirroring and database snapshot tables unavailable. 2) No Schema changes – No Alter table. 3) Cannot convert disk-based tables to become In-Memory tables. 4) In-Memory doesn’t recognise – ALTER TABLE, CREATE INDEX, DROP INDEX and ALTER INDEX. 5) FOREIGN KEYS (losing referential integrity) and CHECK CONSTRAINTS unsupported. 6) T-SQL operators and functions not supported. 7) No UNIQUE indexes a part from PRIMARY KEY. 8) Max 8 indexes including PK supported. 9) Cannot create DML triggers. 10) Data type restrictions – Doesn’t support LOB, XML, CLR or max data types. 11) Mirroring and replication of memory- optimized tables unsupported. RAM requirement: 1) Microsoft recommend doubling RAM allocate for version In-Memory OLTP use. 2) In-memory data stored in non-compressed format. SQL 2014 In-memory table limited to 250GB.
  10. Lock or latch contention – Reduce excessive lock or latch wait times, In-Memory preserves ACID transaction properties without requiring locks. High I/O and Logging: Doesn’t require disk reads. Streaming checkpoint operations are min resources to write durable data to disk for checkpoint files. In-memory doesn’t write index information to disk. Transaction Logging: Disk-based tables required actions written to T-Log on disk. In-Memory enable SCHEMA_ONLY tables which require no logging. Logging overhead for SCHEMA_AND_DATA is reduced because memory optimized can contain information about many rows and index changes are not logged. Hardware resource limitations: CPU stressed causing slowdown. Natively compiled code uses fewer CPU instructions to interpret code and less CPU use. High volume of INSERTs and SELECTs: In-Memory eliminates locks and latch requirements. Also table logs are more optimized. No index changes are logged. SCHEMA_ONLY help reduce overhead with table row logging. Suitable only for many concurrent SELECTs executed on a single thread as parallel operations unsupported. Session State management: Apps use it to retain session information, e.g. website maintain information about user choices and actions across multiple HTTP requests and doesn’t need to be preserved across server restarts.
  11. Launch SQL2014 SSMS Connect to RL-4009480\SQL2014INST Use script; C:\Users\aekeyse\Documents\Technical\Database\SQLUserGroup\ExternalInMemoryOLTP\Demo1DeployingExample-Local
  12. Transaction performance collector: Gather information about existing tables and sps and recommends which ones to migrate to In-Memory. Memory Optimization Advisor: Guides through migrating a table to memory-optimized table. Native Compilation Advisor: Identify T-SQL required changes to migrate sps to natively complied sps. Example from - http://sqlmag.com/sql-server-2014/sql-server-2014-analysis-migrate-report-tool-amr
  13. Stored procedure usage analysis: Contains store procedure information for migration to natively compiled stored procedures. Table usage analysis: Contains disk-based tables that can be migrated to memory optimized tables.
  14. Demo Create AMR_DW Db using Wizard (Object Explorer in SSMS >Management folder >Right-click Data Collection> configure Management Data Warehouse) Configure Data Collection Process (SSMS> Management folder> Data Collection> Tasks>Configure Data Collection) but click cancel. Show the AMR_DW DB in Databases. Blue Peter style –Show existing SQL agent jobs: collection_set_6_collection, collection_set_6_upload, collection_set_7_collection, collection_set_7_upload Blue Peter style – Show Transaction Performance Analysis Overview (Right click MDW database>Reports>Transaction Performance Analysis Overview> Click on URLs) Demo example from http://sqlmag.com/sql-server-2014/sql-server-2014-analysis-migrate-report-tool-amr
  15. Show AdventureWorks2008R2.dbo.ErrorLog and it will fail (Right click on ErrorLog and choose Memory Optimization Advisor) Show using AdventureWorks2008R2.dbo.AKEmp, which has no keys or constraints. (Right click table> Memory Optimization Advisor>Set Latin1_General_100_BIN2 for NationalIDNumber and set it as part of primary key> Next>Migrate>Script>Migrate>Click O.K.>Show Db files) Steps used from https://www.pythian.com/blog/sql-server-2014-ctp2-memory-optimization-advisor
  16. Right click on InsertName sp>Native Compilation Advisor>Click Cancel. This should work. Use uspGetBillOfMaterials that will fail (Right Click uspGetBillOfMaterials >Native Compilation Advisor>Generate Report>Open the File in Internet Explorer). Demo example from http://sqlserver-help.com/tag/native-compilation-advisor/
  17. The process flow I would follow for estimating memory requirements in SQL Server 2014 is this: Get current number of rows in the table. Get current size of row by adding up data types, row header (additional 24 bytes) and 8 bytes for each index. Multiply (1) and (2) and set aside the result. For each hash index, get the bucket count, round up to the next highest power of 2, and then multiply by 8. Get sum of all hash indexes in (4) and set aside. For each non-clustered index, get the width of the key columns, add 8, then multiply that by the number of unique rows. Get sum of all non-clustered indexes in (6) and set aside. Add (3), (5), and (7) together. Multiply the result from (8) by 2, this is the guesstimate that includes row versioning. Example calculation from http://thomaslarock.com/2014/06/estimating-memory-requirements-in-sql-server-2014/
  18. There is a memory threshold available depending on the target pool memory Instance target committed memory can be checked by viewing sys.dm_os_sys_info Dynamic Management View Figures from https://www.mssqltips.com/sqlservertip/3368/setup-a-memory-quota-for-sql-server-memory-optimized-databases/
  19. Demo using script file; C:\Users\aekeyse\Documents\Technical\Database\SQLUserGroup\ExternalInMemoryOLTP\DemoSetMemoryQuota -Local Can achieve same results using SSMS GUI 1) Open Object Explorer. 2) Expand the Management. 3) Select Resource Governor. 4) Right-click the resource pool to be deleted, and then click Delete. 5) To delete the resource pool, click OK. Demo example from https://www.mssqltips.com/sqlservertip/3368/setup-a-memory-quota-for-sql-server-memory-optimized-databases/
  20. Do you think you would use In-Memory OLTP?