Taking your application to memory

Slides:



Advertisements
Similar presentations
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Payroll and HR Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Dual Partitioning for improved performance in VLDBs Ashwin Rao Karavadi, Rakesh Parida Microsoft IT.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
SQL Server SQL Azure Visual Studio“Quadrant” SQL Server Modeling Services Entity Framework ADO.NET“M”/EDM Data Services …
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

INTRODUCTION TO MDX. Stick around for SWAG! (Prize drawing at 5.00 p.m)  All our volunteers and organisers do not get paid for running SPS SQLSaturday.
Stick around for SWAG! (Prize drawing at 5.00 p.m)  All our volunteers and organisers do not get paid for running SPS SQLSaturday Cambridge and do.
Datazen – an overview Frank Geisler
MIX 09 4/17/2018 4:41 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Module 13: Creating Highly Concurrent SQL Server 2012 Applications
In-Memory Optimization (OLTP) enhancements overview
UFC #1433 In-Memory tables 2014 vs 2016
Taking your application to memory
TechEd /6/2018 7:34 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Mission-critical performance with Microsoft SQL Server 2016
Introduction to SQL Server Management for the Non-DBA
SQL Server 2014 In-Memory Overview
Возможности Excel 2010, о которых следует знать
Testing Database Code with tSQLt
Entity Based Staging SQL Server 2012 Tyler Graham
Migrating a Disk-based Table to a Memory-optimized one in SQL Server
Taking your application to memory
Title of Presentation 11/22/2018 3:34 PM
TechEd /23/ :44 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
TechEd /24/2018 8:21 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Performance tuning Tabular and PowerPivot models
Turbo-Charged Transaction Logs
Title of Presentation 12/2/2018 3:48 PM
12/5/ :14 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Microsoft SQL Server 2014 for Oracle DBAs Module 7
1/3/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
TechEd /15/2019 8:08 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
In-Memory OLTP for Database Developers
Sunil Agarwal | Principal Program Manager
TechEd /18/2019 2:43 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Power Query & Database Tuning
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
4/27/17, Bell #8 What amount of net pay has been earned this period?
TechEd /11/ :25 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Andrew Fryer Microsoft UK
Windows 8 Security Internals
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Running Reporting Services in SharePoint Integrated Mode: How and Why
Title of Presentation 5/24/2019 1:26 PM
Using Smart Unit Tests to find bugs earlier in the development cycle
Title of Presentation 7/24/2019 8:53 PM
WCL425 App Compat for Nerds Chris Jackson.
Presentation transcript:

Taking your application to memory - A case study Rasmus Reinholdt

A word about me Worked with BI and SQLServer for 12 years Primarily with ETL and relational datawarehousing Datawarehouse Architect At UNOPS – the implementation arm of the UN Contact @RasmusReinholdt dk.linkedin.com/in/rasmusreinholdt/ RasmusReinholdt.wordpress.com

What will this talk bring you A talk for developers Introduction to In-memory tables and natively compiled stored procedures How we went about converting our application to utilize the power of being memory based Tips and tricks to overcome the shortcomings of the product Going forward – what to expect of SQL 2016 Not a deep-dive into In-memory tables

In-Memory tables overview 11/9/2018 In-Memory tables overview This slide is optional © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

In-Memory integration with SQL Server SQL Server Integration Same sql server.exe Query interop Native Compiled Stored Procedures Can only access In-memory tables Not all functions supported (outer joins, window functions etc) Check point files, consists of checkpoints and delta files, always only append data, never updates to the delta Only sequential IO Filestream is the underlying storage mechanism – consist of Data files Store inserted records Data written only upon commit Delta files Store deleted records (updates are an insert/delete pair) Uses SQL transaction log to store content All logging is logical No log records for physical structure modifications. No index-specific / index-maintenance log records. No UNDO information is logged

Create an In-memory optimized database, tables and native SPs 11/9/2018 Demo Create an In-memory optimized database, tables and native SPs © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Using Row Versions instead of locks Row header The header contains two 8-byte fields holding timestamps: a Begin-Ts and an End-Ts. Every database that supports memory-optimized tables manages two internal counters that are used to generate these timestamps. the Begin-Ts and End-Ts values determine which other transactions will be able to see this row – kind a like slowly changing type 2 dimensions SQL Server 2014 In Memory tables do not use or create locks Row versioning is used to maintain Consistency Row Versions no longer referenced are garbage collected.

Considerations for in-memory tables No Foreign Key and Check Constraints No IDENTITY No ALTER objects No Add/Remove Index Row Sizes can’t be larger than 8060 bytes (incl. Variable Length Columns) LOB, XML Data Types are not supported No Foreign Key and Check Constraints No IDENTITY – But SEQUENCE and uniqueidentifier are supported No DML Triggers No ALTER objects (Need to recreate them) No Add/Remove Index (Need to recreate table) Indexes are rebuilt on boot (consider startup time) All data has to fit in-memory All data has to fit in-memory

Considerations for Natively compiled SPs If it worked in SQL Server 2000 it will properbly also work in Natively compiled SPs But that is changing……. If it worked in sql2000 chances are it also work in Natively copiled SPs No Subquery, CTEs No outer joins, APPLY, contains, OR and IN NO delete or Update with FROM clause NO Union, Intersect or Except Query plan evaluated at create time and used ever after…. Executed as machine code not T-SQL Natively stored SPs can only access in-memory tables

Works seamlessly with current SQL Server objects Is fully ACID compliant You can mix in-memory and disk based tables in the same database Your transactions can span in-memory and disk based tables in the same database Works with high availability

WHY

WHAT Step wise, no need for a big bang, so we could start on the spots most likely to give the best response

How does In-memory tables perform 11/9/2018 Demo How does In-memory tables perform © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Converting our application

GAP analysis Effektor In-memory supported Dynamic sql Foreign keys Primary keys Inner joins Outer joins Truncates Moving large amounts of data Merge Supported if not natively compiled

Converting our application to in-memory 11/9/2018 Demo Converting our application to in-memory © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Natively compiled stored procedures are NOT T-SQL 11/9/2018 Use your imagination…. Natively compiled stored procedures are NOT T-SQL Things that will work with t-sql might not work in native compiled – and stuff that we usualy go to great lengths to avoid i t-sql might performe very well in native compiled SPs © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

SQL server 2016 is just around the corner… 11/9/2018 BUT Things are changing SQL server 2016 is just around the corner… Things that will work with t-sql might not work in native compiled – and stuff that we usualy go to great lengths to avoid i t-sql might performe very well in native compiled SPs © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Feature/Limit SQL Server 2014 SQL Server 2016 Maximum size of durable table 256 GB 2 TB LOB (varbinary(max), [n]varchar(max)) Not supported Supported Transparent Data Encryption (TDE) Offline Checkpoint Threads 1 1 per container ALTER PROCEDURE / sp_recompile Supported (fully online) Nested native procedure calls Natively-compiled scalar UDFs ALTER TABLE Not supported (DROP / re-CREATE) Partially supported DML triggers Partially supported (AFTER, natively compiled) Indexes on NULLable columns Non-BIN2 collations in index key columns Non-Latin codepages for [var]char columns Non-BIN2 comparison / sorting in native modules Foreign Keys Check/Unique Constraints Parallelism OUTER JOIN, OR, NOT, UNION [ALL], DISTINCT, EXISTS, IN Multiple Active Result Sets (MARS) (Means better Entity Framework support.) SSMS Table Designer ALTER TABLE dbo.InMemoryTable ALTER INDEX IX_NC_Hash REBUILD WITH (BUCKET_COUNT = 1048576); http://sqlperformance.com/2015/05/sql-server-2016/in-memory-oltp-enhancements

GAP analysis – 2016 Effektor In-memory supported Dynamic sql Foreign keys Primary keys Inner joins Outer joins Truncates Moving large amounts of data Merge

Sql server 2016 – going upward and onward 11/9/2018 Demo Sql server 2016 – going upward and onward How much easier has it become © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Wrap up and key findings 11/9/2018 Wrap up and key findings This slide is optional © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Stick around for SWAG! (Prize drawing at 5.00 p.m) All our volunteers and organisers do not get paid for running SPS SQLSaturday Cambridge and do it because they believe in the power of community (or are just plain nuts). Please show your gratitude for making this possible by: Giving them a hug Shaking their hand Saying thank you Coming back next year Consider getting your company to pay for a precon next year Speading the word Getting involved yourself But most of all, by enjoying the day! Don’t forget to thank the sponsors for their support Thank the speakers for donating their time, energy and expenses

Stick around for SWAG! (Prize drawing at 5.00 p.m) SQLCloud — XBox One!!! (make sure you know how to play the Jet Set Willy vendor competition!) SQLCloud—Dark Side Of The Moon, The Wall and Wish You Were Here Microsoft — MCP Voucher Data Idols — Supercar Driving Experience Profisee — Signed MDS Book and £50 Amazon Voucher SQLSentry — Plan Explorer PRO License Pyramid Analytics—Coffee Machine Effektor — Lego Big Ben Rencore — SPCAF Professional License (valued at $2099!) Axioworks — Amazon Fire TV and £75 Amazon Voucher DELL — Beats by Dr Dre Headphones Redgate — DLM Workshop Pluralsight — Annual Plus subscriptions All Your Base Conference — 3 x Conference Tickets VisualSP—Annual training subscription Loads of books and much much more!!!

11/9/2018 References http://blogs.technet.com/b/dataplatforminsider/archive/2013/06/26/sql-server-2014-in-memory-technologies-blog-series-introduction.aspx http://sqlblog.com/blogs/kalen_delaney/archive/2013/06/05/hekaton-whitepaper.aspx http://blogs.technet.com/b/dataplatforminsider/archive/2013/10/09/troubleshooting-common-performance-problems-with-memory-optimized-hash-indexes.aspx http://blogs.technet.com/b/dataplatforminsider/archive/2013/06/26/getting-started-with-sql-server-2014-in-memory-oltp.aspx http://msdn.microsoft.com/en-us/library/dn246937%28v=sql.120%29.aspx https://msdn.microsoft.com/en-us/library/dn133186.aspx <- sql server2016 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.