Operating System - HP-UX
1834150 Members
2103 Online
110064 Solutions
New Discussion

Confusion abot memory and swap space

 
TMcB
Super Advisor

Confusion abot memory and swap space

Hi

I have a HP 9000 server running 10.20.
I am somewhat confused by the memory/swap info.

SAM shows the following :
Physical Memory: 320.3 MB
Swap Space: Avail: 256 MB
Used: 234 MB

But if I run swapinfo :
Mb Mb Mb PCT
TYPE AVAIL USED FREE USED
dev 128 0 128 0%
dev 128 15 113 12%
reserve - 220 -220
memory 231 185 46 80%
total 487 420 67 86%


If the system has 320MB RAM, why is this not being displayed with swapinfo? Also, why does swapinfo only indicate that 12% of swap space is used when SAM shows otherwise?

The reason I ask this is that last week the system ground to a halt saying:
insufficient swap or memory available, and I am trying to work out if the swap space need to be increased?
9 REPLIES 9
Stefan Farrelly
Honored Contributor

Re: Confusion abot memory and swap space


The swapinfo command does NOT show how much memory you have installed. The memory line from the swapinfo command is displayed if you have memory configured to be used as swap (in case you dont have enough device swap).

So, from your swapinfo command you have;
2x 128MB device swap areas (256 MB total)
Memory swap is switched on - should it be necessary.

You have some device swap used (12% on one of the 128 MB areas) which means you are OUT of physical memory and paging is ocurring.

And yes - you should have device swap set to physical memory size as a minimum. Youre wasting memory using some of it as swap instead of using device swap. I would add another 64 MB of device swap asap. This should releive some of your memory pressure.
Im from Palmerston North, New Zealand, but somehow ended up in London...
TMcB
Super Advisor

Re: Confusion abot memory and swap space

Thanks for the reply

I have plenty of disk space to increase the device swap.

I just wanted to check - if memory swap is enabled as well as device swap - will it use the memory swap first?

Should I expect to see the memory swap so high?

Thanks
Tim D Fulford
Honored Contributor

Re: Confusion abot memory and swap space

1 - do swapinfo -mt, this should match up with glance

2 - memory swap (psudo-swap) will be used if the kernel parameter swapmem_on = 1
Tim
-
Stefan Farrelly
Honored Contributor

Re: Confusion abot memory and swap space

Memory swap is used after device swap - its basically a safety net so its fine to leave it on. We leave it on all our servers.

The memory line from swapinfo firstly shows in the available column how memory could be used for swapping if needed, the used column shows how much is already used by programs which are locked into memory (shared memory for databases or other apps etc.) which basically means you cant use it (only unlockable memory can be used for memory swap) so even though the memory line shows 80% used this is nothing for you to worry about - it just shows your server is under memory pressure. Adding another device swap area will reduce it.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Brian Watkins
Frequent Advisor

Re: Confusion abot memory and swap space

A little rule of thumb for configuring swap that's always worked well for me:

swapspace = 1.5 * phys.memory

MANOJ SRIVASTAVA
Honored Contributor

Re: Confusion abot memory and swap space

Hi Terry


Also there is small c program that you can run to get teh o/p in the following format if you want :.



Memory Stat total used avail %used
physical 32764.0 10640.1 22123.9 32%
active virtual 1784.9 245.5 1539.4 14%
active real 1963.9 267.1 1696.7 14%
memory swap 26522.5 5508.9 21013.6 21%
device swap 3332.0 3332.0 0.0 100%


I have attached the program all you ahve to do is to recomiple it and run it .


Manoj Srivastava
TMcB
Super Advisor

Re: Confusion abot memory and swap space

Thanks everyone for the replies so far.

I have added another "device swap".

swapinfo is now showing :

TYPE AVAIL USED FREE USED
dev 128 0 128 0%
dev 128 0 128 0%
dev 400 0 400 0%
reserve - 216 -216
memory 231 135 96 58%

None of the 3 device swap areas are being used, yet the memory swap is.
Should this be the other way round ?
Sridhar Bhaskarla
Honored Contributor

Re: Confusion abot memory and swap space

Terry,

You see some used value in memory portion of your swapinfo - doesn't mean that the memory is being used.

Whenever a process comes up, the system reserves a portion of swap called "reserve" for it so that there will be enough space in the swap to allow page outs in case needed.

If you enable swapmem_on parameter (by default), a 3/4th of memory can be seen as swap area (pseudo swap) so that the reserve space can be more than the swap on the physical storage.

It is to be realized that the pseudo swap locks the pages. So, the amount of lockable memory may decrease affecting the application.

So, this kernel parameter is not really useful for systems with low memory. It is better to add extra swap from the devices.

I suggest you disable this kernel parameter and add more swap from the devices. Also make sure to keep track of total row in swapinto -t not to go beyond 90% in the user column.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Frank Slootweg
Honored Contributor

Re: Confusion abot memory and swap space

> None of the 3 device swap areas are being used, yet the memory swap is.
> Should this be the other way round ?

No, it first uses the 'memory swap' (*pseudo* swap, "memory" line), i.e. no *real* swapping occurs, also not *within* memory. Only when memory can no longer hold all the processes/data, *real* 'swapping' (actually paging) will occur and the USED field of the "dev" lines will be non-zero.

Bottom line is to use "-t" (as you used in earlier examples) and *only/mainly* look at the "total" line of "swapinfo -t". As you have found, correctly interpreting the other lines is not simple and often leads to incorrect conclusions (both (overly) negative and (overly) positive).