Thursday, May 12, 2011

Sun Solaries / Linux / AIX / UNIX OS performance monitoring or OS tuning for oracle database specially

Sun Solaries / Linux / AIX / UNIX OS performance monitoring or OS tuning for oracle database specially
----------------------------------------------------------------------------------------
First of all you need know the name of some tools for that, these all are about same in all plat form with slight syntax difference.
These tools are :-
1) iostat
2) vmstat (Virtual Memory Statistics)
3) netstat
4) mpstat for cpu (Report per-processor or per-processor-set statistics)

5) prstat / top

6) uptime

7) prtdiag ( such as #prtdiag –v )

8) ps –ef (for process monitoring)

# ps -ef | grep -i smon (searching a process like smon)
# ps -ef | grep -i oracle
9) sar System Activity Reporter

Now I want some details about these with some examples:-
1) iostat :- iostat reports terminal and disk I/O activity and CPU utilization. The first line of output is for the time period since boot & each subsequent line is for the prior interval . Kernel maintains a number of counters to keep track of the values.
For details help just type
root# man iostat

syntax:
Basic synctax is- iostat [option] [interval] [count] ( root# iostat 5 20 )
option – let you specify the device for which information is needed like disk , cpu or terminal. (-d , -c , -t or -tdc ) . x options gives the extended statistics .
interval – is time period in seconds between two samples . iostat 4 will give data at each 4 seconds interval.
count – is the number of times the data is needed . iostat 4 5 will give data at 4 seconds interval 5 times
output description: tty – terminal , cmdk0 sd0 nfs 1 – disk , cpu
The fields have the following meanings:
disk name of the disk
r/s reads per second
w/s writes per second
Kr/s kilobytes read per second
Kw/s kilobytes written per second
wait average number of transactions waiting for service (Q length)
actv average number of transactions actively being serviced
(removed from the queue but not yet completed)
%w percent of time there are transactions waiting
for service (queue non-empty)
%b percent of time the disk is busy (transactions
in progress)
2) vmstat - vmstat reports virtual memory statistics of process, virtual memory, disk, trap, and CPU activity.
On multicpu systems , vmstat averages the number of CPUs into the output. For per-process statistics .Without options, vmstat displays a one-line summary of the virtual memory activity since the system was booted.
For details help just type
root# man vmstat

Syntax
Basic synctax is- vmstat [option] [interval] [count]
option – let you specify the type of information needed such as paging -p , cache -c ,.interrupt -i etc.
if no option is specified information about process , memory , paging , disk ,interrupts & cpu is displayed .
interval – is time period in seconds between two samples . vmstat 4 will give data at each 4 seconds interval.
count – is the number of times the data is needed . vmstat 4 5 will give data at 4 seconds interval 5 times.
The fields of vmstat's display are

kthr
-------------------------
r in run queue
b blocked for resources I/O, paging etc.
w swapped

memory (in Kbytes)
---------------------
swap - amount of swap space currently available
free - size of the free list

page ( in units per second).
---------------------------
re page reclaims - see -S option for how this field is modified.
mf minor faults - see -S option for how this field is modified.
pi kilobytes paged in
po kilobytes paged out
fr kilobytes freed
de anticipated short-term memory shortfall (Kbytes)
sr pages scanned by clock algorithm

disk ( operations per second )
-------------------------------------
There are slots for up to four disks, labeled with a single letter and number.The letter indicates the type of disk
(s = SCSI, i = IPI, etc).The number is the logical unit number.

Faults
------------
in (non clock) device interrupts
sy system calls
cs CPU context switches

Cpu
-----------------
cpu - breakdown of percentage usage of CPU time.
On multiprocessors this is an a average across all processors.
Cs process
us user time
sy system time
id idle time

3) netstat
netstat displays the contents of various network-related data structures in depending on the options selected.
For details help just type
root# man vmstat
Values to look at:
* Collisions (Collis)
* Output packets (Opkts)
* Input errors (Ierrs)
* Input packets (Ipkts)
4) mpstat for cpu (: Report per-processor or per-processor-set statistics)

for details just type
root# man mpstat


5) prstat is like top command of linux
for average load, memory ,process

average load 12 13 20
first value is last 5 minutes load average
second value is last 10 minutes load average
third value is last 15 minutes load average


6) uptime

7) prtdiag ( such as #prtdiag –v )

8) ps –ef (for process monitoring)

# ps -ef | grep -i smon (searching a process like smon)
# ps -ef | grep -i oracle
9) sar System Activity Reporter

# sar –u 1 4

-u 1 4: Comparison of CPU utilization; 1 seconds apart; 4 times.


Since system tuning involves the art of finding acceptable compromises, you need the ability see the impact of your changes on multiple subsystems. System activity reporter (SAR) programs collect system-performance information in distinct groups. Table A shows how sar groups the performance information. The first column shows the switch you give to sar in order to request that particular information group, and the second column briefly describes the information group.
Table A

Switch Performance Monitoring Group
A All monitoring groups
a File access statistics
b Buffer activity
c System call activity
d Block device activity
g Paging out activity
k Kernel memory allocation
m Message and semaphores
p Paging in activity
q CPU Run queue statistics
r Unused memory and disk pages
u CPU usage statistics (default)
v Report status of system tables
w System swapping and switching
y TTY device activity
One way you can run sar is to specify a sampling interval and the number of times you want it to run. So, if you want to check the file-access statistics every 20 seconds for the next five minutes, you'd run sar like this:This whole listing is the command? It's just the first row, isn't it? What follows is the results of the command?
$ sar -a 20 15
output details
• %usr: The percentage of time the CPU is spending on user processes, such as applications, shell scripts, or interacting with the user.
• %sys: The percentage of time the CPU is spending executing kernel tasks. In this example, the number is high, because I was pulling data from the kernel's random number generator.
• %wio: The percentage of time the CPU is waiting for input or output from a block device, such as a disk.
• %idle: The percentage of time the CPU isn't doing anything useful.

No comments: