Você está na página 1de 14

Leveraging Performance

Benchmarking To Increase Speed


J eff McMahon
IBM
Monday, April 27, 2009 14:10 15:10
Session: A04
- 2 -
2009 IIUG Informix Conference
International Informix Users Group 2
Agenda
Client Server round trips (SQLIDEBUG=2:/tmp/sqli)
Identifying buffreads
Identifying hot buffer spins
Identifying lock waits
Wait Stats for thread level statistics
Ways to reduce buffer reads and contention
Key-only index reads
- 3 -
2009 IIUG Informix Conference
International Informix Users Group 3
Network message size
sqlhosts b=4096
S- >C ( 4096) Ti me: 2009- 01- 28 06: 25: 10. 98795
SQ_TUPLE
# War ni ngs. . : 0
Tupl e l engt h: 16957
S- >C ( 4096) Ti me: 2009- 01- 28 06: 25: 10. 98808
S- >C ( 4096) Ti me: 2009- 01- 28 06: 25: 10. 98811
S- >C ( 4096) Ti me: 2009- 01- 28 06: 25: 10. 98816
S- >C ( 626) Ti me: 2009- 01- 28 06: 25: 10. 98823
SQ_DONE
SQ_EOT
sqlhosts b=32767
S- >C ( 17010) Ti me: 2009- 01- 28 06: 28: 59. 21575
SQ_TUPLE
SQ_DONE
SQ_EOT
- 4 -
2009 IIUG Informix Conference
International Informix Users Group 4
Minimize roundtrips
C- >S ( 40) Ti me: 2009- 01- 28 06: 28: 58. 99710
SQ_PREPARE
S- >C ( 102) Ti me: 2009- 01- 28 06: 28: 58. 99980
SQ_DESCRI BE
C- >S ( 4) Ti me: 2009- 01- 28 06: 38: 54. 23467
SQ_BEGI N
S- >C ( 10) Ti me: 2009- 01- 28 06: 38: 54. 23480
SQ_XACTSTAT
C- >S ( 24) Ti me: 2009- 01- 28 06: 34: 37. 12165
SQ_OPEN
S- >C ( 2) Ti me: 2009- 01- 28 06: 34: 37. 13644
SQ_EOT
C- >S ( 12) Ti me: 2009- 01- 28 06: 34: 37. 13660
SQ_NFETCH
S- >C ( 1570) Ti me: 2009- 01- 28 06: 34: 37. 13813
SQ_TUPLE
C- >S ( 8) Ti me: 2009- 01- 28 06: 34: 37. 13962
SQ_CLOSE
S- >C ( 2) Ti me: 2009- 01- 28 06: 34: 37. 13974
SQ_EOT
C- >S ( 4) Ti me: 2009- 01- 28 06: 38: 54. 25308
SQ_CMMTWORK
S- >C ( 10) Ti me: 2009- 01- 28 06: 38: 54. 25322
SQ_XACTSTAT
- 5 -
2009 IIUG Informix Conference
International Informix Users Group 5
Minimize round trips
Prepare once, execute many
Pack all of the logic into stored procedures (SPL) or user
defined routines (UDR)
- 6 -
2009 IIUG Informix Conference
International Informix Users Group 6
Identifying buffreads
onstat P is useful
sysmaster can make it easier
select
tabname,
sum(pf_bfcread) as buffreads
from
sysactptnhdr,
systabnames
where
pf_bfcread > 0 and
systabnames.partnum = sysactptnhdr.partnum and
dbsname = "tpce"
group by
tabname
order by
buffreads desc;
- 7 -
2009 IIUG Informix Conference
International Informix Users Group 7
Identifying buffreads
tabname daily_market_idx
buffreads 231232956
tabname security
buffreads 177776993
tabname last_trade
buffreads 94464008
- 8 -
2009 IIUG Informix Conference
International Informix Users Group 8
Identifying buffer spin contention
New partnum and page address columns in onstat g spi
onstat g spi | sort nr | head
Num Waits Num Loops Avg Loop/Wait Name
1597244 57983540 36.30 fast mutex, 0:bf[2584] 0x70007c 0x1009c8c0000
838369 25509735 30.43 fast mutex, 3:bf[173] 0x3d00005 0x1011c516000
22057 965992 43.80 fast mutex, 3:bf[710] 0x3d00004 0x1011c948000
11345 607404 30.89 fast mutex, 3:bf[585] 0x3d00005 0x1011c84e000
oncheck pt 0x70007c will provide table or index name
onstat g dmp 0x1009c8c000 to view the page
- 9 -
2009 IIUG Informix Conference
International Informix Users Group 9
Identifying lock waits
sysmaster can make it trivial
select
tabname,
sum(pf_rqlock) as locks,
sum(pf_wtlock) as lockwaits,
sum(pf_deadlk) as deadlocks
from
sysactptnhdr,
systabnames
where
pf_wtlock > 0 and
systabnames.partnum = sysactptnhdr.partnum and
dbsname = "tpce"
group by
tabname
order by
lockwaits desc;
- 10 -
2009 IIUG Informix Conference
International Informix Users Group 10
Identifying lock waits
tabname security
locks 3630551
lockwaits 1292
deadlocks 0
tabname last_trade
locks 110864512
lockwaits 697
deadlocks 0
tabname broker
locks 2464247
lockwaits 513
deadlocks 9
- 11 -
2009 IIUG Informix Conference
International Informix Users Group 11
Wait Stats
Thread level perspective
Set WSTATS=1 in onconfig file
onstat g wst
name tid state n avg(us) max(us)
sqlexec 1686 yield bufwait 1218 13931 252644
sqlexec 1686 yield lockwait 93 47822 1.7s
sqlexec 1686 IO Wait 15065 11405 436206
sqlexec 1686 yield 0 7955 3455 51083
sqlexec 1686 chkpt cond 1 23.8s 23.8s
sqlexec 1686 logio cond 6257 11092 395908
sqlexec 1686 other cond 42397 10103 949540
sqlexec 1686 other mutex 1812 3968 79133
sqlexec 1686 ready 78395 3109 104245
sqlexec 1686 run 74799 1560 66137
- 12 -
2009 IIUG Informix Conference
International Informix Users Group 12
Reducing buffreads
Example
tabname trade_type_idx
buffreads 149
tabname status_type_idx
buffreads 149
tabname trade_idx1
buffreads 54
Example with batched reads (USE_BATCHEDREAD)
tabname status_type_idx
buffreads 50
tabname trade_type_idx1
buffreads 50
tabname trade_idx1
buffreads 4
Example with hash joins on the small tables
tabname trade_idx1
buffreads 4
tabname trade_type_idx1
buffreads 1
tabname status_type_idx
buffreads 1
- 13 -
2009 IIUG Informix Conference
International Informix Users Group 13
Key-Only Reads
Key-Only index reads eliminate data page lookups
Exception to this is varchars in the index column
sqexplain.out can be used to verify Key-Only
3) informix.status_type: INDEX PATH
(1) Index Keys: st_id st_name (Key-Only) (Serial, fragments: ALL)
DYNAMIC HASH JOIN
Dynamic Hash Filters: informix.status_type.st_id = informix.trade.t_st_id
4) informix.trade_type: INDEX PATH
(1) Index Keys: tt_id tt_name (Key-Only) (Serial, fragments: ALL)
DYNAMIC HASH JOIN
Dynamic Hash Filters: informix.trade_type.tt_id = informix.trade.t_tt_id
- 14 -
2009 IIUG Informix Conference
International Informix Users Group 14
J effrey McMahon
IBM
jmcmahon@us.ibm.com
Session: A04
Leveraging Performance Benchmarking to Increase Speed

Você também pode gostar