Академический Документы
Профессиональный Документы
Культура Документы
This document is primarily written with reference to solaris performance monitoring and tuning but these tools are
iostat , vmstat and netstat are three most commonly used tools for performance monitoring . These comes built in
with the operating system and are easy to use .iostat stands for input output statistics and reports statistics for i/o
devices such as disk drives . vmstat gives the statistics for virtual Memory and netstat gives the network statstics .
Following paragraphs describes these tools and their usage for performance monitoring.
Table of content :
1. Iostat
* Syntax
* example
2. vmstat
* syntax
* example
3. netstat
* syntax
* example
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.
iostat’s activity class options default to tdc (terminal, disk, and CPU). If any other option/s are specified, this default
is completely overridden i.e. iostat -d will report only statistics about the disks.
syntax:
option – let you specify the device for which information is needed like disk , cpu or terminal. (-d , -c , -t or -tdc ) . x
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
Example
$ iostat -xtc 5 2
extended disk statistics tty cpu
disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b tin tout us sy wt id
sd0 2.6 3.0 20.7 22.7 0.1 0.2 59.2 6 19 0 84 3 85 11 0
sd1 4.2 1.0 33.5 8.0 0.0 0.2 47.2 2 23
sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31
If a disk shows consistently high reads/writes along with , the percentage busy (%b) of the disks is greater than 5
percent, and the average service time (svc_t) is greater than 30 milliseconds, then one of the following action needs
to be taken
1.) Tune the application to use disk i/o more efficiently by modifying the disk queries and using available cache
/disksuite etc.
3.) Increase the system parameter values for inode cache , ufs_ninode , which is Number of inodes to be held in
memory. Inodes are cached globally (for UFS), not on a per-file system basis
4.) Move the file system to another faster disk /controller or replace existing disk/controller to a faster one.
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 synctax 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.
Example
example% vmstat 5
faults
in (non clock) device interrupts
sy system calls
cs CPU context switches
A. CPU issues
procs cpu
r b w us sy id
0 0 0 4 14 82
0 0 1 3 35 62
0 0 1 3 33 64
0 0 1 1 21 78
Problem symptoms
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.
Resolution
Resolution to these kind of issues involves tuning of application procedures to make efficient use of cpu and as a last
resort increasing the cpu power or adding more cpu to the system.
B. Memory Issues
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.
Resolution
1. Tune the applications & servers to make efficient use of memory and cache.
2. Increase system memory .
3. Implement priority paging in s in pre solaris 8 versions by adding line “set priority paging=1″ in
/etc/system. Remove this line if upgrading from Solaris 7 to 8 & retaining old /etc/system file.
netstat displays the contents of various network-related data structures in depending on the options selected.
Syntax
netstat
Options
-a – displays the state of all sockets.
-r – shows the system routing tables
-i – gives statistics on a per-interface basis.
-m – displays information from the network memory buffers. On Solaris, this shows statistics
for STREAMS
-s – shows per-protocol statistics. (some implementations allow -ss to remove fileds with a value of 0 (zero) from the
display.)
-v be verbose
Example
$netstat -rn
This shows the output on a Solaris machine who’s IP address is 192.168.1.11 with a default router at 192.168.1.1
The command as above is mostly useful in troubleshooting network accessibility issues . When outside network is not
accessible from a machine check the following
$ netstat -i
This option is used to diagnose the network problems when the connectivity is there but it is slow in response .
* Collisions (Collis)
* Overloaded network,
* Hardware problems.
If the input error rate is high (over 0.25 percent), the host is dropping packets. Hub/switch cables etc needs to be
finding out the open , closed and waiting network tcp connection .
Example
#netstat -a
if you see a lots of connections in FIN_WAIT state tcp/ip parameters have to be tuned because the
connections are not being closed and they gets accumulating . After some time system may run out of
resource . TCP parameter can be tuned to define a time out so that connections can be released and used by new
connection.