1752800 Members
5678 Online
108789 Solutions
New Discussion юеВ

Re: swap space issue...

 
SOLVED
Go to solution
boomer_2
Super Advisor

Re: swap space issue...

Ya Jaime,
im planning to enable it...but i would be needing a reboot for it for which im arranging a downtime...
again my quesn is what swap space priority should i set to my secondary swap space and why ?
Alex Georgiev
Regular Advisor

Re: swap space issue...

Boomer,

First things first: Why do you think you need a secondary swap space? You have a server with 8GB RAM & 16GB swap. IMO you have more than enough swap.

Next thing I'm noticing from the output of 'swapinfo -tam' is that it looks like you do not have pseudo-swap enabled. Normally you should have a 'memory' line in output of swapinfo, which is you pseudo-swap. See the output from one of my servers:

TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 8192 0 8192 0% 0 - 1 /dev/vg00/lvol2
reserve - 4020 -4020
memory 8190 5316 2874 65%
total 16382 9336 7046 57% - 0 -

I'm not qualified to recommend that you turn on pseudo-swap, or to explain how it works and why, but I've been told not to ever turn it off. You should seek some professional advice on whether pseudo-swap should be enabled or not. (I'll try to find the article that explains pseudo-swap and post a link)

Finally, the dev line from your swapinfo output shows that you primary swap is 17% used. Normally swap stays unused in HP-UX, and the dev USED % should be 0. So to me that means you are (or have been) paging out. So if anything, your server probably needs more RAM instead of more swap.

I hope the above makes sense.

Now, on to your questions:

Q1) my questn is since swap entry is not there in /etc/fstab then how will i come to know whether swap space is getting used or not

A1) Easiest way to find out if the system knows about your swap space and considers it active is to specify the -a option with swapinfo. If you see it listed, then the system knows about it!

A note on primary swap: it's not in /etc/fstab because the system knows about it at boot time. See the lvlnboot command. Only secondary swap spaces should be listed in /etc/fstab, never primary.

Q2) ...for secondary swap space what should be the priority set 0,1,2 and why, what difference really does it make...?

A2) It doesn't make much of a difference as long as your secondary swap space is "device" swap on the same disk (or mirrored set of disks). If you create a new LV and set it up as secondary swap with the same priority, then in theory you will have "interleaved" swap, and both primary and secondary will get used evenly. Technically you can end up exercising your disk heads a little more if the two swap LVs are physically located in different areas of the disk... So the best thing to do is just to give your secondary swap a priority of 2. That way primary will be used up first, and secondary will be touched only if needed.

Q3) Can i create a swap space on my storage disk if yes then how ???

If you are looking for a procedure, here is a high level one:
1. create a new logical volume, use the '-C y -r n' options with lvcreate (swap must be contiguous and must not have bad block relocation)
2. mirror it to your 2nd OS disk with lvextend
3. add an entry in your /etc/fstab that looks like this:
/dev/vg00/lvnewswap / swap pri=2 0 0
(the / is ignored, it can be any directory)
4. run 'swapon -a'
5. run 'swapinfo -tam' to see your new swap space

That should be it!

Q4) also can i set secondary swap space on EVA4k disk

A4) You can, but I would not recommend it! Too many things can go wrong with an EVA. Worst case scenario is that the EVA will somehow go offline, or you'll lose the Fibre Channel connection to it. Losing your swap space will likely cause an OS panic. The other thing is that at boot time the secondary swap space may need to be activated before the Fibre Channel drives have been loaded. If that's the case, the swap activation will fail.

Hope that helps!
Alex Georgiev
Regular Advisor

Re: swap space issue...

P.S. You are on 11i V2. You should not need to worry about swapchunks (I think it doesn't exists in 11i V2).
Jaime Bolanos Rojas.
Honored Contributor

Re: swap space issue...

boomer,

The priority for secondary swap at least for me would be the same priority than primary swap, it would be better in different controller and different disk ( of course ) that we would be having what is called swap interleaving in the event that we need to page out to disk ( you do not want to page out to disk btw, it's a bad thing ).

Regards,

Jaime.
Work hard when the need comes out.
boomer_2
Super Advisor

Re: swap space issue...

hi Alex,
thank u very much for ur detail explaination..one last questn can i change my secondary swap space priority on fly ..suppose it is 1 now can i change it to 2 now...thanx again......
Jaime Bolanos Rojas.
Honored Contributor

Re: swap space issue...

boomer,

I do not recall swap priority been able to be changed on the fly, the fstab file is the one giving the priority and this file is read everytime the system is rebooted.

Regards,

Jaime.
Work hard when the need comes out.
A. Clay Stephenson
Acclaimed Contributor

Re: swap space issue...

It is pointless to have pseudoswap enabled on a box where swap >= physical memory. Pseudoswap is intended only for the case where boxes have less swap than memory.

Primary swap always gets the priority value of 1. You should never mix swap areas of equal priority on the same physical disk but if you have multiple physical devices that house swap areas then it is a good idea to set them to an equal value. The rule is rather simple; your fastest secondary swap devices should get priority 0 and slower devices get 1, 2, ... but keep in mind that primary swap is always 1.

Now having said all of this, I will add "Big Woo"; it really doesn't matter because worrying about swap layout is very much like rearranging the deck chairs on the Titanic. By the time you get to significant levels of swapping, you have already taken at least a 100x performance hit and all your swap layout tunings might change that to a 99x-101x performance hit and thus "Big Woo".
If it ain't broke, I can fix that.
Alex Georgiev
Regular Advisor

Re: swap space issue...

[I know this thread is "past its prime", but for the sake on completeness I wanted to answer the question about changing swap priority on the fly.]

I tried this in a couple of different way on a test box, and it appears that you can NOT change anything about a swap space on the fly.

Interestingly enough AIX & Solaris allow you to deactivate a swap space on the fly, and will try to reallocate any swap chunks out of the deactivated swap space. In AIX you can also grow and shrink a swap space on the fly.

Looks like HP-UX *might* be moving in a similar direction because in 11i V3 they've repaced the swapon() sys call with swapctl().