Operating System - HP-UX
1834149 Members
2807 Online
110064 Solutions
New Discussion

Re: SWAP : Question again !!

 
Q4you
Regular Advisor

SWAP : Question again !!

I have 2 x 15K rpm 36 G drives on a same controller on a system with 4G of Physical memory. I wish to configure 8G of swap on disk1 and 12G swap on disk2, to make total device swap of 20G.

1. What is the best way to configure both swap spaces ( they will mirrored on a diff set of disk on a diff controller) ?

say lvol2 and lv_swap1 as lv names. disk1 has all root volumes. disk2 is relatively free.

2. What priority should I assign and how.

3. Does interleaving of swap require both swaps to be on same size and at same priority ?

TIA
- Q
9 REPLIES 9
RAC_1
Honored Contributor

Re: SWAP : Question again !!

1. What is the best way to configure both swap spaces ( they will mirrored on a diff set of disk on a diff controller) ?
---->
Create two lvols, second one beinf the secondary swap. Seconday will have entry in /etc/fstab.

assigning same priority
say lvol2 and lv_swap1 as lv names. disk1 has all root volumes. disk2 is relatively free.
---->
assigining same priority will give you better performance. But note that the remaining space on disk2 will be wasted.

2. What priority should I assign and how.
---->
Assign 0 to both, so that they are used simultanously.
for seconday swap put followinf entry in /etc/fstab

/dev/vg00/lv_swap1 ... swap defaults 0 0
3. Does interleaving of swap require both swaps to be on same size and at same priority ?
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor

Re: SWAP : Question again !!

Well, you aren't going to like my answer but the real answer is it hardly matters. If you really need a system with 4x swap space then there is no point at all talking about optimum layout or performance because your performance is going to be almost nonexistant.

Nevertheless, here goes. If this were me, I would 1) use 512MB primary swap on disk1 - we aren't really going to use it. Now make another 7.5GB LVOL on disk1 and your 12GB LVOL on disk2. Assign each of these two swap priority 0 - swapping will interleave between these two until the disk1 LVOL is full and then the remainder will be written to the disk2 LVOL. Finally, primary swap (at priority 1) will be used.

The reason I do it like this (and make primary swap small) is so that when you finally come to your senses and increase memory and reduce swap, the extra swap space can be easily recovered.

A much smarter layout would use disk2 to mirror.

Food for thought, Clay
If it ain't broke, I can fix that.
RAC_1
Honored Contributor

Re: SWAP : Question again !!

for A Clay.

Really a food for thought.

I have lot of things to learn from these big guys.

I love this forum.
There is no substitute to HARDWORK
T G Manikandan
Honored Contributor

Re: SWAP : Question again !!

First I would like to ask is why you need to create a swap size of 20GB.
If your memory utilization is too much the best way is to increase the memory on teh system?
Even the best advice is to have 1 or 1.5 times the amount of RAM for swap and not more than that!!
Are you going to mirror both the hard disks?
The first hard disk contains all the root volumes.
say lvol2 contains the primary swap volume,
then there is no need to mirror the second disk.

Because if you are mirroring the disks then you are also mirroring the 20GB swap which is off waste.
I would suggest to have a primary swap(less) or around 2GB is size on the root disk which is mirrored and place the secondary swap(bigger in size) in a different hard disk.

When you create the primary swap on the root disk it is assigned a default priority of 1.

So when you create the secondary swap make sure that you assign the same priority so that interleaving can happen.

Revert
Sridhar Bhaskarla
Honored Contributor

Re: SWAP : Question again !!

Hi,

If disk1 has all root volumes, if at all the system swaps, I wouldn't touch it at all.

But if it is inevitable, this is how I configure.

1. Create 1GB of swap on disk1 and make it as primaryswap. Create another swap vol (swap1) with 7 on disk1. Keep the priorty 1.
2. Create 12GB of swap (swap2) on disk2 and add it as secondary swap. Set the priority to 0.

When you swap only disk2 will be accessed. When the swap2 is completely utilized, you will start interleaving on disk1 and that will degrade your performance as expected due to interleaving btw primary swap and swap1.

On the other hand, you have 4 GB of memory and if you swapped 12GB means your system would already be thrashing. So, it does not matter much later with interleaving on disk1 as you would be in a panicky situation already. But if you make the priority of swap1 and swap2 to 0, then the system will start interleaving as soon as swapping occurs. So you will experience unnecessary degradation as it will hit the root disk.

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

Re: SWAP : Question again !!

Hi (again),

Just wanted to warn you on interleaving...

Bottom line is that you don't want root disk to be touched for swapping. It will make the spindle to go crazy as it has to do normal work as well the swapping work that can exponentially degrade the performance.

Interleaving is good if you have two external disks and have a swap area on each. Do not ever interleave a swap area on an external disk with the one on the root disk.

Having a large amount of swap may give you more virtual memory. However, keep an eye on swapping and you should consider increasing the physical memory once the utilization on swap2 reaches 80% (~10GB).

BTW, memory is affordable.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: SWAP : Question again !!

I'm with Clay on this one folks.

Here is what's going to happen if you ever run enough applications to actually use 20G of swap on disk.

Your machine will have ground to an absolute halt and you won't get any meaningful work done.

Up to 16 G of physical memory the rule of thumb is twice physical memory in swap.

I'd like to see details on why primary swap should only be 512 Meg, but if you follow through with your plans, your box will process like this.


V e r y S l o w

P
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
Q4you
Regular Advisor

Re: SWAP : Question again !!

Thanks to all of you for your reply..

Actually, I agree that there is no need of creating such a large swap space. Since we have 36G x 4 drives on 2 internal UltraLVD controllers reserved only for vg00, we have been asked to provide 20G swap so that we do not to look at this again. What else we do with 72G of mirrored vg00 ?? :) I do not expect swap to be utilized even 20 %.

This is what I have done ->

12G on disk2, with Priority 0.
8G on disk1, with Priority 1.Since we have mirroring, any IO to disks will be balanced ?

Steven E. Protter
Exalted Contributor

Re: SWAP : Question again !!

What a waist of disk space and a fast processor.

Too much swap.

Make them smaller if you want your system to perform faster than a D class box.

Mirroring doesn't really help with load balancing. The updates eventually have to go down both channels.

Listen to A. Clay. He knows what he's doing.

P
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