1834552 Members
3638 Online
110069 Solutions
New Discussion

Device swap priority

 
SOLVED
Go to solution
HPUX SysAdm
Frequent Advisor

Device swap priority

I need to add device swap to my system. Primary swap is on /dev/vg00/lvol2. The new (secondary) device swap will be on /dev/vg01/lvol1.

My question is about priority. Can I set the priority of the secondary swap device (/dev/vg01/lvol1) the same as the primary swap device (/dev/vg00/lvol2)??
17 REPLIES 17
SoorajCleris
Honored Contributor

Re: Device swap priority

Hi,

The same priority help you to improve the performance by enabling interleaving.

If the same priority is given it is recommended to have same size and same speed of the disk and ofcourse in different disk which give you better performance with swap interleaving.

Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Patrick Wallek
Honored Contributor

Re: Device swap priority

>>The same priority help you to improve the performance by enabling interleaving.

While this is true, it is also some irrelevant.

To paraphrase Clay Stephenson.....Worrying about swap priority is like rearranging the deck chairs on the Titanic.

IF you actually start paging out to any significant extent your performance will be so bad that whether your swap devices are interleaved or not will be irrelevant.
Patrick Wallek
Honored Contributor

Re: Device swap priority

---While this is true, it is also some irrelevant.

"some" should be "somewhat" in that sentence above.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Device swap priority

Hi:

> Can I set the priority of the secondary swap device (/dev/vg01/lvol1) the same as the primary swap device (/dev/vg00/lvol2)??

You can set it equal, larger in value (a lower priority) or smaller (a higher priority).

If you put the secondary swap space on vg00, then I would set its priority to a different value than that of the primary. If you ever do I/O then you don't want disk head movement as interleaving occurs between equally prioritized devices.

If you put the secondary swap space on a volume other than vg00, I prefer to make it a lower priority (and therefore preferentially used) device. I like to keep vg00 I/O to a minimum.

In all cases, you want to have sufficient physical memory and appropriate workloads so that you never swap. Of course, you will see swap utilization for process reservation, but you don't want to actually do I/O. You can monitor swapping (paging) with 'vmstat'. Look at the 'page-out or 'po' column as your indicator. Values in the double-digits indicate worsening degradation.

Regards!

...JRF...
HPUX SysAdm
Frequent Advisor

Re: Device swap priority

@Patrick:

The main purpose of adding a swap device is to make swap size same as physical memory installed on the box. Total RAM is 8Gb while primary swap is 4Gb. So I was thinking of adding another swap device so that more processes can be started up.

This fact comes from HP's techdoc I read a while back about how the kernel reserves memory for programs before running them. That's why sometimes when I try to start a process like glance it tells me that it "can't allocate sufficient memory" and other times it is just fine.

I agree with the fact that adding swap is like re-arranging chairs on the Titanic because pageouts in never a good thing and indicates memory pressure. But in my case there is no pageout activity though swap utilization is ~95%. I also have pseudo-swap turned on and even its utilization at the time was ~95%.

Is my understanding correct or I am totally wrong? Please help.
Tim Nelson
Honored Contributor

Re: Device swap priority

Your understanding is good.

Set your new swap to the same priority.

The priority is mute if the system never deactivates/pages anything.

Patrick Wallek
Honored Contributor

Re: Device swap priority

>>The main purpose of adding a swap device
>>is to make swap size same as physical
>>memory installed on the box. Total RAM is
>>8Gb while primary swap is 4Gb. So I was
>>thinking of adding another swap device so
>>that more processes can be started up.


>>I try to start a process like glance it
>>tells me that it "can't allocate
>>sufficient memory" and other times it is
>>just fine.

Exactly! That makes perfect sense.

>>Is my understanding correct or I am
>>totally wrong? Please help.

Your understanding is perfectly accurate and your actions make sense.

I based my answer above on the information given in your initial question, where you did not mention your inability to start processes or the reason you were looking to add swap. All you asked about was swap priority.
HPUX SysAdm
Frequent Advisor

Re: Device swap priority

@Tim Nelson:

Feels good to know that HP's techdoc made sense to me because most of the time I feel lost with all that heavy duty technical stuff.

@Patrick: Sorry I wasn't clear about the root cause of the high swap utilization.

I still have some small doubts. If there are no pageouts going on why is swap utilization so high at times while at other times it is so low? Is it because of too many runnable processes?

I looked at the system a few minutes ago and it seemed pretty calm i.e. primary swap was at ~10% while pseudo-swap (memory) was at ~20%.
Patrick Wallek
Honored Contributor

Re: Device swap priority

>>If there are no pageouts going on why is
>>swap utilization so high at times while at
>>other times it is so low? Is it because of
>>too many runnable processes?

I think you are confusing swap "utilization" with swap "allocation". As long as your device swap lines show 0% used, then you are not using swap.

However, processes are ALWAYS allocating swap "just in case." If you are looking at the reserve and memory lines of 'swapinfo -tam' then you are seeing what has been allocated for use by processes. This does NOT indicate how much has actually been used. It indicates how much "could be" used.

If you post your 'swapinfo -tam' output we may be able to alleviate some of your fears and clear up any doubts you have.
Patrick Wallek
Honored Contributor

Re: Device swap priority

Thinking after I posted....Perhaps in the post above, substituting the word "reservation" where I used "allocation" would be more accurate.
Tim Nelson
Honored Contributor

Re: Device swap priority

Where are you getting the swap util from ?

swapinfo ?

glance ?

the allocaton of swapspace will rise as memory utilization rises.. until you start seeing deactivations or used% depending on your tool..

With 8GB of physical ram I would at a minimum configure 8GB of disk swap, maybe 10GB. This allows you to use all 8GB of physical ram.
Tim Nelson
Honored Contributor

Re: Device swap priority

please substitute "allocation" with "reservation" in my responses as well..
HPUX SysAdm
Frequent Advisor

Re: Device swap priority

@Patrick:

I was looking at the output of glance and swapinfo. The problem has gone away for now and the system is pretty calm. I wasnt looking at the swapinfo "reserve" line because I learnt not to from these forums. Here is the current swapinfo snapshot.

# swapinfo -mat
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 276 3820 7% (~95% w/ problems) 0 - 1 /dev/vg00/lvol2
reserve - 3813 -3813
memory 4786 2046 2740 43% (~93% w/ problems)
total 8882 6135 2747 69% - 0 -
HPUX SysAdm
Frequent Advisor

Re: Device swap priority

@Tim:

From your and Patrick's post I take it that there are subtleties in how swap space is viewed ie "reservation" as opposed to "allocation".

As there wasn't any pageout activity it can be said that swap space was only being "reserved" but not "allocated" for the actual movement of pages out of RAM due to memory pressure. Is that feasible to say?
Tim Nelson
Honored Contributor

Re: Device swap priority

This doc can do much better than I at an explanation...

http://www.docs.hp.com/en/5965-4641/5965-4641.pdf

HPUX SysAdm
Frequent Advisor

Re: Device swap priority

@Tim:

Thanks for the doc. It is a really good one. It will take me some time to go thru it but it looks like a perfect fit.
HPUX SysAdm
Frequent Advisor

Re: Device swap priority

Thanks to all who helped.