1834462 Members
2874 Online
110067 Solutions
New Discussion

swap space

 
Inter_1
Frequent Advisor

swap space

Is any way to calculate the swap space needed in system? Is it true that swap space should be 2 x RAM. For example if I have 10G RAM then swap recommanded should be 20G.

Thanks,
Taulant
I like to fix things.
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: swap space

Shalom Taulant,

No, this rule does not really apply to large memory systems. The minimum swap is 50% of RAM because the swap file also doubles as a dump storage device.

I generally set up a fast high priority swap space equal to half ram and then add a secondary lower priority one for half ram again or all of ram if I expect the system to be particularly over-used.

I try not to go past 1.5 times ram in swap space.

For systems that are asked to do more then should be asked then you can go 2X RAM. If you go beyond that, and I've been forced to in the past you get massive system slowdown due to paging and it doesn't help anyway.

Summary: No that rule of thumb does not always apply. I consider a system to be large ram over 8 GB.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor

Re: swap space

If you had a Wayback Machine, you and Sherman could go back to the 1980's and your 2X RAM rule might make sense (assuming anyone could afford 10GiB of RAM then). The best advise for swap is as much as you need. Typically, create a small primary swap area (1GiB oe so); add additional swap untl you reach 25% of RAM, enable pseudoswap (swapmem_on=1), and monitor swap usage. Leave space unconfigured on your VG's and set maxswapchunks (if applicable) to a size big enough to handle your maximum anticipated needs. If you do this, it's so easy to add additional swap that it is not worth worrying about. I have many systems with far less swap space than memory and they work quite well. Why enable swap that is never going to be used? I also suggest that every dab of swap be mirrored and disassociate yourself from the idea that swap and dump spaces have anything to do with each other.
If it ain't broke, I can fix that.
DCE
Honored Contributor

Re: swap space



Don't forgetthatyou have the option to use psuedo swap as well (swapmemon=1 in the kernel)

this allows you to *fool* the system into thinking there is more physical swap than there actually is.

for a 10 GB system, I would do 10 GB physical swap, and activate psuedoswap. This will make the system think there is almost twice as much swap is available than there really is.

If you are actually using 10+ GB of swap, your system performance is going to *very* poor. There is no need to assign disk space for even slower performance........

Inter_1
Frequent Advisor

Re: swap space

I checked the systems and the RAM is used 80% and the swap space is used 50% the actuall system has 10GB RAM and 3GB swap space. In this case what do u recommand?

Thanks
Taulant
I like to fix things.
Inter_1
Frequent Advisor

Re: swap space

I have AIX unix system also HP-UX and solaris
I like to fix things.
A. Clay Stephenson
Acclaimed Contributor

Re: swap space

Do a swapinfo -tam and post it. If you see a "memory" line then pseudoswap is enabled; if that is the only "swap" in use then you aren't using any swap. Even if device swap indicates usages you may not be actually swapping because that "swap" usage could be memory mapped files. Use Glance or vmstat to determine the pageout rate; if that is > 0 then you are actually swapping.
If it ain't broke, I can fix that.
DCE
Honored Contributor

Re: swap space


You need to have at leat 10GB of visible swap space - it can be all real swap, or a combination of real and psuedoswap.

Because of the way HP-UX handles swap (it reserves it as processes use memory, but does not actually use it) you can have situations occur where the system will not be able to access all of its memory because all of the swap has been reserved. In your case you have the potential to not be able to access 7 GB of memory..........
Inter_1
Frequent Advisor

Re: swap space

thanks
I like to fix things.