Saturday, November 26

Memory Management (Vmstat)

 
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.

Syntax:                    
Basic syntax is
vmstat 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.   

Other essential options which can be used with vmstat:

vmstat  -s  gives  the  summary  of  the  statistics

vmstat  –p  gives  the  information  about  paging  activity.
           
The following command displays a summary of what the system is doing every five seconds.

Example:  vmstat  5

procs
memory

page




disk


faults
cpu

r  b  w
swap
free  re  mf
pi
po
fr
de
sr
s0  s1
s2
s3
in
sy
cs
us  sy  id
0  0  0
11456  4120  1
41
19
1
3
0
2
0
4
0
0
48  112
130
4
14  82
0  0  1
10132  4280  0
4
44
0
0
0
0
0  23
0
0  211  230
144
3
35  62
0  0  1
10132  4616  0
0
20
0
0
0
0
0  19
0
0  150  172
146
3
33  64
0  0  1
10132  5292  0
0
9
0
0
0
0
0  21
0
0  165  105
130
1
21  78




















The fields of vmstat's display are

procs
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 -  breakdown of percentage usage of CPU time. On multiprocessors this is an average across all processors.
us   user time
sy   system time
id   idle time

Identifying the bottlenecks:

1.) If the number of processes in run queue (procs r) are consistently greater than the number of CPUs on the system it will slow down system as there are more processes then available CPUs .

2.) If this number is more than four times the number of available CPUs in the system then system is facing shortage of cpu power and will greatly slow down the processess on the system.

3.) If the idle time (cpu id) is consistently 0 and if the system time (cpu sy) is double the user time (cpu us) system is facing shortage of CPU resources. The system time should not be more than the user time at any give instance.

4.) Memory bottlenecks are determined by the scan rate (sr) . The scan rate is the pages scanned by the clock algorithm per second. If the scan rate (sr) is continuously over 200 pages per second then there is a memory shortage. Scan rate and page out should be zero or 1.


No comments:

Post a Comment