Click here to load reader

DB2 performance Tips

  • Upload
    misty

  • View
    103

  • Download
    0

Embed Size (px)

DESCRIPTION

DB2 performance Tips. 2009/10/15 Hong, Mee Hee GTS. MTS. , IBM Korea. Performance 의 의미는 ?. Performance ( noun ) “The fulfillment of a claim, promise, or request”. Online Response time 초당 수행된 Transaction Transaction 당 지불 비용 Batch Elapsed time CPU time Query 처리 - PowerPoint PPT Presentation

Citation preview

1Online
() System resource application
User ?
Upgrade ?
Performance ?
© 2009 IBM Corporation
Performance Management ?
system environment (hardware & software),
staff (training or re-allocation!)
performance objectives.”
CPU time, elapsed time, memory usage
Throughput, responsiveness, concurrent user
performance objective :
© 2009 IBM Corporation
© 2009 IBM Corporation
© 2009 IBM Corporation
transaction
DB2
presentation
network
© 2009 IBM Corporation
© 2009 IBM Corporation
Lock/Latch
Log
#DSETS CONVERTED R/W -> R/O < 10-15 / minute
Recommendations
PCLOSEN/T pseudo close
CLOSE(YES) design default (V8)
Dataset Open/Close
PAGE-IN FOR READ / WRITE
Buffer Pool real storage Backup PAGE-IN for READ WRITE I/O
Buffer Pool Real storage
ALTER BPSIZE command BP expansion
Rule-of-Thumb ( steady-state ) :
Buffer Pool Tuning
© 2009 IBM Corporation
Long Term Page Fix : I/O Buffer Pool
Buffer i/o intensity = [pages read + pages written] / [number of buffers]
“ALTER BPOOL(name) PGFIX(YES|NO)”
Buffer Pool Tuning
: BP32K, BP4, BP3, BP2 ( BP5 Data in memory : Hit ratio = 100 %)
© 2009 IBM Corporation
GBP Read Tuning
SyncRead (XI) nodata = 15K, SyncRead (XI) = 183K+15K
SyncRead (XI) miss ratio = 15K/(183K+15K) = 7.6% ( )
SyncReadXI miss ratio = (SyncReadXI-nodata / SyncReadXI) > 10% GBP .
Register Page List request = sequential, list, or dynamic prefetch request
Group Buffer Pool Tuning
Commit / P-lock negotiation
Deferred write / System checkpoint
Unlock Castout
Group Buffer Pool Tuning
Compress / VL update
MAX PG/ROW LOCKS HELD
LOCKSIZE PAGE ( LOCKSIZE ROW )
V8, 64bit IRLM
: ()
#IRLM Request = LOCK+UNLOCK+CHANGE = 31.94+7.39+1.03 = 40.36
#IRLM latch contention Rate = 1.33*100 / 40.36 = 3.3%

IRLM Latch Contention
© 2009 IBM Corporation
: ()
#Global Cont. = SUSPENDS - IRLM+XES+FALSE = 0.15+0.4+0.08 = 0.63
#XES IRLM Req. = SYNCH. XES – (LOCK+CHANGE+UNLOCK) +SUSPENDS – (IRLM+XES+FALSE) = 8.62+0.33+8.20+0.15+0.4+0.08 = 17.78
Global Contention Rate = 0.63*100 / 17.78 = 3.54%
Data Sharing Lock Tuning
: ()
• #XES IRLM Req. = 17.78 ( )
• #P-lock Negotiation Rate = 0.08*100 / 17.78 = 0.5%
© 2009 IBM Corporation
Accounting Trace Thread reuse monitor
Thread reuse (%) : (#COMMITS-DEALLOCATION)*100/#COMMITS
: (974827- 212799)*100/ 974827= 78% thread reuse
Thread Reuse
Accounting Class 3 trace ( latch contention CPU )
LC06 = Index split latch
LC19 = Log latch
© 2009 IBM Corporation
“READ SATISFIED - FROM ..."
: Log apply (UNDO REDO) Log Manager Data Manager log record
Read from output log buffer
Read from archive log dataset
Log Statistics
Log Statistics
• Output Log Buffer size : #UNAVAIL OUTPUT LOG BUF > 0
Output log buffer space page in activity
• #OUTPUT LOG BUFFER PAGED IN > 1-5%* LOG RECORDS CREATED
Approximate average log record size
= (LOG CIs CREATED * 4KB)/(LOG RECORDS CREATED)
© 2009 IBM Corporation
EDM Pool Tuning
- % NON-STEALABLE PAGES IN USE (PTs, CTs) < 50%
- FAILS DUE TO POOL FULL = 0
- CT/PT HIT RATIO > 90 ~ 95%
Plan/Package Bind Release(Commit) EDM !
© 2009 IBM Corporation
EDM Pool Tuning
= [Short Prepares] / [Short + Full Prepares] = 98.70%
• Local Dynamic Statement Cache hit ratio >70% !
= [Prepares Avoided]/[Prepares Avoided + Implicit Prepares] = 62.51%
• Implicit Prepare Short Full Prepare !
© 2009 IBM Corporation
Major MSTR SRB time
Physical log write, thread deallocation, update commit (Page P-lock unlock )
Major DBM1 SRB time
Deferred write, prefetch read, parallel child task, Castout, async GBP write, P-lock negotiation, Notify exit, GBP checkpoint, Delete Name (pageset close pseudo-close non GBP dependent )
Major DBM1 TCB time
Major IRLM SRB time
Local IRLM latch contention, IRLM / XES global contention, async XES request, P-lock negotiation
System Address Space CPU Time …
© 2009 IBM Corporation
DB2 performance issue System Application

database design ( , index , partitioning , RI , stats, )
SQL coding (joins subselect, stage 1 stage 2 predicate, )
Application design (singleton select cursor , dynamic static SQL, host variable , commit , )
DB2 Application Tuning
© 2009 IBM Corporation
Application performance trace type
System application resource
Program CPU elapsed time
EDM pool
COMMIT ABORT
Accounting Trace –
© 2009 IBM Corporation
DB2 CPU time
.
Local application
: (Elapsed – CPU) time
Distributed application
Class 1 Elapsed - Class 2 Elapsed
+
Class 7 : Package/DBRM
Out of DB2
Out of DB2
Thread activity time = Class 1 elapsed
Elapsed time spent out of DB2 = Class 1 elapsed - Class 2 elapsed
Elapsed time spent in DB2 = Class 2 elapsed
Processing time = Class 2 CPU
Waiting time = Class 2 elapsed - Class 2 CPU
Suspended time = Class 3 suspension time
Not accounted time = Waiting time - Suspended time
Accounting Time
© 2009 IBM Corporation
in Appl
in DB2
in UDF
1st SQL..
: where is the time really spent?
Application logic ?
….
Network ?
In DB2
Out of
Access path ?
In DB2 time ... ?
Processing
time
Waiting
time
Waiting
time
Processing
time
Accounting
Statistics
I/O






© 2009 IBM Corporation
© 2009 IBM Corporation
© 2009 IBM Corporation
© 2009 IBM Corporation
© 2009 IBM Corporation
© 2009 IBM Corporation
GetPage .
Buffer pool contention
BP statistics
Suspension ?
performance class 4 on ! :
DASD contention
© 2009 IBM Corporation
Buffer pool contention ?
Catalog
RMF report performance class 4 :
DASD contention
© 2009 IBM Corporation
Checkpoint
DB statistics CHKFREQ
re-reference access pattern Deferred write threshold
BP statistics
Other agent
Write
Lock suspension
Concurrent DDL
class 6 7
Lock suspension
Application
Incompatible workload mix
Page/Row level locking
© 2009 IBM Corporation
Lock latch suspension

DB2 Time
IRLM request 10%
IRLM Trace on .
IRLM dispatching priority
IRLM Query request
(e.g. DISP DATABASE LOCKS,
Deadlock detection cycle
Internal latch suspension
LC06: GBP-dependent index page split Index tree P-lock latch contention
LC07: Dependency Manager Hash Table
LC14: BP LRU chain
LC19: Log
LC24: EDM LRU BM latch
LC25: EDM Pool hash chain
LC32: Storage Manager Pool Header
Lock/Latch Suspension ?
© 2009 IBM Corporation
space map page
Page Latch Suspension ?
Processor overload
Buffer pools, EDM Pool, Sort, thread
Storage
OEM Monitor
DSC miss prepare
?
© 2009 IBM Corporation
TRAN “AAA” PACKAGE Elapsed time AAAAAAAA Package 69% , DB2 SYNCHRONOUS I/O TIME 55% .
AAAAAAAA PACKAGE Synchronous I/O SQL ACCESS PATH DASD contention, I/O Activity , .

AAAAAAAA (TIMES.)
© 2009 IBM Corporation
TRAN “BBBB” BBBBBBBB Package 90% , SQL Activity .
BBBBBBBB PACKAGE SQL Activity APPLICATION .

BBBBBBBB (TIMES.)
© 2009 IBM Corporation
TRAN “CCC” CCCCCCCC Package 80% , SQL Activity GETPAGE .
BP3 GET PAGE REQUEST 78% .
CCCCCCCC PACKAGE SQL Activity GETPAGE APPLICATION .
BP3 ACTIVTY SQL .

CCCCCCCC (TIMES.)