[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 24 Useful Utilities

24.5 vmstat


To report on virtual memory statistics; process, virtual memory, disk, trap, and CPU activity use the vmstat command, e.g.:

% vmstat

procs memory page disk faults cpu

r b w swap free re mf pi po fr de sr f0 s1 s3 s5 in sy cs us sy id

0 0 0 984 1840 0 1 1 0 1 0 0 0 0 0 0 29 509 151 25 7 68

The "-S 5" options will report on swapping, rather than paging activity every 5 seconds, e.g.

% vmstat -S 5

procs memory page disk faults cpu

r b w swap free si so pi po fr de sr f0 s1 s3 s5 in sy cs us sy id

0 0 0 984 1840 0 0 1 0 1 0 0 0 0 0 0 29 509 151 25 7 68

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 24 111 39 0 0 100

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 72 395 73 2 2 96

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 2 0 35 212 45 6 2 92

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 18 129 44 0 0 100

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 55 324 65 3 2 95

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 58 305 61 3 2 96

0 0 0 61172 628 0 0 0 0 0 0 0 0 0 0 0 34 144 45 0 1 99

where

procs
r in run queue
b blocked for resources (i/o, paging, etc.)
w runnable

memory (usage of virtual and real memory)
swap swap space currently available (Kbytes)
free size of free list (Kb)

page/swap activity
si swap-ins
so swap-outs
pi page-ins (Kb/s)
po page-outs (Kb/s)
fr Kb freed/sec
de anticipated short term memory shortfall (Kb)
sr pages scanned/sec

disk
Number of disk operations/sec for each of up to 4 disks.

faults (Trap/Interrupt average rate)
in (non-clock) device interrupts/sec
sy system calls/sec
cs CPU context switches/sec

cpu
us user time
sy system time
id idle

This can provide useful information for evaluating NFS file server performance. You could run this for about an hour during peak periods to collect meaningful statistics. CPU idle time should be at least 10% inorder for the system to efficiently schedule daemons and to process protocols.

The "-s" option will display the contents of the sum structure, related to paging events, e.g.

% vmstat -s

0 swap ins

0 swap outs

0 pages swapped in

0 pages swapped out

6458837 total address trans. faults taken

752003 page ins

135318 page outs

1419068 pages paged in

515004 pages paged out

76738 total reclaims

71392 reclaims from free list

0 micro (hat) faults

6458837 minor (as) faults

734466 major faults

1338667 copy-on-write faults

2067746 zero fill page faults

2443859 pages examined by the clock daemon

156 revolutions of the clock hand

1374036 pages freed by the clock daemon

43658 forks

1497 vforks

54907 execs

811460734 cpu context switches

691373136 device interrupts

46740506 traps

2727532551 system calls

34362625 total name lookups (cache hits 93%)

10675 toolong

133937046 user cpu

37507920 system cpu

362695349 idle cpu

1386715 wait cpu

If the "total name lookups" cache hit rate is a low percentage ( < 70%) on a SunOS 4.1.X NFS server you should consider increasing the value of MAXUSERS to 128 and increase nbuf (default is 27, increase to 64 for 1-4 disks, 112 for > 4 disks). SunOS 5.X automatically sizes MAXUSERS to fit available memory.

Increasing MAXUSERS also increases the values of nproc (number of processes allowed), ninode (inode cache), ncsize (directory cache table), nfile (# open files allowed), and ncallout (callout queue).

In general, for a SunOS 4.1.X server, if you have 32 MB RAM on your server set MAXUSERS to:

64 4 disks, or 10 simultaneous users

128 > 4 disks, or > 10 simultaneous users

Buffer cache is another parameter that can have a large affect on performance. You should reserve about 10% of kernel memory for disk I/O cache to reduce disk I/O. This means increasing nbuf to 64 for systems with ³ 4 disks (and > 60% busy) or to 112 for systems with > 4 disks.

Additional hardware you can add to increase performance would be a Prestoserve or NC400 board to enhance NFS performance. (With NFS version 3, these hardware cards may not produce as large an improvement as they did with version 2.) If the ethernet traffic is limiting you could add additional ethernet controllers. On compute servers it helps to increase the memory. You can also balance the load across disks and ethernets available to the server.


Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]