DBMS Performance Tuning

Similar documents
IT Best Practices Audit TCS offers a wide range of IT Best Practices Audit content covering 15 subjects and over 2200 topics, including:

File Structures and Indexing

Jyotheswar Kuricheti

Outline. Database Tuning. Ideal Transaction. Concurrency Tuning Goals. Concurrency Tuning. Nikolaus Augsten. Lock Tuning. Unit 8 WS 2013/2014

TokuDB vs RocksDB. What to choose between two write-optimized DB engines supported by Percona. George O. Lorch III Vlad Lesin

Database Management and Tuning

Ingres Interactive Performance Monitor User Guide ING-102-IPM-01

Kathleen Durant PhD Northeastern University CS Indexes

DB2 Performance Essentials

IMPORTANT: Circle the last two letters of your class account:

Tuesday, April 6, Inside SQL Server

Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems

Get the Skinny on Minimally Logged Operations

Delegates must have a working knowledge of MariaDB or MySQL Database Administration.

Performance Tuning Guide Version: 01.00

Index Tuning. Index. An index is a data structure that supports efficient access to data. Matching records. Condition on attribute value

Craig S. Mullins. A DB2 for z/os Performance Roadmap By Craig S. Mullins. Database Performance Management Return to Home Page.

Predefined Analyser Rules for Sybase

Course Contents of ORACLE 9i

The Oracle DBMS Architecture: A Technical Introduction

Database Management and Tuning

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

Performance Tuning. Chapter 25

Outline. Database Management and Tuning. What is an Index? Key of an Index. Index Tuning. Johann Gamper. Unit 4

Lock Tuning. Concurrency Control Goals. Trade-off between correctness and performance. Correctness goals. Performance goals.

Variable Size Data Pages Understanding the Pros and Cons

Anthony AWR report INTERPRETATION PART I

CA Unified Infrastructure Management Snap

Percona Live September 21-23, 2015 Mövenpick Hotel Amsterdam

Performance Monitoring

Optimising Insert Performance. John Campbell Distinguished Engineer IBM DB2 for z/os Development

Administração e Optimização de Bases de Dados 2012/2013 Index Tuning

Switching to Innodb from MyISAM. Matt Yonkovit Percona

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2008 Quiz II

SQL, NoSQL, MongoDB. CSE-291 (Cloud Computing) Fall 2016 Gregory Kesden

OS and Hardware Tuning

VMWARE VREALIZE OPERATIONS MANAGEMENT PACK FOR. Amazon Aurora. User Guide

Exadata Implementation Strategy

Basics of SQL Transactions

WHITEPAPER. Disk Configuration Tips for Ingres by Chip nickolett, Ingres Corporation

Oracle Database 12c Performance Management and Tuning

OS and HW Tuning Considerations!

Outline. Failure Types

Optimizing RDM Server Performance

<Insert Picture Here> DBA s New Best Friend: Advanced SQL Tuning Features of Oracle Database 11g

BIS Database Management Systems.

OPS-23: OpenEdge Performance Basics

MIS Database Systems.

INFORMATICA PERFORMANCE

Database Applications (15-415)

PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE 3/1/2019 1

CMP-3440 Database Systems

INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados

RAID in Practice, Overview of Indexing

Heckaton. SQL Server's Memory Optimized OLTP Engine

Synergetics-Standard-SQL Server 2012-DBA-7 day Contents

Administração e Optimização de BDs 2º semestre

DATABASE MANAGEMENT SYSTEM ARCHITECTURE

Performance Optimization for Informatica Data Services ( Hotfix 3)

To REORG or not to REORG That is the Question. Kevin Baker BMC Software

Oracle 1Z MySQL 5.6 Database Administrator. Download Full Version :

Database Management Systems

Designing Database Solutions for Microsoft SQL Server (465)

Concurrency Control Goals

Data Warehouse Tuning. Without SQL Modification

Database Applications (15-415)

Using Oracle STATSPACK to assist with Application Performance Tuning

VMware vrealize operations Management Pack FOR. PostgreSQL. User Guide

Data Modeling and Databases Ch 10: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich

Microsoft Developing SQL Databases. Download Full version :

SQL Server 2014 In-Memory OLTP: Prepare for Migration. George Li, Program Manager, Microsoft

Performance Tuning for MDM Hub for IBM DB2

Chapter 2. DB2 concepts

What Developers must know about DB2 for z/os indexes

Data Modeling and Databases Ch 9: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich

INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados

Course Outline. SQL Server Performance & Tuning For Developers. Course Description: Pre-requisites: Course Content: Performance & Tuning.

Hardware Intel Core I5 and above 4 GB RAM LAN Connectivity 500 MB HDD (Free Space)

Infrastructure Tuning

Microsoft SQL Server Database Administration

Table Partitioning Application and Design

Internals of Active Dataguard. Saibabu Devabhaktuni

Database Technology Database Architectures. Heiko Paulheim

<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2

Outline. Parallel Database Systems. Information explosion. Parallelism in DBMSs. Relational DBMS parallelism. Relational DBMSs.

Oracle 1Z0-054 Exam Questions and Answers (PDF) Oracle 1Z0-054 Exam Questions 1Z0-054 BrainDumps

Database Architectures

DB2 9.7 Advanced DBA for LUW

7. Query Processing and Optimization

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM

What is a Page Split. Fill Factor. Example Code Showing Page Splits

PowerCenter 7 Architecture and Performance Tuning

Healthy SQL. Marlon Ramos Premiere Field Engineer - Development

Last Class Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

SQL Server 2014 Internals and Query Tuning

Ingres Trace Utilities

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class. Today s Class. Faloutsos/Pavlo CMU /615

Rdb features for high performance application

ORACLE 8 OBJECT ORIENTED TECHNOLOGY ORACLE SOFTWARE STRUCTURES SERVER SIDE BACKGROUND PROCESSES DATABASE SERVER AND DATABASE INSTANCE

z/os Db2 Batch Design for High Performance

Transcription:

DBMS Performance Tuning

DBMS Architecture GCF SCF PSF OPF QEF RDF QSF ADF SXF GWF DMF Shared Memory locks log buffers Recovery Server Work Areas Databases log file

DBMS Servers Manages client access to databases Comprises functionality specific facilities By default one per installation Multi-threaded process Has system threads and user threads Configurable

Agenda Disk Location layout CPU Threads Memory Caches

Disk Locations Tables Pages

Locations Names by which Ingres points to a disk area At installation default locations are set up for Database Journal Dump Checkpoint Work Use locations to spread disk IO

Locations A database can be extended to use extra database and work locations A table Can be spread across locations Spread across too many locations may degrade performance Need to understand disk set up for WAN SAN Raid

Locations Alternative locations can be created through Accessdb SQL statements Extenddb To use a location a table must be Relocated Reorganized System catalogs are always in the database home location

Tables Single location verses multiple locations Page size Compressed verses non-compressed Indexing Table structure

Partitioned Tables Queries can scan relevant partitions Can make use of Parallel Query Table partitions can be in different locations A partition can be in multiple locations A table can be partitioned by a distribution HASH List Range Automatic

Example Create table employee ( emp_no integer not null not default, emp_name char(32) not null not default, dept_no integer) with partition = ( (list on dept_no partition p1 values (1, 2), partition p2 values (3, 4), partition p3 values (DEFAULT)) subpartition (hash on emp_no 16 partitions) ); modify employee to btree unique on dept_no, emp_no;

Pages Page size = DMF cache size used Functionality verses performance Lock level Table Page Row

CPU User threads Internal Threads Other things

User threads Number of concurrent connections SQL sent Data returned

Internal threads Dead Process Detector thread Force Abort thread Group Commit thread Consistency Point(CP) thread Event thread WriteBehind(WB) thread (for each configured cache) Replicator Queue Manager thread Terminator thread Parallel Query threads Parallel Sort threads Log writer threads

Parallel Query Partitioning not required for parallel query Partitioning enables more parallelism Partition compatible joins in parallel threads

Parallel Query opf_pq_dop Defines the maximum number of exchange nodes that can be compiled into a query plan 0 or 1 prevents the generation of parallel plans Any other positive value enables them Default 8 Maximum 32

Parallel Query opf_pq_partthread Undocumented and not in config.dat Defines the maximum number of threads per exchange node Default 2 Testing show that more than 6 adds no value

Parallel Query opf_pq_threshold Defines the cost threshold that a query plan must exceed before a parallel plan is generated The cost estimate is the sum of the C and D numbers at the top of the query plan Default 1000

Parallel Query Set [No]Parallel <nn> Controls the generation of parallel query plans Can be used to override opf_pq_dop nn indicates the degree of parallelism The number of exchange nodes in a plan Default 4 Maximum 32

Parallel Sort psort_rows Sets the threshold in rows for doing a parallel sort Sorts of fewer than psort_rows rows will not consider a parallel sort The default is 10000 rows

Parallel Sort psort_nthreads Controls the number of threads used when parallel sorting The default is 2 threads A machine with many CPU's and large sorts may benefit from more worker threads Too many threads Will not help sorting May be slower due to contention

Log Writer threads 1 is not enough Start with 4 or 5 Monitor wait-for-logwriter in logstat Minimize wait-for-logwriter Check log disk if more than 20 configured Consider change to log buffer size

Memory On 32 bit maximum of 4 gigabytes On 64 bit lots more available DBMS Workspace DBMS Resource Logging Locking

DBMS Workspace For example: opf_memory psf_memory qef_qep_mem rdf_memory stack_size Memory Allocated in chunks up to the workspace limit Not obvious how much a session is using

DBMS Workspace For large installations Default configuration creates large workspaces Larger does not mean faster Smaller does not mean less resource usage If queries work Do not change Workspace Parameters If some queries take too long Look at the SQL before changing Parameters, tables structures or indexes

DBMS Resource For example: dmf parameters qsf_memory qef_sort_mem rdf_max_tbls For large installations Default configuration may set parameters too small Larger may mean faster Smaller may mean flushing

DMF Defaults are too small Minimum of 1000 pages for single page caches Larger cache may give gains Massive caches may have decreasing benefit Increase and test 2006 is better than previous releases Tune intelligently - use the tools IMA DM420 Monitor Cache Statistics

DMF: Single page buffers Tune caches for Users Transaction throughput Table usage Allow enough pages so that FHDR's, FMAP's, btree root and index pages do not get flushed Consider using a separate cache for session tables Session tables can be large Session tables can be numerous Session tables do get written to disk if the DMF cache is required

DMF: CBF - dbms.cache.8k.derived Derived DBMS Cache Parameters for 8k Name Value Units Protected dmf_cache_size 42000 data pages yes dmf_free_limit 1312 data pages no dmf_group_count 4500 group buffers no dmf_memory 638976000 bytes no dmf_modify_limit 31500 data pages no dmf_wb_end 12600 data pages no Tuned cache in stages: default was 15000 inadaquate

DMF: Single page buffers : DM420 before =====Thu Aug 2 04:37:16 2007 ==========! Buffer Cache Configuration ( 8K) -------------------------! 8 Buffer count:78000 Bucket count:77999 Group count:4500 Size:! Free count: 8099 Limit:498 Modify count:7911 Limit:13300! Free group count: 4875 Modify group count: 125! Fixed count: 0 Group fixed count: 0! WB start limit: 7500 WB end limit: 5500! WB flushes: 324, Agents cloned: 433! Agents active: 0, Agent hwm: 6! WB pages flushed: 0, WB groups flushed: 0! Summary Statistics ( 8K) ---------------------------------------------------------! GWAIT GSYNC FREEWAIT GW PAGES GW I/O! 0 0 0 2130293 892740! FIX CALLS HITS CHECK REFRESH READ TOSS! 746321221 534464098 4831709 3 859937 82289377

DMF: Single page buffers : DM420 after =====Thu Aug 2 04:37:16 2007 ==========! Buffer Cache Configuration ( 8K) -------------------------! 8 Buffer count:78000 Bucket count:77999 Group count:4500 Size:! Free count: 38751 Limit:1312 Modify count:3249 Limit:31500! Free group count: 4286 Modify group count: 214! Fixed count: 0 Group fixed count: 0! WB start limit: 21000 WB end limit: 12600! WB flushes: 120, Agents cloned: 334! Agents active: 0, Agent hwm: 6! WB pages flushed: 0, WB groups flushed: 0! Summary Statistics ( 8K) ---------------------------------------------------------! GWAIT GSYNC FREEWAIT GW PAGES GW I/O! 0 0 0 220821 79740! FIX CALLS HITS CHECK REFRESH READ TOSS! 656525242 643102876 3341709 3 355997 75279473

DMF: Single page buffers : DM420 before Stats for FHDR pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 1192214 98421 1 0 23354 573440 snip! Stats for FMAP pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 1032639 99626 1 0 23222 593242 snip! Stats for ROOT pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 173121327 122332111 0 0 12438 9196 snip! Stats for INDEX pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 10987543 10542532 0 0 7037 79599 snip! Stats for LEAF pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 364864202 309868363 0 0 128483 3443724

DMF: Single page buffers : DM420 after Stats for FHDR pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 1004114 398096 1 0 14374 603510 snip! Stats for FMAP pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 1005639 399626 1 0 14375 603541 snip! Stats for ROOT pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 186263140 186247369 0 0 12128 10129 snip! Stats for INDEX pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 11613185 11597531 0 0 7037 80979 snip! Stats for LEAF pages:! FIX CALLS HITS CHECK REFRESH READ TOSS! 277170152 276704306 0 0 148883 2413774

DMF: Group buffers Tune buffers for queries Tune queries to keep group buffer usage to a minimum Switch on Gather Write Setting Group Buffers to zero does not result in no group buffers

QSF Query Storage Facility Global memory area Used for storing query objects Used to pass information between facilities Monitor using Trace points IMA QS501 QS512

Logging Log buffers Number Size logstat statistics to tune log parameters Log Waits: Free Buffer Split Buffer Buffer utilization profile All logwriters busy Max write queue length Max write queue count

Logging Log buffers Number - default 35 (recom. 200) Size - default 4K (recom. 8K) logstat statistics to tune log parameters Log Waits: Free Buffer Split Buffer Buffer utilization profile All logwriters busy Max write queue length Max write queue count

Logging Log buffers Number - default 35 (recom. 200) Size - default 4K (recom. 8K) logstat statistics to tune log parameters Log Waits: Free Buffer Split Buffer Buffer utilization profile All logwriters busy Max write queue length < Number of buffers Max write queue count

Logging ----Current log file header----------------------------------------------------- Block size: 8192 Block count: 62500 Partitions: 1 Buffer count: 200 CP interval: 5120 Logfull interval: 56250 Abort interval: 45000 Last Transaction Id: 0000455B4B0FBE8F Begin: <1163633519:37587:2448> CP: <1163633519:42735:5956> End: <1163633519:43170:1224> Percentage of log file in use or reserved: 8 Log file blocks reserved by recovery system: 0 Archive Window: <1163633519,42725,5956>..<1163633519,43170,1224> Previous CP: <1163633519,37587,2448> Status: ONLINE,ECPDONE Active Log(s): II_LOG_FILE

Logging ====Fri May 11 01:42:50 2007 Logging System Summary====== Database add 1068 Database removes 1014 Transaction begins 5979858(6M) Transaction ends 5979559 Log read i/o's 126345 Log write i/o's 126835 Log writes 1209002 Log forces 2807 Log waits 10313 Log split waits 0 Log free waits 0 Log stall waits 8 Log BCP waits 8 Logfull stall waits 0 Log group commit 8337 Log group count 8379 Check commit timer 2326 Timer write 2326 Timer write, time 2 Timer write, idle 2324 Inconsistent db 0 Kbytes written 175777 ii_log_file read 126345 ii_dual_log read 0 write complete 126837 dual write complete 0 All logwriters busy 1369 Max write queue len 85 Max write queue cnt 1 ----Buffer utilization profile--------------------------------------------------------------- <10% ********* 10-19% *************** 20-29% ********************** 30-39% ** 40-49% *** 50-59% ** 60-69% * 70-79% * 80-89% * >90% *********

Logging ====Thu Aug 2 04:37:16 2007 Logging System Summary====== Database add 7558 Database removes 7396 Transaction begins 23557021(23M) Transaction ends 23556713 Log read i/o's 511846 Log write i/o's 515768 Log writes 4435689 Log forces 11185 Log waits 45831 Log split waits 0 Log free waits 0 Log stall waits 32 Log BCP waits 32 Logfull stall waits 0 Log group commit 26852 Log group count 27024 Check commit timer 7782 Timer write 7782 Timer write, time 0 Timer write, idle 7782 Inconsistent db 0 Kbytes written 654183 ii_log_file read 511846 ii_dual_log read 0 write complete 515767 dual write complete 0 All logwriters busy 1001 Max write queue len 99 Max write queue cnt 1 ----Buffer utilization profile-------------------------------------------------- <10% ************* 10-19% ***************** 20-29% *************** 30-39% ***** 40-49% **** 50-59% ** 60-69% * 70-79% * 80-89% * >90% *******

Locking Large installations can generate huge Lock limits Resource limits Result in large lock/log shared memory segments lockstat statistics to tune lock parameters High-water marks for: Lock lists Locks Resources Max locks per transaction

Locking =====Fri May 11 01:42:50 2007 Locking System Summary================= Total Locks 757500 Total Resources 505000 Locks per transaction 3000 Lock hash table 100999 Locks in use 956 Resource hash table 10099 Resources in use 902 Total lock lists 530 Lock lists in use 83 =====Fri May 11 01:42:50 2007 Locking System Statistics============== Create lock list 5980545 Release lock list 5980386 Request lock 107257541 Re-request lock 21338874 Convert lock 257715 Release lock 104970761 Escalate 467 Lock wait 80 Convert wait 0 Convert Deadlock 0 Deadlock Wakeups 21 Max dlk queue len 1 Deadlock Search 21 Deadlock 0 Cancel 0 Convert Search 0 Allocate CB 111698597 Deallocate CB 213755494 LBK Highwater 3 LLB Highwater 95 SBK Highwater 3 LKB Highwater 6019 RBK Highwater 9 RSB Highwater 5975 Max Local dlk srch 0 Dlk locks examined 21 Max rsrc chain len 22 Max lock chain len 21 Max locks per txn 3001 Callback Wakeups 0 Callbacks Invoked 0 Callbacks Ignored 0

Locking =====Thu Aug 2 04:37:16 2007 Locking System Summary================= Total Locks 180000 Total Resources 120000 Locks per transaction 10000 Lock hash table 23993 Locks in use 1047 Resource hash table 23993 Resources in use 968 Total lock lists 2160 Lock lists in use 102 =====Thu Aug 2 04:37:16 2007 Locking System Statistics============== Create lock list 23566093 Release lock list 3565717 Request lock 260246455 Re-request lock 58993453 Convert lock 3696830 Release lock 252073614 Escalate 652 Lock wait 196 Convert wait 5 Convert Deadlock 0 Deadlock Wakeups 122 Max dlk queue len 4 Deadlock Search 130 Deadlock 1 Cancel 1 Convert Search 0 Allocate CB 280445255 Deallocate CB 525058377 LBK Highwater 3 LLB Highwater 119 SBK Highwater 3 LKB Highwater 12787 RBK Highwater 10 RSB Highwater 12733 Max Local dlk srch 2 Dlk locks examined 150 Max rsrc chain len 48 Max lock chain len 47 Max locks per txn 5175 Callback Wakeups 0 Callbacks Invoked 0 Callbacks Ignored 0

A few words about tuning Have a plan Tune with care Know the performance baseline Change one thing at a time Measure the change Understand parameter interactions Monitor important E_* E_DMA00D_TOO_MANY_LOG_LOCKS

A few words about tuning Have a plan Tune with care Know the performance baseline Change one thing at a time Measure the change Understand parameter interactions Monitor important E_* errors. E_DMA00D_TOO_MANY_LOG_LOCKS E_DM004B_LOCK_QUOTA_EXCEEDED E_DM9041_LK_ESCALATE_TABLEMaximum number of locks for transaction exceeded. Escalating to table-level lock on table iiprotect in database mydb

A few more words about tuning Tuning is not difficult Monitoring is a continuous process Be pro-active Health checks can save on Hardware costs Non-stressed installations run for longer

Summary Tune with care Have a plan Go on a training course Ask an expert

Questions & Answers

DBMS Performance Tuning