Tuning The Server
Some useful UNIX
commands can be used to monitor server CPU and memory usage. Some of the
commands vary depending upon the flavor of UNIX OS, we use. We will discuss
some of the useful Unix commands with their parameters and options associated
with them.
8 top
The UNIX top command provides
information on CPU and memory utilization. The statistics are refreshed every
few seconds to provide near real-time data. Statistics for CPU, memory, and
swap space for the top command are given below.
o
CPU States as Displayed by top
Column Description
User Percentage
of CPU utilized by user.
System Percentage
of CPU utilized by the server.
Idle Percentage of CPU idle time.
o Memory
as Displayed by top
Column Description
Av Available
memory.
Used Used
memory.
Free Free
memory.
o
Swap
as Displayed by top
Column Description
Av Available
swap space.
Used Used
swap space.
Free Free swap
space.
When we execute
top command, the CPU, memory, and swap statistics are displayed, followed by a
list of active system processes.
8 sar
System Activity
Reporter (sar) has many different parameters that can be used. CPU utilization
can be shown with the -u switch, for example, and memory swapping can be shown
with the -w switch.The sar command requires two arguments, the first being the
time interval between samples, and the second being the number of samples to
take. The relevant columns and descriptions of the data of sar are listed below
by executing sar -u to capture CPU utilization.
o Columns
and Descriptions for the sar -u Command
Column Description
%user Percentage
of system utilized by users.
%system Percentage of system utilized by the OS.
%iowait Percentage waiting on I/O.
%idle Percentage of
server that is idle.
Lets take an
example, if we want to display CPU utilization with five samples in 10 second
intervals.Then We will run sar –u as follows:
$ sar – u 10 5
The relevant columns and descriptions
of the data displayed by executing sar -r to capture memory utilization.
o
Statistics
Displayed by the sar -r Command
Column Description
kbmemfree Free memory in KB.
kbmemused Memory used in KB.
%memused Percentage of memory used.
kbswpfree Free swap space in KB.
kbswpused Used swap space in KB.
%swpused Percentage of used
swap space.
Lets take an example,if we want
to display server data for six samples with 5-second intervals between each
sample, we need to run sar – r as follows:
$ sar – r 5 6
8 vmstat
We have one more
command that can be used to display UNIX performance statistics is vmstat.
Common statistics displayed by vmstat arranged in categories are listed below.
o
Categories
for the vmstat Command
Category Description
procs Information
about processes.
memory Information
about virtual and real memory.
wwap Information
about page faults and paging activity.
io Information
about I/O.
system Information
about system interrupts and switches.
cpu Information
about percentage of CPU time.
Lets take an
example of vmstat, if we want to display five summaries at 3-second intervals,
the first summary being the summary since boot up.Then we will run vmstat as
shown below:
$ vmstat 3 5
Additional
details for key vmstat columns in the different categories are listed below.
o
Key
vmstat Statistics
Column Description
r Run
queue.
free Amount
of idle memory (KB).
si Amount
of memory swapped in from disk (KB/s).
so Amount
of memory swapped to disk (KB/s).
bi Blocks
sent to a device.
bo Blocks
received from a device.
us User
time.
sy System
time.
id
Idle
time.
8 Using
ps
The UNIX ps
command is used to display active processes. This command can be sorted by any
of the columns that are displayed by it.
Lets take an
example, if we want to sort by the sixth column, the CPU column, then we need
to run the ps command as follows.
Ps –ef | sort +6
| tail
No comments:
Post a Comment