1827212 Members
2295 Online
109716 Solutions
New Discussion

swapinfo

 
Simon Hargrave
Honored Contributor

swapinfo

Hi, I'm used to using swapinfo -t to get an idea of how much total "virtual memory" is being used on our systems. However recently OpenView has been telling me we've exceeded 90% swap usage. Looking at the monitor script it gets the total %age using swapinfo -dftr, which appears not to take into account the pseudo-swap.

Why is this?

For example on our system currently: -

gfeps3:/# swapinfo -t
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4194304 760024 3434280 18% 0 - 1 /dev/vg00/lvol2
reserve - 2707168 -2707168
memory 3224800 1755672 1469128 54%
total 7419104 5222864 2196240 70% - 0 -
gfeps3:/# swapinfo -dftr
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4194304 760024 3434280 18% 0 - 1 /dev/vg00/lvol2
reserve - 2705420 -2705420
total 4194304 3465444 728860 83% - 0 -

According to swapinfo -t we're using 70% of the total memory capacity of the system (real + swap) whereas the second (which openview monitors) is 83%!

Cheers, Sy
12 REPLIES 12
Patrick Wallek
Honored Contributor

Re: swapinfo

What I would be more concerned with at the moment is the fact that you are actually swapping. You've got 18% (760 MB) of device swap being used. That ain't good!

I would seriously look at adding more memory to this machine. Your performance can't be very good as things stand right now.

(I know this doesn't answer your question, but I'd look at the bigger problem first)
Steven E. Protter
Exalted Contributor

Re: swapinfo

The secnd command is exluding some memory from its caclulatoins, apparently physical memory.

man swapinfo to check the impact of the additional command line options.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Patrick Wallek
Honored Contributor

Re: swapinfo

To answer your primary question:

swapinfo -d shows 'device' info only. So it will not show you pseudo-swap.

If you do it without the '-d' option it will show everything. Check 'man swapinfo' for more details.

Can you modify your OV script that monitors swap so it does not use the '-d' option?
Steve Steel
Honored Contributor

Re: swapinfo

Hi


Indeed you need memory but for your question
you need to use -dftrM.


The M adds the memory or it is not added.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
S.K. Chan
Honored Contributor

Re: swapinfo

There are patches to fix incorrect output from swapinfo command. This is one of them..
For 11.0
PHCO_22676 s700_800 11.00 swapinfo(1M) patch
Symptoms PHCO_22676
1. swapinfo displays incorrect output for swap > 2GB.
2. swapinfo displays incorrect totals.
3. swapinfo displays incorrect file system type.
This may be your case here. Search the patch db (keyword = swapinfo) for other version of OS to find out if they is such patch.

Simon Hargrave
Honored Contributor

Re: swapinfo

Performance itself isn't really an issue at the moment. Although there's swapped out memory, there isn't a high paging rate (pageouts is 0 most of the time from vmstat). The swapped out processes must be rarely used.

Besides I've never worked at a company that's let me spend enough money on memory to have 0% swap usage, in my experience it just doesn't happen in reality!
Simon Hargrave
Honored Contributor

Re: swapinfo

: Can you modify your OV script that monitors swap
: so it does not use the '-d' option?

That's easily done, however my concern was that this is the default monitor supplied by HP, so there must be a reason?
Simon Hargrave
Honored Contributor

Re: swapinfo

: PHCO_22676 s700_800 11.00 swapinfo(1M) patch

Thanks, but this patch is already installed. I don't think the problem is with swapinfo itself, but in the way the monitor uses the command (for whatever reason).
Donald Kok
Respected Contributor

Re: swapinfo

Hi Sy,

Why is pseudo-swap not counted? pseudoswap does not exist! It is only a number which prevents your system from having to have loads of diskspace for swap.

Suppose you have 8Gb of physical memory, Every loaded page must have some swapspace. So you need at least 8Gb of swapspace which you probably never use, because you bought all this memory.
To prevent this HP invented pseudo swap, 75% of memory is counted extra as (pseudo)swapspace.

Greetzz
Donald
My systems are 100% Murphy Compliant. Guaranteed!!!
Simon Hargrave
Honored Contributor

Re: swapinfo

: Why is pseudo-swap not counted? pseudoswap does not exist!
: It is only a number which prevents your system from having to have loads of diskspace for swap.

Yes, but the whole point of doing swapinfo -t is to see how much total "virtual memory" is available, this including RAM, plus physical swap.

The memory column is the pseudo-swap, but has to be counted because this represents also the RAM that can be used (well IIRC it's actually 75% of real ram, taking into account kernel and buffer cache memory which will never be swapped).

If you don't count this, then you're ONLY counting the memory used in physical swap, and not in memory too.
Michael Steele_2
Honored Contributor

Re: swapinfo

Use 'swapinfo -tam' and note the last line 'total USED'. Fifth arguement over.

'85%' is the usual ceiling used for deciding when to add more swap. You're indicating 83% used in the second display.

I would add more.

a) lvcreate -L 1024 -n swap -C y -r n /dev/vg##

NOTE1: 1024 mb
NOTE2: -C = contiguous.
NOTE3: -r = no bad block relo.

b) swapon -f -p 1 /dev/vg##/swap

c) /etc/fstab
.
.
/dev/vg##/swap ... swap pri=1 0 1

NOTE1: ALWAYS USE PRIORITY = 1!!!!
NOTE2: All swap should be priority = 1 except /dev/vg00/lvol2, ignore this.

If error on b) complains about 'maxswapchunks' then you'll need to adjust this kernel parameter and reboot. No other way around it. Otherwise, no reboot is required with 'swapon'.

To reset 'maxswapchuncks' use this procedure:

sysdef | grep -i maxswapchuncks

sysdef | grep -i swchunk

maxswapchuncsks = total swap / 1024 * swchunk

Launch SAM and adjust, or, use kmtune.

Respond if you need the kmtune procedure.
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: swapinfo

Hmmm...

Quite a few opinions and views here. I'm not sure if I want to step into it.

Oh well.

Pseudo swap. Reserved by system as 3/4 swap space for applications usage. Its used first, before device. So its an incorporation of system swap which is automatically set aside.

Pseudo swap is also a performance enhancer. By automatically reserving swap for applications, before applications call for it, performance is enhanced.

It's much faster to reserve
space within memory. But, on heavily used
systems you will see even device swap being
used.

So use of device swap is dependent upon your use of pseudo swap, and although the default shipped by HP is sometimes turned off, depending upon the application. See 'swapmem_on = 1' kernel parameter.

Don't worry about using device swap. Its normal.
Support Fatherhood - Stop Family Law