Professional Documents
Culture Documents
Unix System Performance
Unix System Performance
Unix Systems administrator performs the job of systems monitoring in between other
jobs. In order to be well informed about system all the time, the very first thing is control
of system. In all cases if you work in a team make sure that you tell your teammate about
anything you do in system which is going to affect performance. System utilities and
commands which reports about and perform vital statistics collections are:
Commands
• cron jobs.
• uptime tells you about load average.
• ps tells about processes running in the systems.
• iostat tells about input and output statistics.
• sar, vmstat informs about memory, cpu, disk utilization reports. (in case of bsd
systems vmstat)
• netstat is used for networking reports.
• other self written scripts.
SAR reports
usage sar -function
Sar functions
Average 2.6 86
PS command.
ps -el | more
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY
TIME COMD
3 S 0 0 0 0 0 20 0 0 482f60 ?
3:11 schet
3 S 0 2 0 0 0 20 30810 4096 4900e4 ?
10:08 vhanh
1 S 0 159 1 0 28 20 3081c 56 fcbc5c ?
0:00 strer
1 S 0 1408 1 0 28 20 30b21 104 fcbb14 syscon
0:00 gettl
1 S 0 167 1 0 40 20 30893 52 47da28 ?
0:00 volid
5 S 0 171 1 0 26 20 30835 528 48bc30 ?
0:17 vold
41 S 0 321 1 0 26 20 308b1 108 1b66b4 ?
0:00 ktlod
1 S 0 517 1 0 40 20 30904 100 4831ec ?
0:00 x25nd
1 S 0 560 1 0 40 20 30941 92 4831ec ?
0:00 netd
1 S 0 459 1 0 26 20 3094e 72 48bc30 ?
0:02 trlod
what it means?
To reduce the workload on system make sure you are only running the daemons you
need, disabling the unnecessary daemons can significantly improve the load on system.
Daemons
accounting : The command accton enables system-wide accounting services, if you are
not using accounting on your system then disabling accton command will increase
productivity of your system.
biod: Daemon allows the system to access filesystems via NFS.
comsat: program that prints "you have new mail" on your screen.
routed: This daemon routes network packets destined for other networks. If your local
network has only one gateway to the outside world you can disable routed. Then make
sure that /etc/rc.local has a line such as route add default gateway 1
rwhod: This daemon provides information about users on other systems, rwho and
ruptime commands use this daemon.
sendmail: This provides e-mail services both internally and externally (between other
systems). Sendmail uses lot of memory.
timed: This daemon attempts to synchronize system clocks across a network. If you are
working across different systems then this is necessary.
ypbind: This daemon lets the system look up information in NIS database. Atleast one
system must be running ypserv before you can run ypbind.
ypserv: This daemon makes a system act as an NIS server, the system that can send
information about the NIS database to other systems on network. It must not be running if
system isn't a NIS server.
back to top of page
Back to main page
Memory Management.
Memory management and performance issues are probably the most important in any
system. If there is not engouh physical memory installed in system, Most Unix systems
use swap and paging techniques to make sure that adequate memory is available at all
time. When you set up a file system for the first time, a separate swap area is also
required to be setup. Swapping and Paging can significantly reduce the performace of
your system. Difference between swapping and paging is that, Swapping occurs when
whole process is transferred to disk, while paging is when some part of process is
transferred to disk while rest is still in physical memory. There are two utilities to
monitor memory, called vmstat (for bsd, etc), sar( for system V, etc). Page-ins and page-
outs are pages moved in and out from physical memory to disk, swap-ins and swap-
outs are processes moved in and out of disk.
First find out the size of your application using size command as follows, here
application name is a.out (binary executable). In case there are many applications, add
their sizes and multiply by the number of times they will run on a system. size command
will show text, data and stack in the executable file.
size a.out
Then using file command will tell you about this file as followed.
file a.out
a.out: iAPX 386 executable not stripped
If this file had been pure executable then we had a need to account for the text and
data/stack segments separately. For each invocation, we need to allow 88032 bytes * each
invocation 2000(or 1024 KB) . Perform same computation for each program to be run on
system.
Vmstat command is used in System V and BSD systems, it informs about virtual
memory.
Syntax of vmstat is :
vmstat interval number
so for example, if I want vmstat to show me memory every five seconds and for 3 times I
will use
vmstat 5 3
freemem columns reports how much free memory is available in pages. System starts
paging when free memory drops below the configuration constant called GPSGLO,
paging then continues until the number of free blocks passes GPGSHI. GPGSLO and
GPGSHI default to 25 and 40 blocks. To directly look at swapping statistics use sar -w
dxifour:/u0/ssb>sar -w
• swpin/s is the average number of swapping transfers into memory per second
during interval.
• bswin/s is the average number of 512-byte blocks transferred into memory per
second.
• swpot/s is the average number of swap-outs per second during interval, it should
be zero.
• bswot/s is the average number of 512-byte blocks swapped out of memory per
second, it should be zero.
• pswch/s is number of processes switches per second during the interval.
Disk Management.
Per-process disk throughput. Speed at which single process and read or write to a disk.
You can measure time taken by executing a cp or mv command.
Total disk throughput: Total speed at which all the processes together can transfer to
and from disks.
Other things when considering to buy a disk like rotational speed (most disks are 3600
RPM), Raw transfer rate is not that important as seek time. Disk capacity depends upon
the user need. System V divides each disk into many partitions. You should always stick
to your disk tools when partitioning or defining disk.
iostat is BSD tool which is also found on many system V systems. This tool prints a
number of I/O statistics that will help you to balance disk load. Syntax is
iostat drives interval count
drives are disk drives, interval is in seconds, count is number of samples.
i.e. in following example, all disks with interval of 2 seconds show:
iostat 2i
What it means?
• bps : average number of kilobytes per second during previous interval for disk.
• msps: Average number of milliseconds per seek.
Network Management.
Network performance can reduce the response time and frustrate users. To find out if
your network is slowing down the traffic, try this. First open up a session to the system
from regular terminal emulator and log in while counting the seconds say your system is
named apple, then from another system say orange, rlogin to apple while counting the
seconds it take for login prompt to appear. Compare the time and if rlogin is slower then
your network is reaching its maximum capacity.
The basic network tool is called ping. If you want to see that a system named orange is
reachable from your system named apple then from apple
apple :> ping oranges
This above command tells us that oranges host is reachable and no packets were
dropped. Another command to test networking problems is called netstat.
Netstat -rn shows the static routing table of your system. i.e.
netstat -rn
Routing tables (10 entries)
Destination Gateway Flags ttl Use Interface
default 200.89.161.216 UGP PERM 537225 eg1
193.9.4.1 200.89.161.223 UGHP PERM 61325 eg1
127.0.0.1 127.0.0.1 UHP PERM 0 loop
191.99.8.40 200.89.161.245 UGHD 29 937 eg1
for more information about netstat, type man netstat at prompt.
back to top of page
Back to main page
Kernel Management.
Kernel is the heart of a Unix operating system. It manages memory, schedules
processes, manages I/O, and does all of the other low level jobs. Since it does all the
important jobs it is always resident in physical memory of a Unix system. Other
programs and software processes can be swapped or paged but kernel is always in
physical memory. That's the reason that it should be as small as possible. To configure
Kernel, login as root to system console and use the utility provided by your system. HP-
UX uses sam, AIX uses smit, sco uses scoadmin, dynix uses menu. The things that you
can do is make sure that software and drivers are absolutely needed to be in the system,
if not then remove them and compile and replace the current kernel.