Database Tuning
Database Tuning
Database Tuning
December 2, 2005
Mathew Accapadi
/proc tools
– Proccred, procfiles, procflags, procldd, procmap,
procrun, procsig, procstack, procstop, proctree, procwait,
procwdx
SPMI
– provides access to all PTX metrics
– allows application metrics to be export to PTX tools
Hardware counter tools
– PMAPI
– hpmcount, hpmstat, libhpm
Memory
– vmo (virtual memory options)
– ioo (io options but related to memory)
– fdpr, chdev (sys0 device), ulimit (data/stack/rss limits)
I/O
– ioo (I/O options)
– lvmo (LVM options)
– chdev (hdisk, adapter tuning)
– migratepv, migratelp, reorgvg
AIO to LVM files can take a fastpath and bypass the AIO servers
– No tuning needs to be done in this case
AIO to filesystems currently use a set of AIO queues and AIO
server threads
– AIO server threads take I/Os off the queues and submit them to the
filesystem
– Number of AIO server threads can be tuned (maxservers, a per CPU
value)
– AIO server thread does synchronous or non-synchronous I/O based
on the file open flags
– The AIO parameter ‘maxreqs’ specifies how many AIOs can be in
progress and on the queues at any one time
• Once the limit is reached, EAGAIN error is returned to the application
# lsattr -E -l aio0
LRU scans the page frame table looking for eligible pages using a simple
least recently used criteria
– If the page has its reference bit set, it is not stolen but reference bit is reset for
the next pass of LRU
– If the reference bit is not set, the page may be stolen if the page meets certain
criteria
• If the page is a file page, then if the number of file pages is above the file cache limit,
the page can be stolen
• If the number of file pages in memory is in between the minperm value and the
maxperm/maxclient value, then repaging rates are used to determine if the page can
be stolen
– if the lru_file_repage parameter is set to 0, then if the number of file pages in memory is above the
minperm value, file pages are stolen
> Recommendation: set lru_file_repage=0, minperm%=1
• If the number of file pages in memory is below minperm, then LRU steals an
unreferenced page regardless of whether it’s a file page or a computational page
# ps gv
PID PGIN SIZE RSS TRS DRS C PRI NI %CPU TIME CMD
0 7 64 64 0 64 120 16 -- 0.1 2:25 swapper
1 108 844 880 36 844 0 60 20 0.0 0:03 init
8196 0 48 48 0 48 120 255 -- 27.0 954:21 wait
12294 0 48 48 0 48 120 255 -- 26.2 926:39 wait
16392 0 48 48 0 48 120 255 -- 26.0 918:13 wait
20490 0 48 48 0 48 0 255 -- 0.0 0:00 wait
24588 0 56 56 0 56 120 17 -- 0.0 0:33 reaper
28686 0 92 92 0 92 0 16 -- 0.3 12:01 lrud
# svmon -G
size inuse free pin virtual
memory 1572864 1554348 18516 211932 652201
pg space 1048576 5363
# lvmo –a
vgname = rootvg
pv_pbuf_count = 512
total_vg_pbufs = 512
max_vg_pbuf_count = 16384
pervg_blocked_io_count = 17
global_pbuf_count = 512
global_blocked_io_count = 17
aio: avgc avfc maxg maxf maxr avg-cpu: % user % sys % idle % iowait
0 0 0 0 4096 0.0 0.0 100.0 0.0
avgc Average global AIO request count per second for the specified interval (filesystem)
avfc Average fastpath request count per second for the specified interval (raw LV)
maxgc Maximum global AIO request count since the last time this value was fetched (filesystem)
maxfc Maximum fastpath request count since the last time this value was fetched (raw LV)
maxreqs Maximum AIO requests allowed
Transmit
– Application -> socket -> TCP or UDP -> IP -> Interface ->
Device Driver -> Adapter -> wire
Receive
– Wire -> Adapter -> Device Driver -> Demux -> IP -> TCP
or UDP -> socket -> Application
Once PERFPMR has been installed, you can run it in any directory
– To determine the amount of space needed, estimate at least 20MB
per logical CPU plus an extra 50MB of space
– Run “perfpmr.sh <# of seconds>” at at time when the performance
problem is occurring
– A pair of 5-second traces are collected first
– Then various monitoring tools are run for the duration of time specified
as a parameter to perfpmr.sh
– After this, tprof, filemon, iptrace, tcpdump data is collected
– Finally, system config data is collected
– Data can be tar’d up and sent to testcase.software.ibm.com with the
filename having the pmr# in it