cancel
Showing results for 
Search instead for 
Did you mean: 

Swap

 
SOLVED
Go to solution
Fern H2O
Frequent Advisor

Swap

Hello,

Here's the output to swapinfo -tam

TYPE AVAIL USED FREE USED LIMIT
dev 20000 4536 15464 23%
reserve - 15464 -15464
memory 32700 26903 5797 82%
total 52700 46903 5797 89%

Basically, my question is, should I add more Swap?? Howcome Memory used is so high and swap space is barely being used? Does it matter what VG swap is located in? For example, SAP/Oracle is on VG03, does it matter if I add LV Swap in VG00 as opposed to VG03? Does it affect performance? Is there a guideline as to how much swap should be used, in general of course?

As you can see, I'm not very knowledgeable with SWAP so your input here would be very much appreciated!!

Thanks in advance,

7 REPLIES
Michael Steele_2
Honored Contributor
Solution

Re: Swap

Hi

a) "...should I add more Swap?? ..." - yep
b) "...Howcome Memory used is so high and swap space is barely being used?..." - Normal. Swapping is bad and slower I/O fetching than in memory.
c) "..Does it matter what VG swap is located in? ..." - vg00 lvol2 must always be the 2nd lvol in vg00. Any additional 2ndary swap can be in any vg.
d) "...Does it affect performance..." - No, as long as they are on different luns/disk/PVs. You create a disk bottle neck if too much I/O is on the same disk. And better performance is obtained with more spindles / luns. This is load balancing and a frequent subject in you job - How to balance the load for better performance.
e) "...Is there a guideline as to how much swap should be used, in general of course?..." Right now you are at 89%. You want to always be below 75%. If you expect swap growth then add as much to get down to 50%.

Refer to this doc

C:\Users\MFS\Documents\HP-UX\Understanding HP-UX swap reservation and allocation.htm
Support Fatherhood - Stop Family Law
Raj D.
Honored Contributor

Re: Swap

Fern H20,

Also check this out:,

How Much Swap Do I need?
http://docs.hp.com/en/1219/tuningwp.html#swapneed

Swap space management:
http://docs.hp.com/en/1218/mem_mgt.html#SWAP SPACE MANAGEMENT


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Fern H2O
Frequent Advisor

Re: Swap

Thanks Michael & Raj! That was very helpful. I now get the gist of what swap is.

One question though, in the document Raj provided, what does it mean by:

NOTE: For best performance, swap space should be distributed evenly across all disks configured with swap

I'm not sure exactly what that means. Could you give me an example??

P.S. Michael, I think you forgot to attach your document.
Fern H2O
Frequent Advisor

Re: Swap

One More Thing,

I already have 20GB on VG00 and thanks to your input I'm going to add another 10GB. But, my question is, should I add it in VG00? or would it be better to add it on another VG? Perhaps the same VG where SAP/Oracle are in? Or maybe create a new VG with disk just for swap? And why?

Thanks alot guys!
James R. Ferguson
Acclaimed Contributor

Re: Swap

Hi:

> NOTE: For best performance, swap space should be distributed evenly across all disks configured with swap. I'm not sure exactly what that means.

The idea is that if you have multiple swap device files on different physical disks, you might want to set the swap priority equal and allow any swap I/O to be interleaved (round-robined) among the devices. This keeps any one physical disk from doing all the I/O and potentially being slowed.

> I already have 20GB on VG00 and thanks to your input I'm going to add another 10GB. But, my question is, should I add it in VG00? or would it be better to add it on another VG? Perhaps the same VG where SAP/Oracle are in? Or maybe create a new VG with disk just for swap? And why?

My personal preference is to add secondary device swap to something _other than_ vg00 where primary swap resides. I then set the swap priority to a _lower_ numeric value than primary swap which makes the secondary swap device the _preferred_ one over the primary. This would reduce vg00 I/O in times of swap activity.

All of your choices are adding or subtracting drops from a rainstorm. You never want to actually do swap I/O. You want to have enough memory and you want to control your running environment in a way that avoids swapping. You do need some swapspace for process reservation. That is, every process must _reserve_ swap space in anticipation that if it is every truly needed in will be available, This differs from actual swapping. You can use 'vmstat' and look at the page-out (po) values. Numbers greater than about 10 indicate the beginning of significant swapping and the beginning of overall performance degradation.

Regards!

...JRF...

Re: Swap

I like JRF's rainstorm analogy - here's another I use to try and explain why spending time optimising swap is a pretty fruitless exercise...

when you look at the relative speeds of memory access vs disk access you quickly realise there is NO POINT in trying to "optimize" your swap disk speed.

Consider:

a typical memory access might take 150ns (nano-seconds or billionth of a second). so that's:

0.00000015s

a typical disk access on a nice fast disk system could realistically get as good as 4ms (milli-seconds or thousandth of a second). so that's:

0.004s

So thats a difference of about 26,000 times!

To put that into context its like comparing a man walking (4mph) to some future concept spacecraft travelling at 100,000mph. If the man optimizes what he's doing (starts running) in relative terms its not going to make much difference.

So just make sure you *have* enough swap, but really don't worry about the performance of it - it really won't matter.... much better put put your efforts into making sure you have enough physical RAM, or you tune your system to not exceed your phsyical RAM so you never actually have to use swap...

HTH

Duncan

HTH

Duncan
Fern H2O
Frequent Advisor

Re: Swap

Thanks alot everyone!

You've been of great help!