Re: why the difference in swap value for vmstat output

From: Darren Dunham (ddunham_at_redwood.taos.com)
Date: 11/14/03


Date: Thu, 13 Nov 2003 23:56:24 GMT

In comp.unix.solaris Bill <bill12317@lycos.com> wrote:
> All,

> I am looking into a performance issue in one of our servers and need
> some help to understand the output of vmstat and top as I am now
> totally confused.

> The machine is a Sun Enterprise Server running Solaris 8, with 40G of
> RAM and 56 G of disk swap

WOW! 56G of disk swap? What are you doing with this box that makes
that useful? Normally if that much stuff is swapped out, you've got
performance issues.

, which means I have about 90 G of swap.
> Checking the output of vmstat -p 5, I have the following, I
> understand, the swap + free - RAM used by kernel, but I expect

> a. swap + free will be close to 90G, but 57 + 3 is close to 60G, can
> anyone explain why does my swap go ?

The first is free swap (VM) and should agree with 'available' in swap -s
output. The second is free RAM. Free RAM counts in both columns.

> b. I understand the swap or free will be changed, but I explect to
> total of swap + free be the same, but why did it go from 60 G (57 + 3)
> to 70 G ( 62 + 8) ?

5GB of RAM was freed for some reason.

> c. I used to think that only high number for sr means a memory
> shortage,

On Solaris 8 and higher, that's generally correct. Actually *any* sr
would point to that.

 but
> what if my system is a database server using a lof of file system, and
> given we have high fpi, will we be benefited by increasing more disk
> swap, so as to cache more file system ?

Filesystem pages are cached in free RAM, they're not swapped to disk so
increasing your disk backing store should have no effect on file system
caching.

> The following is the top output ...

> ===============================================================
> Memory: 36G real, 7199M free, 33G swap in use, 60G swap free
> ==============================================================

> From what I understand from the man page,
> therefore the above it means that out of the 36G of RAM, about 29G had
> been used, right ? because it shows 7 G is free.

Looks right to me.

> does it also mean that 33G of disks swap is being used? because

> "swap in use" is the amount of swap area on disk that is being used
> "swap free" is the amount of swap area on disk that is still
> available.

If you use 'swap -l' to measure swap on disk in use, it is more clear.

> Does the 33G swap include physical RAM ?

Probably. Compare it to 'swap -s' which does include physical RAM.
 
> I thought I understand swap here, but after looking at the data for a
> few days, I am confused. thanx for the help

'swap -s' looks only at the unified VM space and tells you allocation
within it.

'swap -l' looks only at disk swapfiles and tells you how much is used.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >