DBMS Performance Monitoring

Similar documents
Response Time Analysis

Response Time Analysis

One of the database administrators

PERFORMANCE TUNING IN MICROSOFT SQL SERVER DBMS

Module 15: Monitoring

The Complete Performance Solution for Microsoft SQL Server

Oracle Database 12c: Performance Management and Tuning NEW

SQL Server Performance Tuning and Optimization

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

Response Time Analysis

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

DB2 for Linux, UNIX, and Windows Performance Tuning and Monitoring Workshop

Performance Counters. Microsoft SQL. Technical Data Sheet. Overview:

Performance Tuning and Optimizing SQL Databases 2016

Toad for Oracle 8.6 SQL Tuning

Monitoring PostgreSQL database with Verax NMS

Proactive database performance management

IBM DB2: LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

MS SQL Performance (Tuning) Best Practices:

PATROL From a Database Administrator s Perspective

TUTORIAL WHITE PAPER. Application Performance Management. Investigating Oracle Wait Events With VERITAS Instance Watch

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

Performance rule violations usually result in increased CPU or I/O, time to fix the mistake, and ultimately, a cost to the business unit.

Product Review: James F. Koopmann Pine Horse, Inc. Quest Software s Foglight Performance Analysis for Oracle

DMS Performance Tuning Guide for SQL Server

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Users are Complaining that the System is Slow What Should I Do Now? Part 1

EZManage V4.0 Release Notes. Document revision 1.08 ( )

System Monitor Guide and Reference

1. This lesson introduces the Performance Tuning course objectives and agenda

Informix Performance Tuning using: SQLTrace, Remote DBA Monitoring and Yellowfin BI by Lester Knutsen and Mike Walker! Webcast on July 2, 2013!

Oracle Database 11g: Performance Tuning DBA Release 2

Sitecore Health. Christopher Wojciech. netzkern AG. Sitecore User Group Conference 2015

SQL Server. DMVs in Action. Better Queries with. Dynamic Management Views MANNING IANW. STIRK. Shelter Island

Load Testing and Monitoring Web Applications in a Windows Environment

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

Analyzing & Optimizing T-SQL Query Performance Part1: using SET and DBCC. Kevin Kline Senior Product Architect for SQL Server Quest Software

Running a Workflow on a PowerCenter Grid

Solving Performance Problems In SQL Server by Michal Tinthofer

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Oracle DBA Course Contents

About Me: Brent Ozar. Perfmon and Profiler 101

The Classical Architecture. Storage 1 / 36

Perfmon counters for Enterprise MOSS

DB2 LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

Improve SQL Performance with BMC Software

How to overcome SQL Server maintenance challenges White Paper

PERFORMANCE TUNING FOR PEOPLESOFT APPLICATIONS

Performance Monitoring with Dynamic Management Views

Crystal Reports Server 2008

ERserver. iseries. Work management

Advanced Oracle SQL Tuning

Oracle EXAM - 1Z Oracle Database 11g Release 2: SQL Tuning. Buy Full Product.

In-memory Tables Technology overview and solutions

Enterprise Manager Performance Tips

Optimizing Your Database Performance the Easy Way

MONITORING A WEBCENTER CONTENT DEPLOYMENT WITH ENTERPRISE MANAGER

Monitor and Manage Your MicroStrategy BI Environment Using Enterprise Manager and Health Center

DB2 for i. Analysis and Tuning. Mike Cain IBM DB2 for i Center of Excellence. mcain@us.ibm.com

How To Use The Correlog With The Cpl Powerpoint Powerpoint Cpl.Org Powerpoint.Org (Powerpoint) Powerpoint (Powerplst) And Powerpoint 2 (Powerstation) (Powerpoints) (Operations

IBM Tivoli Monitoring Version 6.3 Fix Pack 2. Infrastructure Management Dashboards for Servers Reference

Performance Monitoring User s Manual

Web Server (Step 1) Processes request and sends query to SQL server via ADO/OLEDB. Web Server (Step 2) Creates HTML page dynamically from record set

Seminar 5. MS SQL Server - Performance Tuning -

Objectif. Participant. Prérequis. Pédagogie. Oracle Database 11g - Performance Tuning DBA Release 2. 5 Jours [35 Heures]

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

Performance And Scalability In Oracle9i And SQL Server 2000

Transaction Performance Maximizer InterMax

Monitoring applications in multitier environment. Uroš Majcen A New View on Application Management.

PRODUCT OVERVIEW SUITE DEALS. Combine our award-winning products for complete performance monitoring and optimization, and cost effective solutions.

Analyzing IBM i Performance Metrics

vrops Microsoft SQL Server MANAGEMENT PACK User Guide

Virtuoso and Database Scalability

Basic Tuning Tools Monitoring tools overview Enterprise Manager V$ Views, Statistics and Metrics Wait Events

CA Insight Database Performance Monitor for DB2 for z/os

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Performance Troubleshooting Guide for Microsoft Business Solutions Navision

Performance Testing of Java Enterprise Systems

Microsoft Dynamics NAV

SAP HANA - Main Memory Technology: A Challenge for Development of Business Applications. Jürgen Primsch, SAP AG July 2011

Oracle Database 12c: Performance Management and Tuning NEW

Performance data collection and analysis process

ArcGIS for Server Performance and Scalability-Testing and Monitoring Tools. Amr Wahba

Oracle Database Capacity Planning. Krishna Manoharan

CA Nimsoft Monitor. Probe Guide for Active Directory Server. ad_server v1.4 series

Query Performance Tuning: Start to Finish. Grant Fritchey

Holistic Performance Analysis of J2EE Applications

Table of Contents. Chapter 1: Introduction. Chapter 2: Getting Started. Chapter 3: Standard Functionality. Chapter 4: Module Descriptions

Table of Contents INTRODUCTION Prerequisites... 3 Audience... 3 Report Metrics... 3

Proactive Performance Monitoring Using Metric Extensions and SPA

Oracle Database 11g: SQL Tuning Workshop Release 2

Monitoring SAP HANA Database server

ITPS AG. Aplication overview. DIGITAL RESEARCH & DEVELOPMENT SQL Informational Management System. SQL Informational Management System 1

DB Audit Expert 3.1. Performance Auditing Add-on Version 1.1 for Microsoft SQL Server 2000 & 2005

Deploying and Optimizing SQL Server for Virtual Machines

Workflow Templates Library

1 How to Monitor Performance

Unit Storage Structures 1. Storage Structures. Unit 4.3

Transcription:

DBMS Performance Monitoring Performance Monitoring Goals Monitoring should check that the performanceinfluencing database parameters are correctly set and if they are not, it should point to where the problems are Alternatively, you can sit tight and wait for the inevitable angry users complaints OR Correct problems when detected (reactive method) Monitoring (preventive method) 1

How does one monitor a DBMS? By extracting relevant performance indicators, (counters, gauges and details of internal DBMS s activities) By comparing the obtained values of these indicators against ideal values But there are many indicators! A Consumer-Producer Chain of a DBMS s Resources sql commands High Level Consumers PARSER OPTIMIZER DISK SYBSYSTEM EXECUTION SUBSYSTEM LOCKING SUBSYSTEM Intermediate Resources/ Consumers probing spots for indicators MEMORY CACHE MANAGER CPU LOGGING SUBSYSTEM DISK/ CONTROLLER NETWORK Primary Resources 2

Recurrent Patterns of Problems Effects are not always felt first where the cause is! An overloading high-level consumer Ex: query accessing too many rows A poorly parameterized subsystem Ex: disk subsystem that stores tables, indexes, logging in a single disk An overloaded primary resource Ex: CPU busy because non-db processes are using it at the same time A Systematic Approach to Monitoring Extract indicators to answer the following questions Question 1: Are critical queries being served in the most efficient manner? Question 2: Are DBMS subsystems making optimal use of resources? Question 3: Are there enough primary resources available and are they configured adequately, given the current and expected workload? 3

Investigating High Level Consumers: Critical query monitoring Find critical queries Investigate lower levels no Found any? yes Answer Q1 over them no Overconsumption? yes Tune problematic queries Investigating Intermediate and Primary Resources: routine monitoring Answer Q3 Answer Q2 no Problems at OS level? yes Tune low-level resources Tune subsystems yes Problematic subsystems? no Investigate upper level 4

Tools used to gather information Event monitors Query plan explainers Performance monitors Investigating High Level Consumers Answer question 1: Are critical queries being served in the most efficient manner? 1. Identify the critical queries 2. Analyze their access plans 3. Profile their execution 5

Identifying Critical Queries Critical queries are usually those that: Take a long time Consume a great amount of resources (read a lot of data, perform heavy aggregation or sorting, lock an entire table, etc) Are frequently executed Have to be answered in a short time Often, a user complaint will tip us off. Event Monitors to Identify Critical Queries If no user complains... Record DBMS s performance measurements, but only when a system event happens Ex: new user connection, or beginning/end of the execution of an SQL statement Logs the event time, duration and associated performance indicator values Less overhead than other type of tools because indicators are usually by-product of operations monitored and are accessed in a convenient time Particularly appropriate for capturing extraordinary conditions, ex: deadlocks. Typical measures include CPU used, IO used, locks obtained etc. 6

What should be measured and evaluated Interested in the end-of-statement or end-oftransaction event Carry relevant info that indicate the resources the executed query consumed: SQL of the statement, duration of execution, CPU, IO, cache,lock consumption statistics Sort the collected data over a given resource consumption statistic and we can find the most expensive queries by that criterion An example Event Monitor Several CPU indicators sorted by Oracle s Trace Data Viewer Similar tools: DB2 s Event Monitor and MSSQL s Server Profiler 7

What to do in case of problems? Make sure expensive queries are tuned in the best possible way May have to drill down through the consumption chain to search for the real cause of the problem Investigating High Level Consumers Answer question 1: Are critical queries being served in the most efficient manner? 1. Identify the critical queries 2. Analyze their access plans 3. Profile their execution 8

Diagnose Expensive Queries: analyzing access plans PARSER/OPTIMIZER sql parse rewrite enumerate/ cost plans generate chosen plan plan SQL commands are translated into an internal executable format before they are processed After parsing, the optimizer enumerates and estimates the cost of a number of possible ways to execute that query The best choice, according to the existing statistics, is chosen But this choice may not be the best one! Query Plan Explainers to Analyze Plans Explainers usually depict an access plan as a (graphical) single-rooted tree in which sources at the leaf end are tables or indexes, and internal nodes are operators These form an assembly line (actually tree) of tuples! Most explainers will let you see the estimated costs for CPU consumption, I/O, and cardinality of each operator. If you see something strange, change an index. 9

An example Plan Explainer Access plan according to MSSQL s Query Analyzer Similar tools: DB2 s Visual Explain and Oracle s SQL Analyze Tool Finding Strangeness in Access Plans What to pay attention to on a plan Access paths for each table For every table involved in the query, determine how it is accessed: scan, index? Sorts or intermediary results Check if the plan includes a sorting (because of DISTINCT, ORDER BY, GROUP BY) and see if it can be eliminated Materialization of temporary results should be avoided Order of operations May want to force an ordering if we otice the order does not favor the early reduction in the number of tuples Algorithms used in the operators 10

To Index or not to index? select c_name, n_name from CUSTOMER join NATION on c_nationkey=n_nationkey where c_acctbal > 0 Which plan performs best? (nation_pk is an non-clustered index over n_nationkey, and similarly for acctbal_ix over c_acctbal) Non-clustering indexes can be trouble Each access to the index generates a random access to the table possibly duplicate! If!36,308 out of 150,000 customers have positive balance, it ends up that the number of pages read from the table is greater than its size, i.e., a table scan is way better CPU time data logical reads data physical reads index logical reads index physical reads Table Scan 5 sec 143,075 pages 6,777 pages 136,319 pages 7 pages Index Scan 76 sec 272,618 pages 131,425 pages 273,173 pages 552 pages 11

Investigating High Level Consumers Answer question 1: Are critical queries being served in the most efficient manner? 1. Identify the critical queries 2. Analyze their access plans 3. Profile their execution Profiling a Query s Execution A query was found critical but its plan looks okay. What s going on? Put it to run. Profiling it would determine the quantity of the resources used by a query and assessing how efficient this use was Profile of a query execution consists of detailed information about the duration and resource consumption Resources DBMS subsystems: cache, disk, lock, log OS raw resources: CPU 12

Query profiling indicators Duration information involves 3 indicators: Elapsed time for the query: time it took to process it as perceived by the user CPU time: time the CPU was actually used to process the query Wait time: time the query was not processing and waiting for a resource to become available Resource consumption information includes: (I/O) Physical and logical reads/writes (Locking) Maximum nb locks held, nb lock escalations,nb deadlocks/timeouts, total time spent waiting for locks (SQL activity) Nb sorts and temporary area usage: gives an idea of the time spent in expensive overhead activity Two common scenarios 1. Elapsed query time close CPU time, wait time negligible. Consumption fair: reasonable nb pages being accesses, most of them are logical accesses; nb locks low or inexistent and no deadlocks or lock escalations; if there were sorts, they didn t augment the nb of logical/physical reads/writes Access plan is executed in the best way possible; if the rest of the chain is balanced, this is the best performance the system can deliver for this query 2. Noticeable discrepancy between elapsed and CPU time, wait time fills the gap. So there must be a problem in resource consumption: contention pb (probably waiting for locks) or poorly performing resource (ex. If area allocated for sorting is small, then additional I/O). To distinguish between contention and physical resource consumption problem, run the query in isolation 13

Performance Monitors to Profiling Queries Access or compute performance indicators values at any time Many, many flavors Scope of the indicators: Generic (all indicators from OS and DBMS) or specific (correlated indicators of a given subsystem or a given query) Choose the generic one when interested in how several distinct indicators behave together Frequency of data gathering: snapshot perf indicators: allow to freeze a situation at a specific moment in time Continuous perf. Indicator: snaphotting at regular intervals Alarm modes: allows us to enter thresholds beyond which the system is acting abnormally Presentation of data: textual or graphical Textual good for seeing the precise values of indicators Graphical chosen when wants to see the trends An example Performance Monitor (query level) Statement number: 1 select C_NAME, N_NAME from DBA.CUSTOMER join DBA.NATION on C_NATIONKEY = N_NATIONKEY where C_ACCTBAL > 0 Details of buffer and CPU consumption on a query s report according to DB2 s Benchmark tool Similar tools: MSSQL s SET STATISTICS switch and Oracle s SQL Analyze Tool Number of rows retrieved is: 136308 Number of rows sent to output is: 0 Elapsed Time is: 76.349 seconds Buffer pool data logical reads = 272618 Buffer pool data physical reads = 131425 Buffer pool data writes = 0 Buffer pool index logical reads = 273173 Buffer pool index physical reads = 552 Buffer pool index writes = 0 Total buffer pool read time (ms) = 71352 Total buffer pool write time (ms) = 0 Summary of Results ================== Elapsed Agent CPU Rows Rows Statement # Time (s) Time (s) Fetched Printed 1 76.349 6.670 136308 0 14

An example Performance Monitor (system level) An IO indicator s consumption evolution (qualitative and quantitative) according to DB2 s System Monitor Similar tools: Window s Performance Monitor and Oracle s Performance Manager Investigating Intermediate and Primary Resources: routine monitoring Answer Q3 Answer Q2 no Problems at OS level? yes Tune low-level resources Tune subsystems yes Problematic subsystems? no Investigate upper level 15

Investigating Primary Resources Answer question 3: Are there enough primary resources available for a DBMS to consume? Primary resources: CPU, disk/controllers, memory, and network Analyze specific OS-level indicators to discover bottlenecks. A system-level performance monitor is the right tool here CPU Consumption Indicators at the OS Level CPU % of utilization 100% 70% total usage system usage time Sustained utilization over 70% should trigger the alert. System utilization shouldn t be more than 40%. DBMS (in a nondedicated machine) should be getting a decent time share. 16

Disk Performance Indicators at the OS Level Average Queue Size Should be close to zero Disk Transfers /second Idle disk with pending requests? Check controller contention. Also, transfers should be balanced among disks/controllers New requests Wait queue Wait times should also be close to zero What to do in case of problem? If there are long waiting queues and long service times, check the number of bytes transferred to confirm the disk is busy. Idle disks with pending requests imply controller problems Also compare the wait times from each disk, if we have a group of disks serving the same purpose Only reorganize data if we are sure the I/o problems are not dur to high-level consumer inefficiency 17

Memory Consumption Indicators at the OS Level Page faults/time should be close to zero. If paging happens, at least not DB cache pages. real memory virtual memory % of pagefile in use (it s used a fixed file/partition) will tell you how much memory is lacking. pagefile What to do in case of problems? If the DB buffer size was properly configured, paging should come from non-dbms sources. Checking memory at the OS level should be done whenever we change the memory allocation parameters of the DBMS or there are significant changes in the nb of users 18

Investigating Intermediate and Primary Resources: routine monitoring Answer Q3 Answer Q2 no Problems at OS level? yes Tune low-level resources Tune subsystems yes Problematic subsystems? no Investigate upper level Investigating Intermediate Resources/ Consumers Answer question 2: Are subsystems making optimal use of resources? Main subsystems: Cache Manager, Disk subsystem, Lock subsystem, and Log/Recovery subsystem Extract and analyze relevant perf. indicators A Performance Monitor is usually useful, but sometimes specific tools apply 19

Cache Manager Performance Indicators Cache Manager Pick victim strategy Page reads/ writes Table scan readpage() Data Pages Free Page slots If page is not in the cache, readpage (logical) generate an actual IO (physical). Ratio of readpages that did not generate physical IO (cache hit ration) should be 90% or more Pages are regularly saved to disk to make free space. # of free slots should always be > 0 What to do in case of problem? If indicators have bad values, the buffer manager is not saving as many disk accesses as it should One or a small nb of queries may be responsible May have slow disk subsystem May have insufficient memory Tuning parameters accordingly 20

Disk Manager Performance Indicators rows Row displacement: should kept under 5% of rows Storage Hierarchy (simplified) page extent file Free space fragmentation: pages with few space should not be in the free list Data fragmentation: ideally files that store DB objects (table, index) should be in one or few (<5) contiguous extents disk File position: should balance workload evenly among all disks What to do in case of problem? Bad indicator values usually mean inadequately chosen storage parameters To choose good storage parameters, should be aware of rate at which data grows and with what mix of inserts/updates/ deletes that growth rate happens Also, identifiy occasional but predicatble fluctuations in the DB activity Then tune disk subsystem 21

Lock Manager Performance Indicators Lock List Lock request Object Lock Type TXN ID Locks pending list Lock wait time for a transaction should be a small fraction of the whole transaction time. Number of locks on wait should be a small fraction of the number of locks on the lock list, under 20% Deadlocks and timeouts should be virtually inexistent or extremely low (no more then 1% of the transactions) What to do in case of problem? The lock subsystem is often a reflection of how well the transactions were designed and seldom a source of a problem itself Can move up the consumption chain and find expensive queries, including data locking ones. 22

Logging Subsystem Performance Indicatores Log is used by every transaction that alters, inserts or deletes data Well tuned logging subsyst. Can write log records at a pace that doesn t slow active transactions Indicatores to measure: Number of log waits to confirm that the disks storing the log files are keeping pace with the transaction workload should be zero Nb of log expansions or log archives due to lack of space if bigger than zero indicates a configuration problem Log cache-hit ratio to check whether the size of the log buffer is adequate Conclusion Monitoring a DBMS s performance can be done in a systematic way The consumption chain helps distinguishing problems causes from their symptoms Existing tools help extracting relevant performance indicators The three questions guide the whole monitoring process 23