Operating System - HP-UX
1834604 Members
4280 Online
110069 Solutions
New Discussion

Re: Question On Swap Space Size.

 
westpanda
Occasional Contributor

Question On Swap Space Size.

Our machine model is HP rp7410, PA8700 850MHz 1CPU*4, Physical Memory is 8GB.

I want to know what Proper size Swap Space will be?

Can you tell me the following answers?
Physical Memory: 1G --> Swap Space Size: ?G;
Physical Memory: 2G --> Swap Space Size: ?G;
Physical Memory: 4G --> Swap Space Size: ?G.
8 REPLIES 8
Rajeev  Shukla
Honored Contributor

Re: Question On Swap Space Size.

The rule for the swap space says to have 2 times the memory but then if the the memory is too high then there is no point of having a large primary swap as long as the swaping doesn't happen.
What normally i do for servers with 1GB and 2GB memory is keep 2GB or 4GB primary swap and keep monitoring the server, if required then add secondry swap space.
For 4GB and 8GB also i recomend to use 2GB primary swap (thats beacuse the memory itself is too high and there are less likly chances that a lot of proccess would be swaped) and then keep monitoring the server for swap utilization. If required then add extra secondry swap space.
Stefan Farrelly
Honored Contributor

Re: Question On Swap Space Size.

If you wish to utilize all your RAM then set your swapspace to the same size as RAM (ie. 8GB RAM = 8GB SWAP). We do on all our servers.
Im from Palmerston North, New Zealand, but somehow ended up in London...
T G Manikandan
Honored Contributor

Re: Question On Swap Space Size.

It depends on how much memory is to be used on the machine.
If in your case where the server has got 8gb RAM.

1. you can go ahead in creating a primary swap of around 1Gb and later add some amount of secondary swap on non-vg00 disks in case the server/application requires more memory.

If the server applications do not use swap and the RAM on the server is more than enough then you can enable "pseudo-swap"
Here pseudo-swap is that the RAM is used as the system swap area.

It is not that you should have 1.5 to 2 times the RAM size for your swap.

check the document /usr/share/doc/memmgt.txt for more information reg. pseudo-swap.

Trond Haugen
Honored Contributor

Re: Question On Swap Space Size.

A few words about pseudo swap. It it enabled with the krnel parameter swapmem_on which deafilts to '1' (on). It's purpose it as explained to avoid having to have a large amount of swap when you have sized you memory to accomodate all you processes.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Suresh Patoria
Super Advisor

Re: Question On Swap Space Size.

Hi,

use the swap size double of ur RAM

Thanx
Zeev Schultz
Honored Contributor

Re: Question On Swap Space Size.

consider it that way,calculate how much memory your processes occupy during heavy load,add,say 20% for safety and set the swap device properly.When using pseudo swap up to 7/8 of you physicall memory can be added to the total swap.

BTW, I think that "twice swap space as your memory" considerations are coming from a situation where swap and dump devices are on the same device.So set up your dump device as well.

Zeev

P.S consider giving points to the well deserved folks up there :)
So computers don't think yet. At least not chess computers. - Seymour Cray
Jakes Louw
Trusted Contributor

Re: Question On Swap Space Size.

My rule-of-thumb is 2 to 3 times main memory. As one of the other people mentioned, set up your primary swap as 1GB, then add secondary swap in incremental chunks of your own choice. We have servers with over 64GB main memory, so typically we would add secondary swap in chunks of 4 or 8 GB raw volumes. Then it's down to monitoring and adjusting. If you are using less swap at peak than is allocated, simply modify your /etc/fstab and remove one of the secondary swap areas, and reboot when possible.
So as usual, there is no proper answer....
Trying is the first step to failure - Homer Simpson
Marvin Strong
Honored Contributor

Re: Question On Swap Space Size.


Well I say this depends on if you are using psuedo swap or not.

However I would recommend, not using psuedo swap for these machines and just

1G = 2G swap
2G = 4G swap
4G = 8G swap

if you have the disk in order to do this.