1834598 Members
4022 Online
110069 Solutions
New Discussion

RAM and Swap

 
SOLVED
Go to solution
Pippo_9
Frequent Advisor

RAM and Swap

Hi everybody.

The is system HP-UX 11.11. I currently have 2GB Ram and 2GB swap. I need to add more RAM up to 4GB but I cannot resize Swap as well.

What are the potential problem in that? Is it possible (even if it is not recommended) to keep swap 1/2Ram worth?

Thanks in advance for your replies.

Pedro
6 REPLIES 6
Stefan Farrelly
Honored Contributor

Re: RAM and Swap

For performance you should really keep swap to at least the same size as RAM (ie. upgrade your RAM to 4GB, upgrade swap to 4GB also). But you dont have to increase the size of primary swap (its hard to do anyway), just add in a new secondary swap area of 2GB (so you now have 2 swap areas each of 2GB). This is the normal procedure for a RAM upgrade.
Im from Palmerston North, New Zealand, but somehow ended up in London...
T G Manikandan
Honored Contributor
Solution

Re: RAM and Swap

It depends upon your usage.

If swap is not utilized not utilization is less after the memory upgrade then there is no need to increase the swap space.

check the usage of memory and swap after the RAM upgrade.

There is nothing like the swap should be some percentage of the memory.

There is a concept as pseudo swap in hpux which can make use of the memory space as swap with less swap defined on systems.But this would be for system with huge amount of memory.

Check for the usage of memory and swap after upgrade and then you are add additional swap.

Mark Grant
Honored Contributor

Re: RAM and Swap

It might be worth pointing out that HPUX pre-allocates swap too. With this in mind, having more memory than swap can mean that you can actually run out of swap when you haven't run out of memory. In this case, you won't be able to start any new applications even with GB's of RAM left.
Never preceed any demonstration with anything more predictive than "watch this"
Bernhard Mueller
Honored Contributor

Re: RAM and Swap

Pedro,

if you have the kernel parameter swapmem_on set to 1 (default) you will be able to use 4GB RAM even if you have only 2GB Swap.

check with:
kmtune -q swapmem_on

check if you have space to add swap:
vgdisplay vg00 (or other vgs)

to add an additional swap volume of 2GB on mirrored disks with vg00 as the root VG use:
lvcreate -L 2048 -m 1 -r n -C y -n lv_swap vg00

then add a line to /etc/fstab like
/dev/vg00/lv_swap swap swap 0 0

then enter
swapon -a

verify with
swapinfo -mt

Regards,
Bernhard
doug mielke
Respected Contributor

Re: RAM and Swap

I thought swapmem_on default was 0, (at least on 11.0)

As described above, to make use of all of your new memeory, you'll need to set that to 1. HP/Ux aloocates swap when it starts a process, so if swap is less than ram, you'll get the out of memory errors once you hit the limit of swap, regardless of ram size. Setting swapmem_on to 1 disables that feature.

Most of our systems are loaded up with RAM (we cant tolorate the performance hit if we start swaping to disk). Thus, our systems have less swap space than RAM.
James Lynch
Valued Contributor

Re: RAM and Swap

Pedro,

Pseudo Swap (otherwise knows as swapmem) was introuduced in HP-UX 9.04. Pseudo Swap gives the OS the ability to run new programs by reserving their swap allocation upon invocation, this resevartion is performed using real memory instead of using swap. What this means, is, that you no longer have to have swap equal or larger than total physical memory. By default the tunable parameter that contols this behavior, swapmem_on, is set to 1.

In HP-UX 11.0 and new feature was added called Lazy Swap. Instead of me trying to explain lazy swap in my own words, let me quote the release notes:

BEGIN QUOTE

Lazy Swap Reservation
Run time environments in which multiple processes map large private data
regions into their address spaces will put an exorbitant demand on a
system's swap resources. It can be demonstrated that in such environ-
ments the swap pool becomes inefficiently utilized.

The Lazy Swap Reservation (SWLZY) feature means that a swap reservation
for a process-private page is deferred until the process actually
attempts to modify the page (i.e. copy-on-write is broken). Essentially,
for Lazy Swap private regions, swap resources are used only for dirtied
private pages (which really require swap backing-store in the event of a
possible page-out).

Programming Impact
------------------------------------------------------------------------

Although a SWLZY process more efficiently utilizes swap resources by not
reserving swap for all private pages at either exec(2) or fork(2) time,a
process may receive an unexpected SIGBUS signal at run time as a result of a failed attempt at making a swap reservation. Consequently, a
discerning program must be written to handle the SIGBUS signal and
invoke appropriate recovery steps. These steps may include a
limited retry, a check-pointing of any significant or volatile data,
or simply exiting.

END QUOTE

This behavior can be controled on an individual proccess level by setting the '+z' flag with the chatr command.

JL
Wild turkey surprise? I love wild turkey surprise!