LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Articles > Technical
User Name
Password

Notices

By Jaiprakash at 2006-12-25 09:01
How To : Server Performance check:
==================================



TOP statistics:
==============

Run the "top -c" command and use the following shortcut keys to sort the processes.

shift + M - sort the process based on high Memory Usage.

Shift + P - sort the process based on high CPU usage.


sar Utility
===========

"sar" stands for System Activity Reporter.

CPU Usage:
==========

To check CPU usage over time, run:
sar -u
This command is useful if you want to see overall CPU consumption over time.
%user shows the percentage of CPU utilization at the user level (application).
%system shows the percentage of CPU utilization at the system level (kernel).

To check CPU usage 10 times with a time interval of 3 seconds, run:
sar -u 3 10


Swap Activity:
==============

To check swap activity over time, run:
sar -W
This command is useful if you suspect memory shortages.
pswpin/s shows the total number of swap pages the system brought in per second.
pswpout/s shows the total number of swap pages the system brought out per second.

These numbers should be low. If not, you need more RAM.

To check swap activity 10 times with a time interval of 3 seconds, run:
sar -W 3 10


I/O Activity:
============

To check physical disk I/O activity over time, run:
sar -b
This command is useful if you suspect that the database is I/O bound.
See manual pages for more information.

To check I/O activity 10 times with a time interval of 3 seconds, run:
sar -b 3 10



vmstat Utility
==============

This utility provides a report that covers process activity, paging, memory usage, disk I/O, and CPU usage.

Basic synctax is vmstat <options> interval count

To create 5 reports with a time interval of 3 seconds, run:
$ vmstat 3 5
procs memory swap io system cpu
r b w swpd free buff cache si so bi bo in cs us sy id
0 0 0 186460 7416 9424 45272 1 4 25 35 126 33 3 0 96
0 0 0 186460 7416 9432 45272 0 0 0 17 103 18 0 0 100
0 0 0 186460 7288 9440 45272 0 0 0 73 104 23 4 1 95
0 0 1 186460 7288 9440 45272 0 0 0 5 102 12 0 0 100
0 0 0 186460 7288 9440 45272 0 0 0 8 102 14 0 0 100



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 a
verage across all processors.
us user time
sy system time
id idle time



IOSTAT : Input Output statistics ( 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.

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:

Basic synctax is iostat <options> interval count

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



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


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)





  



All times are GMT -5. The time now is 10:07 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration