1833378 Members
3196 Online
110052 Solutions
New Discussion

Swap types

 
SOLVED
Go to solution
Marco A.
Esteemed Contributor

Swap types

Hello Gurus!!

Just a simple question for you..!

Can I use Pri Swap, Sec Swap and PseudoSwap at the same time ?!

Regards,

Marc'o
Just unplug and plug in again ....
10 REPLIES 10
Sandman!
Honored Contributor
Solution

Re: Swap types

yes
James R. Ferguson
Acclaimed Contributor

Re: Swap types

Hi:

Absolutely.

Primary swap is required and is built during a cold-installation in 'lvol2'. It is automatically enabled at startup and is *not* activated in '/etc/fstab'.

Secondary swap is best simply additional swap space. usually built as "device" (as opposed to filesystem) swap; and activated in '/etc/fstab'. To remove it you must reboot having removed the entry form 'fstab' first.

I prefer to place seconday device swap on a volume group other than vg00 with a numericaly lower priority than primary swap so that it is used preferentially. At the least, don't put multiple swap devices on the same physical disk with equal priority. Should you ever actually do I/O you don't want disk heads moving all about as swap is interleaved between the equal priority devices.

Pseudoswap is enabled by setting the 'swapmem_pin' kernel parameter to one (1). Its a kernel accounting trick for large memory systems that allows three-quarters of real memory to be counted a swap space for the purposes of process swap reservation. Remember, when a process is started by the kernel, enough swap space must be reservable to hold the process should it ever need to be paged (swapped).

Regards!

...JRF...
Marco A.
Esteemed Contributor

Re: Swap types

hmm .., what happens if I reach the max capacity of my pseudo-swap .? ...I'll start to use the normal swap ? ...

Regards,

Marco
Just unplug and plug in again ....
A. Clay Stephenson
Acclaimed Contributor

Re: Swap types

You don't use pseudoswap at all because it isn't swap.

All true swap set at equal priorty will be used at (almost) the same time. The priority for primary swap is fixed at one. If you add additional swap devices and assign them priority 1 then the swap will be interleaved among all the devices. If the swap areas reside on the same physical disk then you do not want to assign them identical priorities because the head will be moving like crazy during heavy swapping. In that case, you would assign additional (secondary) swap a priority of perhaps 2. This would mean that all priority 1 swap would be used before any priority 2 swap would be used.

You seem to be confused about pseudoswap. This is a kernel math trick that lets 75% of your physical memory count as process reservation space. Let's pretend that you have a box with 32GiB of RAM and 8GiB of actual swap space. With swapmem_on=0, you could only run 8GiB's of processes eventhough you have 24GiB's free. When swapmem_on is set to 1, you can count 0.75 X 32GiB RAM + 8GiB Device Swap = 32GiB as process reservation space and use your entire 32GiB space. Pseudoswap is a way of telling the kernel that you don't have enough swap space but that you don't need it because you are never going to swap. Again, it serves no purpose for boxes that have more swap than RAM; the box actually runs a bit safer in that case with swapmem_on=0.
If it ain't broke, I can fix that.
Sandman!
Honored Contributor

Re: Swap types

Pseudo-swap is not used the same way as device swap aka primary swap is. Processes reserve space in pseudo-swap when they startup and this space is not released until the process quits. So if the systems swaps only device swap is used.

~hope it helps
Marco A.
Esteemed Contributor

Re: Swap types

Hello Guys!!!..

Clay..! I don't seem to be confused about it!!

I'M TRULY confused about it ...!

I was asking those questions because I see at glance ...that swap dev usage is 0 !!, then I'm confused about it because I think that my system is not swapping..! but pseudo-swap is shown as 90% usage ...!, is that information correct? or my system is really swapping and I'm not seeing that?

Regards,

Marco
Just unplug and plug in again ....
James R. Ferguson
Acclaimed Contributor

Re: Swap types

Hi (again) Marco:

Perhaps this Technical Knowledge Base document will help you:

https://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en&docId=emr_na-c00905083-2

( document ID = emr_na-c00905083-2 )

Regards!

...JRF...
Pete Randall
Outstanding Contributor

Re: Swap types

Having swap usage of 0% is a good thing. In this case, all your swap reservation is taking place in pseudo-swap space. Whenever a program is loaded, HP-UX reserves swap space for it, "just in case". Normally this would take place on device swap, but, with pseudo-swap enabled (and sufficient memory), it can be reserved without ever touching the device swap.


Pete

Pete
Bill Hassell
Honored Contributor

Re: Swap types

> that swap dev usage is 0 !!, then I'm confused about it because I think that my system is not swapping..! but pseudo-swap is shown as 90% usage ...

Pseudo-swap is not "used" in the way that disk swap is used. It simply means that up to 75% of the process space is given a free ride as far as swap reservation. Reserve does not mean usage, it's just a reservation. Once all your processes use up the reservation space, then real swap space will be reserved (but not used yet). Once all your free memory is used up, low priority programs (such as those that are waiting for keyboard input or are sleeping) will be deactivated and the swap daemon will begin to move portions (pages) of these programs to disk swap.

Your system is swapping (using real swap space) only when vmstat shows the "po" column non-zero. Ignore single digits (0-9). If po runs more than 20-50 for a long time, you are short on RAM and will need more to speed things up.

Note that swap space may also have a small amount of space used by memory-mapped files and that is normal.


Bill Hassell, sysadmin
Marco A.
Esteemed Contributor

Re: Swap types

Thank you guys!!! now I understand what is this weird thing! ...

Thank you very much !!..

Marco
Just unplug and plug in again ....