TempDB: Performance and Manageability

Slides:



Advertisements
Similar presentations
DBI402. SQL Server Specialist, Financial Industry Boston, MA Conference and INETA Speaker Connections, PASS, TechEd, DevTeach, etc. Author SQL Server.
Advertisements

Advanced Tuning: Unconventional Solutions to Everyday Problems Robert L Davis.
Performance-Tuning for Extract/Transform/Load (ETL) Operations Presented by : Ken Stuber.
Mitchel Sellers, CEO IowaComputerGurus Inc.. Active in the DotNetNuke eco system for about 6 years Author of Professional DotNetNuke Module Programming.
Database Performance Tuning and Query Optimization
Module 2: Database Architecture
SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312.
SQL Performance 2011/12 Joe Chang, SolidQ
SQL Server Wait Statistics Capture, Report, Analyse Rob Risetto Principal Consultant with StrataDB
5 Common SQL Server Performance Issues Jason Hall-SQL Sentry, Dir of Client Services Blog-jasonhall.blogs.sqlsentry.net.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Chapter 14 Chapter 14: Server Monitoring and Optimization.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Tempdb Parasites Jason Hall-Dir. of Client SQL Sentry Blog-jasonhall.blogs.sqlsentry.net.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
SQL SERVER DAYS 2011 Optimizing SQL Server Performance in a Virtual Environment Denny Cherry twitter.com/mrdenny.
DBI308. What are SQL Server Fast Track Reference Configurations General Fast Track Recommendations Reference Configurations and Best Practices FT 3.0.
Capacity Planning in SharePoint Capacity Planning Process of evaluating a technology … Deciding … Hardware … Variety of Ways Different Services.
Russ Houberg Senior Technical Architect, MCM KnowledgeLake, Inc.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
DNN Performance & Scalability Planning, Evaluating & Improving : Part 2.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Key Perf considerations & bottlenecks Windows Azure VM characteristics Monitoring TroubleshootingBest practices.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
TEMPDB Capacity Planning. Indexing Advantages – Increases performance – SQL server do not have to search all the rows. – Performance, Concurrency, Required.
Srik Raghavan Principal Lead Program Manager Kevin Cox Principal Program Manager SESSION CODE: DAT206.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
CS333 Intro to Operating Systems Jonathan Walpole.
Roy Ernest Database Administrator Pinnacle Sports Worldwide
TOP 10 Thinks you shouldn’t do with/in your database
for all Hyperion video tutorial/Training/Certification/Material Essbase Optimization Techniques by Amit.
Connect with life Praveen Srivatsa Founder and CEO – AstraSoft.NET Vinod Kumar Technology Evangelist – Databases and BI.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
How to kill SQL Server Performance Håkan Winther.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Does the Optimistic Concurrency resolve your blocking problems Margarita Naumova, SQL Master Academy.
Configuring SQL Server for a successful SharePoint Server Deployment Haaron Gonzalez Solution Architect & Consultant Microsoft MVP SharePoint Server
A deep dive into SQL Server Plan Cache Management.
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
10 Things All BI Administrators Should Know Robert L Davis Database Engineer
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Operating Systems c. define and explain the purpose of scheduling, job queues, priorities and how they are used to manage job throughput; d. explain how.
Hitting the SQL Server “Go Faster” Button Rob Douglas #509 | Brisbane 2016.
An introduction to Wait Statistics
Get the Most out of SQL Server Standard Edition
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
SharePoint Solutions Architect, Protiviti
Hitting the SQL Server “Go Faster” Button
SQL Server Monitoring Overview
Chapter Overview Understanding the Database Architecture
Database Performance Tuning and Query Optimization
Optimizing SQL Server Performance in a Virtual Environment
The Top 5 SQL Server Mistakes
Hitting the SQL Server “Go Faster” Button
In-Memory OLTP (IMOLTP) What Can It Do For Me?
SQL 2014 In-Memory OLTP What, Why, and How
Wellington, SQLSaturday#706
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Turbo-Charged Transaction Logs
TEMPDB – INTERNALS AND USAGE
SQL Server Performance Tuning
Optimizing SQL Server Performance in a Virtual Environment
It’s TEMPDB Why Should You Care?
Chapter 11 Database Performance Tuning and Query Optimization
Using wait stats to determine why my server is slow
Presentation transcript:

TempDB: Performance and Manageability

@SQLSoldier Who am I? www.sqlsoldier.com 11+ Former Sr. Production DBA / Operations Engineer in PQO Operations Former Technical Lead of the PQO Operations SQL V-Team Program Manager for SQL Server Certified Master program in Microsoft Learning Microsoft Certified Master: SQL Server 2008 MCITP: Database Developer: SQL Server 2005 and 2008 MCITP: Database Administrator: SQL Server 2005 and 2008 Co-author of Pro SQL Server 2008 Mirroring Idera ACE (Advisors & Community Educators) Host of T-SQL Tuesday, July 2010 Guest Professor at SQL University, summer 2010, spring/summer 2011 Speaker at SQL PASS Summit 2010 11+ years working with SQL Server Writer for SQL Server Magazine Member: Mensa Middle picture: Maggie and Woody Blog: http://www.sqlsoldier.com Twitter: http://twitter.com/SQLSoldier 11+ www.sqlsoldier.com

It depends? How many data files? Should I separate the log and data files? What RAID level? What about RAM drives or SSDs? Is there such a thing as too many data files?

What is tempDB? Well organized junk drawer of SQL Server Temporary objects Internal objects (work tables) Version store Snapshot isolation Read committed snapshot isolation Online index operations MARS After Triggers Trigger virtual tables

How many data files? 1:1? Official Microsoft recommendation still 1:1 Tested by PSS/SQL team on SQL 2008 R2 on SQL Server with > 64 logical CPUs Actual need: 1 per concurrent process using tempDB Is this a realistic recommendation?

How many data files, really? Systems that need 1:1 data files are few Evidence indicates that performance does degrade somewhat with more files Average I/O block size decreased Data access patterns appear random Most SQL Servers may not need more than 1:4 or 1:2 data files per logical CPUs This is only a starting point

Start with 1:4 or 1:2 data files? It depends! What is your comfort level with dealing with tempDB contention? Can you recognize it? Do you know how to fix it? Are you actively monitoring for it? If it occurs, are you okay with the time it would take to respond to and fix it?

What is tempDB contention? Latch contention on allocation pages PFS: Page Free Space Page 1 and every 8088 pages GAM: Global Allocation Map Page 2 and every 511,232 pages SGAM : Shared Global Allocation Map Page 3 and every 511,232 pages PAGEIOLATCH_xx waits PAGELATCH_xx waits

Monitoring tempDB Contention Use DMV sys.dm_os_waiting_tasks Parse resource_description column <database ID>:<file ID>:<page number> Database ID = 2 for tempDB File ID = ID of a data file Page number = do the math GAM: (Page ID – 2) % 511232 SGAM: (Page ID – 3) % 511232 PFS: (Page ID – 1) % 8088

Monitoring tempDB Contention http://www.sqlsoldier.com/wp/sqlserver/breakingdowntempdbcontention

Configuring tempDB files 1 log file only All files pre-sized to avoid data growth All data files the same size Required for round-robin usage Set auto-growth on log file to hard value, not percentage

Configuring tempDB files Recommended (optional): Set log file to double the size of a single data file Disable auto-growth on the data files

Large files & tempDB startup Make sure instant file initialization is enabled TempDB reuses the existing files Does not zero initialize the log file if it already exists http://sqlblog.com/blogs/jonathan_kehayias/archive/2010/05/13/does-the-tempdb-log-file-get-zero-initialized-at-startup.aspx

Large files & tempDB startup DEMO

RAID Levels & RAM Disk subsystem can affect performance TempDB tries to maintain as much as it can in memory Try to avoid DDL on temporary tables after they are created Large sorts or hashes can spill over from memory into tempDB Watch for IO_COMPLETION and PAGEIOLATCH_xx waits

RAID Levels & RAM On a well-tuned system, RAM more important to me than RAID level Statistics are important! If queries spill to tempDB, you will notice the difference in disk performance RAID 1 or RAID 10 (RAID 1,0) Look at the whole disk subsystem, not just RAID level

Where are my tempDB objects? http://www.sqlsoldier.com/wp/sqlserver/iowherearemytempdbobjects

RAM disk & SSDs Yes, the fastest disk subsystems (to date) Will you need that level of disk performance? RAM disk – You will have to recreate the tempDB files are startup A large log file will delay tempDB startup

TempDB on FusionIO WP: Performance Evaluation of Hosting TempDB on FusionIO http://www.sqlsoldier.com/wp/sqlserver/performanceevaluationofhostingtempdbonfusionio Saw great increases in performance metrics Saw minimal increase in actual throughput

Final thoughts! Configuration is key Monitor for tempDB contention Data files 1:1 vs 1:2 or 1:4 Data files all the same size and settings Monitor for tempDB contention RAM and disk subsystem RAM Disk & SSDs

Thanks! Thanks for joining! Thanks to Idera and MSSQLTips for sponsoring! Session files will be available at http://www.sqlsoldier.com/tempdb My blog: www.sqlsoldier.com Twitter: twitter.com/SQLSoldier