Showing results for 
Search instead for 
Did you mean: 

small primary swap

Stuart Abramson_2
Honored Contributor

small primary swap

I was just looking at our swap today, and wonder if this is set up correctly.

The primary swap, built into the root disk, is only 524 MB, for an 8 GB RAM machine. Somebody added a 2nd swap area of 8 GB. But I remember that both swap areas should be equal length, because of swap interleaving or something. Should I rebuild this server with two equal size 8 GB swap areas? Can I remove the lvol2 area, given that it's built into the root disk?

Also, my only free disk space is on EMC disks. Can you set up primary swap to an EMC disk? (I know it's expensive, but that's not my concern right now.)

We suffer slow performance on this machine. Could this be a factor?

# swapinfo -at
dev 524288 520452 3836 99% 0 - 1 /dev/vg00/lvol2
dev 8888320 1120756 7767564 13% 0 - 1 /dev/vg01/lvol01
reserve - 2079228 -2079228
memory 4790188 4068860 721328 85%
total 14202796 7789296 6413500 55% - 0 -
Pete Randall
Outstanding Contributor

Re: small primary swap


I don't think there's anything wrong with your swap configuration, the problem stems from the fact that you're using it! The only good swap configuration is one that doesn't get used. Get more RAM.


Honored Contributor

Re: small primary swap

If I remember correctly, the sizes does not matter. What we achive with secondary swap if performance improvement. (by giving same priorities to different swaps)

Also have a look at kernel parameter swapmem_on. (this is particulary useful for systems with large memory)

Setting it on and setting swap equal to physical mem can save some space.

Choice is yours.
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor

Re: small primary swap

Your configuration is ok and I tend to like that method. A system MUST have some primary swap which MUST be on the boot disk but there's nothing wrong (and in fact it's better) to distribute the remaining swap on other disks as you are doing. The worst configuration is to have multiple swap lvols on the same physical disk at the same priority. You can imagine how much head movement will be involved.

Now having said this, the real answer is that it really doesn't matter too much because once the system starts swapping to any significant degree the performance takes such a dive that worrying about swap layout is almost akin to rearranging the deckchairs on the Titanic.

You are swapping and the real answer is to add more memory or reduce memory usage by reducing the number of processes, shrinking the size of database caches, or reducing kernel, memory usage (e.g. buffer cache).
If it ain't broke, I can fix that.
Trusted Contributor

Re: small primary swap

Since you have about 8GB of RAM, the swap will not be used at all.
But for such case, the kernel parameter "swapmen_on" must be set to 1!

Remove & extend lvol2 is possible but a little complex.

For "slow performance", I think it will not be a factor. On the other hand, disk I/O must be considered first.

Use sar or glance to measure it!

Steven E. Protter
Exalted Contributor

Re: small primary swap

Interesting how there are varying opinions in the thread.

I was just posting in another thread how I'd like to try a setup similar to what A. Clay recommends and what you are doing.

On paper your setup looks like your system will really fly, especially when its running at light load factors.

When the work gets heavy, your system will probably scale and perform nicely as well.

I think its a pretty good setup and I'll let you know when I try something similar on a D box I'm setting up next week.

I'd like to know hpux's rationale for making changes.

Steven E Protter
Owner of ISN Corporation
Pete Ledger
Occasional Visitor

Re: small primary swap

I agree with setting up primary swap to be small and using a larger secondary swap, especially when the secondary swap is on an EMC as you would normally get better IO performance on the EMC devices.

The thing to watch for is that you have enough space for a crash dump which normally goes onto your primary swap volume. You can check this (on HP-UX 11) with

# crashconf -v

which will report the number of pages to be included in the dump (remember to x4 the pages as they are 4KB) and the dump device. On a system we have with 6GB, the dump size is around.

If you're not concerned about a crash then I'd keep primary swap small