Unix Technical Forum

why the difference in swap value for vmstat output

This is a discussion on why the difference in swap value for vmstat output within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> All, I am looking into a performance issue in one of our servers and need some help to understand ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2008, 06:52 AM
Bill
 
Posts: n/a
Default why the difference in swap value for vmstat output

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, 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 ?
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) ?
c. I used to think that only high number for sr means a memory
shortage, 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 ?

57707936 3069024 1767 2071 3 0 0 0 0 0 0 0 0 11476
3 3
57708032 3069192 1438 32 0 0 0 0 0 0 0 0 0 11513
0 0
57706672 3068576 1559 479 0 0 0 0 0 0 0 0 0 11510
0 0
57707192 3067992 1671 1690 3 0 0 0 0 0 0 0 0 11576
4 3
57703944 3060472 1531 258 0 0 0 0 0 0 0 0 0 11555
0 0
memory page executable anonymous
filesystem
swap free re mf fr de sr epi epo epf api apo apf fpi
fpo fpf
57700872 3058544 1670 1698 4 0 0 4 0 0 0 0 0 11636
4 4
57700824 3058304 1551 302 0 0 0 0 0 0 0 0 0 12400
0 0
57700896 3055288 1456 91 0 0 0 0 0 0 0 0 0 11785
0 0
57700328 3055048 1746 1843 4 0 0 0 0 0 4 0 0 12107
4 4
57700776 3051616 1466 43 0 0 0 0 0 0 0 0 0 12118
0 0
57693648 3032264 2347 4082 4 0 0 6 0 0 0 0 0 16505
4 4
59588960 5107288 1711 1326 9 0 0 28 0 0 806 0 0 11670
9 9
62891128 8215424 1488 151 0 0 0 0 0 0 48 0 0 11596
0 0
63052792 8381368 1714 1806 3 0 0 0 0 0 116 0 0 11588
3 3
63059040 8386120 1455 46 0 0 0 0 0 0 0 0 0 11576
0 0
63059016 8386264 1752 1865 6 0 0 0 0 0 0 0 0 11572
6 6
63057960 8385320 1448 138 0 0 0 38 0 0 0 0 0 11454
0 0
63058224 8385520 1522 314 0 0 0 0 0 0 1 0 0 11444
0 0
63058368 8385560 1614 1613 0 0 0 0 0 0 0 0 0 11196
0 0
63058264 8385768 1529 262 0 0 0 0 0 0 0 0 0 11483
0 0


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.

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.

Does the 33G swap include physical RAM ? if it does, it explains why I
have 60G swap free, because I have a total of 90G swap. If it does
not, it means
I have used up (29G + 33 G) 62G of swap, therefore why would I have 60
G of swap free?

I thought I understand swap here, but after looking at the data for a
few days, I am confused. thanx for the help

BM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 06:52 AM
Langelage, Frank
 
Posts: n/a
Default Re: why the difference in swap value for vmstat output

Bill 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, 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 ?

from man vmstat
memory
Report on usage of virtual and real memory.
swap amount of swap space currently *available* (Kbytes)
free size of the *free* list (Kbytes)

> 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) ?

See above.

> c. I used to think that only high number for sr means a memory
> shortage, 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 ?

If your system is mainly database server with database files in
filesystems, the memory is used for caching those files.
This leads to a double caching and memory and cpu-waste.
The database should cache the data in systems shared memory.
On solaris you can mount filesystems with only database files in it with
option "forcedirectio".

> memory page executable anonymous
> filesystem
> swap free re mf fr de sr epi epo epf api apo apf fpi
> fpo fpf
> 57700872 3058544 1670 1698 4 0 0 4 0 0 0 0 0 11636
> 4 4
> 57700824 3058304 1551 302 0 0 0 0 0 0 0 0 0 12400
> 0 0
> 57700896 3055288 1456 91 0 0 0 0 0 0 0 0 0 11785
> 0 0
> 57700328 3055048 1746 1843 4 0 0 0 0 0 4 0 0 12107
> 4 4
> 57700776 3051616 1466 43 0 0 0 0 0 0 0 0 0 12118
> 0 0


So you have ~55 GB swap free here and ~3 GB free RAM.
This means, ~35 GB swap and ~33 GB RAM are in use.

> 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.


Yes.

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

Yes.

> 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.

Yes.

> Does the 33G swap include physical RAM ?

No.

> if it does, it explains why I
> have 60G swap free, because I have a total of 90G swap. If it does
> not, it means
> I have used up (29G + 33 G) 62G of swap, therefore why would I have 60
> G of swap free?
>
> I thought I understand swap here, but after looking at the data for a
> few days, I am confused. thanx for the help
>
> BM



regards

Frank Langelage

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-12-2008, 06:52 AM
Darren Dunham
 
Posts: n/a
Default Re: why the difference in swap value for vmstat output

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. >
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-12-2008, 06:52 AM
Bill
 
Posts: n/a
Default Re: why the difference in swap value for vmstat output

thanx. I know I was confused :-(.
I like to confirm my theory, given that scanner starts scanning when
free memory is lower than lotsfree, the "free memory" is really RAM,
hence even if I add swap, it would not help the scanner, right ?


Darren Dunham <ddunham@redwood.taos.com> wrote in message news:<ISUsb.10080$MR.8517@newssvr29.news.prodigy.c om>...
> 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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-12-2008, 06:53 AM
Darren Dunham
 
Posts: n/a
Default Re: why the difference in swap value for vmstat output

In comp.unix.solaris Bill <bill12317@lycos.com> wrote:
> thanx. I know I was confused :-(.
> I like to confirm my theory, given that scanner starts scanning when
> free memory is lower than lotsfree, the "free memory" is really RAM,
> hence even if I add swap, it would not help the scanner, right ?


Correct.

--
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. >
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:11 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com