1753808 Members
8188 Online
108805 Solutions
New Discussion юеВ

Increasing SWAP

 
SOLVED
Go to solution
Barry_10
Occasional Contributor

Increasing SWAP

Hi There,

Were running an IA64 on HPUX B.11.22 and I need to increase my swap file as I've seen it grow to 98% full. How can I do this and still have the swap file contiguious.

Thanks.
"Can you whiteboard that for me please"
18 REPLIES 18
Patrick Wallek
Honored Contributor

Re: Increasing SWAP

There is no easy way to increase you primary swap and have it remain contiguous.

The better way would be to create another LV to use as swap space.

However, if you are using that much swap then you really need to add more RAM instead of adding more swap. If you truly are paging out, then I'm your machine is performing rather poorly.

If you could attach your 'swapinfo -tam' output so we can verify you usage that would be great.
Jeff Schussele
Honored Contributor

Re: Increasing SWAP

Hi Barry,

Basically you can't extend the current swap. You'll never be able to keep it contiguous.
But what you CAN do is add secondary swap on another disk device & that'll work just fine.
You'll need to check your maxswapchunks kernel parm - it'll probably have to be increased to accomodate the extra swap. This will require a reboot.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Brian Markus
Valued Contributor

Re: Increasing SWAP

Have you considered adding secondary swap?

Here is how if you want to:

Adding secondary swap:

USING LVM:

1.) pvcreate /dev/rdsk/cXtXdX (The disk that will be used for swap)

2.) vgcreate /dev/vgXX /dev/dsk/cXtXdX (Creating a volume group)
or vgextend /dev/vg00 /dev/dsk/cXtXdX (to add the disk)

3.) lvcreate -L (size in mb) -C y -r n /dev/vgXX (Creating a logical
volume for swap)

4.) edit the fstab file ..ie /dev/vgXX/lvolX ... swap pri=1 0

5.) swapon -a

6.) swapinfo -tam (should show new swap)

To remove swap

1.) edit the fstab file -> remove the swap line

2.) reboot the system

If you want this new swap to be dump as well, it must be in vg00 and then
run the command lvlnboot -d /dev/vg00/lvolX

To check it -> lvlnboot -v

USING WHOLE DISK PARTITION:

1.) edit the fstab file ..ie /dev/dsk/cXtXdX ... swap pri=1 0

2.) swapon -a

3.) swapinfo -tam (should show new swap)



Hope this helps

-Brian.
When a sys-admin say's maybe, they don't mean 'yes'!
Brian Bergstrand
Honored Contributor

Re: Increasing SWAP

If your swap is really 98% full, then you need more memory ASAP. That being said, you can't extend your primary swap (as you've said, it has to be contiguous), but you can add swap from another disk.

Just create a new swap partition and activate it, easiest way to do this is with SAM -> Disks and Filesystems -> Swap.

HTH.
Barry_10
Occasional Contributor

Re: Increasing SWAP

Thanks for the prompt reply:

Here is my 'swapinfo -tam'

Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 1226 2870 30% 0 - 1 /dev/vg00/lvol2
reserve - 2310 -2310
memory 1463 448 1015 31%
total 5559 3984 1575 72% - 0 -


Right now it's at about 30% but I've seen it increase to as high 98%, unfortunatley I can't recall what was happening at that time to increase swap to that point.


"Can you whiteboard that for me please"
Patrick Wallek
Honored Contributor

Re: Increasing SWAP

OK, you definitely are swapping. I would *SERIOUSLY CONSIDER* adding more RAM. Since you have 4GB of swap space, and you say you see it go up to 98%, I would consider adding at least 4GB of RAM, ideally I would add maybe 6GB to try to give a bit of breathing room.

You, and your users, will probably see a performance increase when you do, since you won't swapping anymore.

Barry_10
Occasional Contributor

Re: Increasing SWAP

Okay I'm a little unclear on how adding memory is going to help. Since if I add memory I have to add swap space anyways to match the memory size, is that correct?

Barry
"Can you whiteboard that for me please"
Steven E. Protter
Exalted Contributor
Solution

Re: Increasing SWAP

Adding a secondary, lower priority(higher number on swapinfo) swap area will alleviate peformance problems related to inadequate swap space.

The general strategy now is the A. Clay Stephenson plan which involes a smaller primary swap and a larger secondary that only gets used when loads get high.

As Patrick notes, swap is no substitute for adequate memory. If you need to increase swap beyond twice memory, performance will suffer and thats a good indicator its time to get your hands on some RAM.

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: Increasing SWAP

Processes are being paged-out to your swap area because you have no free memory to allow other processes to run. Ideally you should never see your %used on your swap rise above 0%.

If you add memory, that will give you more room for processes to run, without other processes having to be paged-out to disk first, thus making things run a whole lot faster.

Now, if you add more memory, you don't necessarily need to add more swap space. If you set the kernel parameter swapmem_on to 1 then HP-UX will use 75% of your RAM as pseudo-swap, thus allowing processes to run and reserve their little piece of swap space without actually having to have a 1:1 ratio of available swap to RAM. Having swapmem_on set to 1 will not impact the amount of RAM you have available for processes.