1754776 Members
3639 Online
108825 Solutions
New Discussion юеВ

Swap considerations

 
SOLVED
Go to solution
Ralph Grothe
Honored Contributor

Swap considerations

Hi,

The server is furnished with 16 GB phys. RAM.
Due to memory greed of Oracle applications it was required to supply it with lots of device swap as well.
Because we're now already "wasting" so much disk space on swap anyway I would think that pseudo-swap has become obsolete.
As I understand pseudo-swap was introduced for those short or mean on disk space by allowing 3/4 of phys. RAM to act as additional "pseudo" swap.
Would I regain some physical memory if I turned off the tunable swapmem_on?

Then I was told by a performance guru that giving my secondary device swap a lesser priority than the primary dev swap was silly, because it most likely would never be used.

I argued that should it be used at all any time the machine would probably be under such strain that virtually everything would come to a standstill anyway.
I regard the swap more as a necessity for swap reservation to get processes loaded at all.
And then I think the whole concept is silly because this machine has only two internal 70 GB disks which are RAID1 via Mirror/UX.
Therefore if I gave both devices the same priority I could imagine much more disk head motion during paging.
So should I follow the guru's advice and edit my fstab to give the 2nd swap dev the same priority as the 1st, and do a reboot?

Here's my swap layout

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 20112 378 19734 2% 0 - 1 /dev/vg00/lvol2
dev 12000 0 12000 0% 0 - 2 /dev/vg00/lvol11
reserve - 15727 -15727
memory 12786 2861 9925 22%
total 44898 18966 25932 42% - 0 -

Rgds.
Ralph
Madness, thy name is system administration
12 REPLIES 12
RAC_1
Honored Contributor

Re: Swap considerations

Your both swap spaces are on vg00, but are they on same disk? If yes then setting same priority wont help much as in this case it will be writing to same disk. If they are on different disks setting same priority will definitely help.
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Swap considerations

Well, to a large extent worrying about swap performance is pointless because when you is swapping you ain't 'performin. Having said that, if your two swap LVOL's are located on the same PV then they should not have equal priority because the head will be moving like a madman interleaving between the two areas. If located on different physical devices then equal priority lets you spread the IO.

Pseudoswap should not be considered obsolete and your box is a good example. You might very well find that you need very little swap space. You might choose to configure only 4GB of swap or so and that would be it. The old rules about 2-3x swapspace (4-6x with mirroring) are relics from another age.

My typical setup on boxes with lots of memory is to enable pseudoswap, allocate a small amount of primary swap (1GB or so, you must have some primary swap) (and mirror it), and then monitor the swap utilization. It's so easy to add additional swap that it's not worth worrying abount especially if you increase the maxswapchunks kernel parameter initially.

I hate the idea of buying disk that serves no purpose; that's why I bought all that RAM in the first place! Finally, disassociate yourself from the notion (and sadly, it's the default) that swap has anything to do with dump space.

If it ain't broke, I can fix that.
Ralph Grothe
Honored Contributor

Re: Swap considerations

RAC,

as I said, the box only has two root disks which are mirrored.
Therefore the swap devs reside on the same disks.
Can one tell Mirror/UX a preferred order of writing?
Maybe this way one could devise a scheme that both mirror disks are occupied evenly?
Madness, thy name is system administration
Patrick Wallek
Honored Contributor

Re: Swap considerations

1) No, you would not save any memory by turning pseudo-swap off.

2) I would get rid of the additional 12GB of swap that is definied for lvol11. Because, it you ever use up you first 20GB and need the additionall 12GB, you are going to be screwed anyway because the system perforance will be non-existent. I would not worry too much right now about the priority of your swap devices.

The ideal way to configure swap is to have a small primary swap area with a larger secondary and give the secondary a HIGHER priority (lower number) so that it gets used first. If you were to use much of your swap at all your VG00 disks would get beat to death.

You are correct in your evaluation of swap, or swap space plus pseudo swap -- it is necessary so processes can start. Each process reserves a piece of swap space JUST IN CASE it has to be paged out. If you don't have enought swap, then you can't use all of your RAM.

Now you are currently using 2% of your swap space. I would go ahead and start lobbying to upgrade RAM on this machine. I personally think you should NEVER have to actually use swap space. RAM prices are getting reasonable enough that you should have plenty of RAM in the machine.
Patrick Wallek
Honored Contributor

Re: Swap considerations

As far as I know you can't tell mirror/ux how to go about mirroring.

Clay does bring up a good point that I missed about both swap areas being on the same disk. If you have 2 swap areas of the same priority HP-UX will try to interleave the page-outs between the 2 areas. With both on the same disk, they would get beat to death even more.
A. Clay Stephenson
Acclaimed Contributor

Re: Swap considerations

In your case, because the disks are mirrored, and more importantly (independent of mirroring) because the swap areas reside on the same physical disks your setup is the correct one. The secondary swap area will be used completely before any of the primary swap is used. If you wish, turn off pseudoswap, it serves no purpose on your box but you want see any difference either. Again, to a very large extent worrying about swap layout in your case is a lot like "rearranging the deck chairs on the Titanic".
If it ain't broke, I can fix that.
Ralph Grothe
Honored Contributor

Re: Swap considerations

Clay,

thank you for confirming my first thought about the priority flags.
You stressed exactly what I feared would be the effect if both were given the same priority.

About the wasted disk space.
I fear that if I commented the swap entry in fstab and rebooted in order to release the LV that the oracle stuff wouldn't come up even with the 20 Gig of the 1st dev.
I've seen this happen with SAP that the DBAs couldn't startup their stuff unless given enough swap.
So I think it is only needed for reservation where Pseudo-Swap indeed would make a lot of sense.
I don't consider the swap as a dump device,
because as you rightly stressed should it ever come to be used in such a way the performance would be beyond all recognition.
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Swap considerations

Patrick,

if only we could plug in more RAM.
If I remember correctly the HP SE who did the last upgrade on this box mentioned that the limit of extensibility has been reached by now.
Although the catalogue claims that you can put 32 GB in an N4000, I'd rather cling to the SE's statement.
I mean he who screws the machines (oops, no pun intended) every day should know better than the marketing people responsible for sales catalogues.
Madness, thy name is system administration
A. Clay Stephenson
Acclaimed Contributor

Re: Swap considerations

Actually, even with SAP you don't need that much swap -- except during install. SAP checks for the amount of swap configured. My favorite way to "outbushwhack" SAP is to follow my above rules: plenty of memory, 1GB or so or primary swap, and then the dreaded, terrible, awful filesystem swap at very low priority. After install, I remove the filesystem swap and SAP is still a Happy Camper.
If it ain't broke, I can fix that.