© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. IO, IO! Why’s my SQL slow? Brian Flynn.

Slides:



Advertisements
Similar presentations
Disk Arrays COEN 180. Large Storage Systems Collection of disks to store large amount of data. Performance advantage: Each drive can satisfy only so many.
Advertisements

Csci 2111: Data and File Structures Week2, Lecture 1 & 2
Copyright © 2006 Quest Software SQL 2005 Disk I/O Performance By Bryan Oliver SQL Server Domain Expert.
RAID Redundant Array of Independent Disks
Exadata Distinctives Brown Bag New features for tuning Oracle database applications.
1 Magnetic Disks 1956: IBM (RAMAC) first disk drive 5 Mb – Mb/in $/year 9 Kb/sec 1980: SEAGATE first 5.25’’ disk drive 5 Mb – 1.96 Mb/in2 625.
Lecture 36: Chapter 6 Today’s topic –RAID 1. RAID Redundant Array of Inexpensive (Independent) Disks –Use multiple smaller disks (c.f. one large disk)
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
SQL Server, Storage And You Part 2: SAN, NAS and IP Storage.
1 Advanced Database Technology February 12, 2004 DATA STORAGE (Lecture based on [GUW ], [Sanders03, ], and [MaheshwariZeh03, ])
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
1 CS143: Disks and Files. 2 System Architecture CPU Main Memory Disk Controller... Disk Word (1B – 64B) ~ x GB/sec Block (512B – 50KB) ~ x MB/sec System.
Physical Storage Organization. Advanced DatabasesPhysical Storage Organization2 Outline Where and How data are stored? –physical level –logical level.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
OS Fall ’ 02 Performance Evaluation Operating Systems Fall 2002.
OS and Hardware Tuning. Tuning Considerations Hardware  Storage subsystem Configuring the disk array Using the controller cache  Components upgrades.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
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.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
1 © Copyright 2008 EMC Corporation. All rights reserved. Symmetrix Capacity Planning and Performance Aspects Bob Rau Technical Business Consultant Symmetrix.
Sponsored by: PASS Summit 2010 Preview Storage for the DBA Denny Cherry MVP, MCSA, MCDBA, MCTS, MCITP.
DISKS IS421. DISK  A disk consists of Read/write head, and arm  A platter is divided into Tracks and sector  The R/W heads can R/W at the same time.
Storage & Peripherals Disks, Networks, and Other Devices.
1 Recitation 8 Disk & File System. 2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O.
L/O/G/O External Memory Chapter 3 (C) CS.216 Computer Architecture and Organization.
Database Storage Considerations Adam Backman White Star Software DB-05:
SQL Server, Storage and You Part 1: Storage Basics Wes Brown.
Lecture 11: DMBS Internals
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Lecture 9 of Advanced Databases Storage and File Structure (Part II) Instructor: Mr.Ahmed Al Astal.
Top 10 Performance Hints Adam Backman White Star Software
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
External Storage Primary Storage : Main Memory (RAM). Secondary Storage: Peripheral Devices –Disk Drives –Tape Drives Secondary storage is CHEAP. Secondary.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
Physical Storage Organization. Advanced DatabasesPhysical Storage Organization2 Outline Where and How data are stored? –physical level –logical level.
Practice 8 Chapter Ten. 1. Is disk scheduling, other than FCFS scheduling, useful in a single-user environment? Explain your answer. Answer: In a single-user.
Chapter 12 – Mass Storage Structures (Pgs )
11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Infrastructure for Data Warehouses. Basics Of Data Access Data Store Machine Memory Buffer Memory Cache Data Store Buffer Bus Structure.
DMBS Internals I February 24 th, What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the.
for all Hyperion video tutorial/Training/Certification/Material Essbase Optimization Techniques by Amit.
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
DMBS Architecture May 15 th, Generic Architecture Query compiler/optimizer Execution engine Index/record mgr. Buffer manager Storage manager storage.
Page 1 Mass Storage 성능 분석 강사 : 이 경근 대리 HPCS/SDO/MC.
Maximizing Performance – Why is the disk subsystem crucial to console performance and what’s the best disk configuration. Extending Performance – How.
Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.
Lecture 3 Secondary Storage and System Software I
1 Query Processing Exercise Session 1. 2 The system (OS or DBMS) manages the buffer Disk B1B2B3 Bn … … Program’s private memory An application program.
CS422 Principles of Database Systems Disk Access Chengyu Sun California State University, Los Angeles.
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
File organization Secondary Storage Devices Lec#7 Presenter: Dr Emad Nabil.
Storage HDD, SSD and RAID.
Flash Storage 101 Revolutionizing Databases
SQL Disk I/O Performance
Disks and RAID.
Database Management Systems (CS 564)
CS 554: Advanced Database System Notes 02: Hardware
Denny Cherry twitter.com/mrdenny
Optimizing SQL Server Performance in a Virtual Environment
Lecture 11: DMBS Internals
Lecture 9: Data Storage and IO Models
Proving Hardware Bottlenecks &
KISS-Tree: Smart Latch-Free In-Memory Indexing on Modern Architectures
Persistence: hard disk drive
Troubleshooting Techniques(*)
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Presentation transcript:

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. IO, IO! Why’s my SQL slow? Brian Flynn

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Define Speed? »Acceleration »Burst/Top Speed »Sustained Speed »Constraints »Total Trip Time »Average Speed 2

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. »Imagine transporting things a long distance. »Just you and an over night bag vs everything you own… 3 Latency, Speed, & Throughput High Acceleration (Low Latency)Medium Acceleration (Medium Latency)Low Acceleration (High Latency) High Top SpeedMedium Top SpeedLow Top Speed Small CargoMedium CargoLarge Cargo Low CapacityMedium CapacityHigh Capacity

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Latency, Speed, & Throughput »Electricity:  Volts / Ohms = Amps  Volts * Amps = Watts »Data:  Buffer Size / Latency = Transfer Rate  Buffer Size * Transfer Rate = Throughput 4 AnalogySizeCurrentResistanceCapacity ElectricityVoltsAmpsOhmsWatts WaterPressureFlow Rate Inverse of channel diameter Volume/Time DataBuffer Size * compression * jumbo frames Transfer Rate *IOPS Latency * Function of Distance * Function of storage type Throughput

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Latency, Speed, & Throughput »When speed is constant, packet size governs throughput. »Larger packets increase throughput. »Greater distance increases latency which lowers perceived throughput. 5

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. True speed is all about latency »1 byte or 1000 bytes, same trip time. »Overhead accounts for more constraint than sum of the serialized trips. 6

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Aren’t we talking about storage? »HDD latency  Rotating the platter  Moving the head »SSD latency  One controller is a gateway for multiple chips »RAID latency  Mirror – Improves read IOPS if split reads is supported.  Stripe – Improves read & write IOPS.  Distributed Parity – Write IOPS penalty for calculating parity bits.  Raid 10 – Mirror & Stripe. No write penalty. Twice the price of stripe only. »SAN latency  One controller is the gateway to many disks.  Limited bandwidth to arrays »NAS latency  Network is usually the weakest link 7

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Enough already, just make it faster! »There’s more than straight line acceleration. »Complex systems force us to tease out the latency bottlenecks »Balancing 3 Options 1.Get the same work done with fewer operations 2.Do more in parallel 3.Make individual operations faster 8

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Get the same work done with fewer operations »In our transportation example, same work with fewer trips … The big semi does this… larger cargo or payload. »With data, however…  Eliminate redundant or superfluous database work Create indexes that reduce table scans Keep tables defragmented to increase read-ahead Keep frequently used data in application memory  Caching techniques to reduce re-reading from storage SAN cache Server memory SQL 2014 Buffer Pool Extension  Compress data More pages in memory increases page life expectancy Compressed data will fit into fewer Physical I/Os ** CPU latency must be lower than storage latency 9

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Do more in parallel »Adding disks to an array increases maximum IOPS  Helps where I/O can be parallelized Multiple CPU issuing synchronous I/Os SQL Server Pre-fetch & Read-ahead Reference: MSDN: Sequential Read AheadMSDN: Sequential Read Ahead »Defragmentation increases Read-ahead, which is asynchronous »Evaluate for parallel capabilities end to end  Multiple file groups on isolated storage  Multiple, isolated LUNs  Multiple OS disk queues  Consider SAN paths & controllers »Bottom line, you can’t parallelize everything  Business Analogy: The Mythical Man Month  Humorous Analogy: The Pregnancy Problem 10

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Make individual operations faster »Almost always, a winner! But often, the most expensive solution. »Lower latency storage  HDD Moving parts  Mechanical latency  Random reads  More mechanical latency  Thus to optimize, maximize sequential reads before random reads  Of course, with RAID arrays, almost every read is random  SSDs have no moving parts  No mechanical latency  Thus all reads are equal. No benefit to sequential vs random »Who’s IO are we talking about?  Typical disk I/Os are usually 4K  SQL Server I/Os range from 8K to 512K »REF: 11

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. How Do I Choose? It depends… :-\ »It depends… At best, all three. Next best, any combination.  3 rd party software may not permit your query tuning  Budget constraints may not permit low latency storage  The size of I/Os may not lend to parallelizing workloads »General rules:  Reducing total # I/Os is always a winner.  For large result sets or concurrency  Increasing IOPS can help a lot  For small result sets  Raw speed (Latency) may be your only hope. 12

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Disk Queue Depth »I hate queues, especially at the DMV! Waiting in line stinks! »Disk Queue Length is a measure of I/O constraint. »How high is OK? It depends on your environment.  Different performance expectation between OLTP and OLAP systems »If it’s consistently high, adding disks to the array may help. »You should be watching this one and DPA does that… 13

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Other WMI Counters »Latency-Like  Avg. Disk Sec/Read is the average time, in seconds, of a read of data from the disk. Any number:  Avg. Disk Sec/Write is the average time, in seconds, of a write of data to the disk. Please refer to the guideline in the previous bullet. »Current-Like  Avg. Disk Reads/Sec is the rate of read operations on the disk.  Avg. Disk Writes/Sec is the rate of write operations on the disk. »Physical Disk: %Disk Time is the percentage of elapsed time that the selected disk drive was busy servicing read or write requests. REF: 14

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Virtual File Stats DMV 15

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Crystal Disk Mark »A great, free tool that tells you the throughput of your storage under a few mixtures of I/O size, queue depth and sequential or random I/O. You may not get your storage admin’s blessing to run this.  But it’s a decent way to measure throughput. 16

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. SQLIO 17 REF:

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. 18 Query Plans & Process Monitor »Query plans tell you when you’re scanning and seeking »ProcMon tells you how many and how big are the storage I/Os

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Server memory, SAN Cache, Tierd Storage etc »You’ll have to clear a few obstacles. »SQL Server caches pages in RAM so when testing you’ll need dump the buffer cache to ensure you are going to disk. »And unless your storage admin is a gift from the DBA gods, you’ll have to get real creative to control for SAN cache in any experiments. »Tiered storage can cause unpredictability too. 19

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Free Tools for SAN & VM environments

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Design Choices : Fragmentation Impacts »Design for Read Ahead  Understand & avoid physical and logical fragmentation  Clustered indexes that monotonously increment on isolated storage  Pre-allocate files in larger swatches rather than auto-grow »Use file groups and different storage based on I/O demand  Rarely accessed things on less performant media  Frequently accessed things on highly performant media »Plan ahead! 21

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. DMV Wait Types »Multiple wait types indicate storage I/O »DPA breaks down query execution by wait type over time. 

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. DEMONSTRATION TIME! 23

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. DPA Storage I/O feature 24

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Think you have Database I/O issues? »Trial Database Performance Analyzer FREE for 14 days. »DPA can identify and recommend action on I/O issues. 25

© 2012 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED. Thank you! »Brian Flynn »Twitter »LinkedIn: brianpaulflynn »Scripts : server-table-scans-bf01/ server-table-scans-bf01/ 26