Performance tuning:
Monitoring
the system using unix commands
1.
Using the sar command to monitor CPU
usage
2. Finding
the worst user on the system using the top command
3. Using
the uptime command to monitor the CPU load
4. Using
the mpstat command to identify CPU bottlenecks
5. Combining
ps with selected V$ views
6. Using
the sar command to monitor disk I/O problems
7. Using
iostat to identify disk I/O bottlenecks
8. Using
sar and vmstat to monitor paging/swapping
9. Determining
shared memory usage using ipcs
10. Monitoring
system load using vmstat
11. Monitoring
disk free space
12. Monitoring
network performance
Sar utility
%usr Percent of CPU running in user mode (Abnormally
high %usr. This could be due to applications not being tuned properly
or over-utilizing the CPU.)
%sys Percent of CPU running in system mode (Bottlenecks
with %sys > 15. This could indicate swapping, paging, or backups are
causing a bottleneck.)
%wio Percent of CPU running idle with a process waiting
for block I/O (a
high %wio, waiting for I/O, time. This would point toward a disk contention
problem.)
%idle Percent
of CPU that is idle (A
low %idle time could point to a CPU-intensive job or an underpowered CPU)
The sar command
has many different switches that can be set to display different pieces of
performance information
Monitor
CPU Utilization : sar –u eg : sar –u 5 4 -- 5 seconds apart print 4 times
I/O
Activity reports : sar
–d (Reports Activity on
block devides)
Things to watch for with disk I/O (sar –d) include the
following:
device %busy avque r+w/s blks/s
avwait avserv
·
%busy on a device that is greater
than 50 percent
·
avwait is greater than avserv
·
A high %busy and high avque would
indicate a big disk I/O bottleneck
Check
the Buffer cache : sar –b reports on the
system’s buffer cache activities (not the
Oracle buffer cache).
9:48:44 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s
pwrit/s
·
Read cache: %rcache > 90%,
indicating the potential for bad disk I/O
·
Write cache: %wcache < 70%,
likewise indicating the potential for bad disk I/O
Check the run (Queue Lengths and Swap
queue lengths) : sar –q
10:00:18 runq-sz %runocc swpq-sz %swpocc
·
the smaller these numbers
·
We need to compare “sar –q” against
“sar –w” data to see if the runq-sz is greater than 4 or the %swpocc is greater
than 5, which would signal a potential issue
Using sar and vmstat commands to
monitor Paging/Swapping
Paging : In
a virtual memory system, paging is when users that are not currently active are moved from
memory to disk (a small issue)
Swapping : Swapping
is when users that are currently
active are moved to disk due to insufficient memory (very large issue)
Quick command for swapping :
vmstat –S (if there has been any swapping
activity since the system started is to
issue the
command vmstat –S.)
Report Paging Activity :
sar –p (Will come back to this)
Report swapping and
switching activity : sar –w
swpin/s
bswin/s swpot/s bswot/s pswch/s
Looks Up
·
Pswch/s should be < 50
·
he swapping activity should be
looked at closely if swpot/s rises above 0.
Reporting Free Memory & Free swaps:
sar –r
freemem freeswap
When
freemem (free memory—listed here in 512-byte blocks) falls below a certain
level, the
system will
start to page. If it continues to fall, the system will then start to swap
processes out.
This is a
sign of a rapidly degrading system. Look for processes taking an extreme amount
of
memory, or else an excessive
number of processes