Operating System - HP-UX
1845532 Members
2951 Online
110244 Solutions
New Discussion

How much swap space is needed?

 
SOLVED
Go to solution
Leonard Schingle
Senior Member

How much swap space is needed?

How much swap space is needed?

Server info:
server : N4000
number CPUs : 8
GB memory : 8
OS : 11.0 (64 bit)

Everything I can find on HP's web site says to configure two times physical memory of swap space. I am getting told that only 2gb of swap space is actually needed. Any help would be appreciated.
19 REPLIES 19
Kevin Wright
Honored Contributor

Re: How much swap space is needed?

1.5 to 2 times the amount of physical memory is the guideline.
Craig Rants
Honored Contributor

Re: How much swap space is needed?

The old standard of two times memory for swap is a little outdated. The only reason you would even want 8gb for swap is to catch a system crash dump. I would start with something reasonable, you can always add more swap later, plus don't put it all on you vg00 disk, that will just create a ton of i/o on the disk you really don't want i/o to be happening on. I personally would start with 4gb and see what happens from there. Watch glance and perfview, see if you need to add more if it is sufficient.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
hpuxrox
Respected Contributor

Re: How much swap space is needed?

This is an age old question that we can talk about for ever.

For now I will go with Kevins answer( Short and Simple )

-Yates
S.K. Chan
Honored Contributor

Re: How much swap space is needed?

I would do at least the 1:1 ratio, but that's me.
Helen French
Honored Contributor

Re: How much swap space is needed?

Hi Leonard:

The amount of swap space required is depend on your application and need. Normally the recommendation is to keep at least the same amount as of memory. However, in some situations which hardly uses the swap space and has lot of memory could configure less amount of swap space, then observe the memory and swap usage (with glance, swapinfo etc). If needed you can add more space.

Check the kernel parameters too - like dbc_max_pct. Reduce if set default to 50.

HTH,
Shiju
Life is a promise, fulfill it!
MANOJ SRIVASTAVA
Honored Contributor

Re: How much swap space is needed?

Hi Leonard

It is better to have atleast 8.0 GB swap to start with , I do like this is to start with 1:1 and then monitor it when the system gors into production and may eb tweak it with a secondary swap , but I dont think you would need more tahn 8.0 GB .


Manoj Srivastava
pap
Respected Contributor

Re: How much swap space is needed?

Hi,
You have to keep swap space minumum of 8 GB (equal to memory). However you can keep it 12 GB (in case later you decide to upgrade memory to 12 GB)
Otherwise 8GB swap space is Ok with your configuration.

Thanks,
-pap
"Winners don't do different things , they do things differently"
Craig Rants
Honored Contributor

Re: How much swap space is needed?

Let's get one thing clear. You DO NOT have to have the swap the same size as physical memory. I can back that up with a quote from HP's Peformance Guru. Just look up the "HP-UX Kernel Tuning and Performance Guide" by Stephen Ciullo.

You have to do what is best for the box, but lets not make claims that are untrue...

C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
hpuxrox
Respected Contributor

Re: How much swap space is needed?

That is fine, every box and situation is different. One thing you DO NOT want to ever do is run out of swap! Very bad things happen then.

Peace...
Leonard Schingle
Senior Member

Re: How much swap space is needed?

I failed to mention that the server would be used as an Oracle database server. Could potentially have four oracle instances running on this server.

Thanks for everyones feedback.
Michael Tully
Honored Contributor

Re: How much swap space is needed?

Hi,

Horses for courses. The amount of swap
needed for a system *will* depend on the
application being used. That being said,
the old rule of thumb of 2 x MEM = SWAP
does not really apply these days. In
older systems this was true given that
there was vastly less amounts of RAM that
could be used, so this was beefed up so
to speak with heaps of swap space. Having
too much swap can hinder your systems
performance. Consider starting with no
more than 2Gb on your internal disk, (I
would pick 1Gb) and the remaining 7Gb
split across different spindles or
LUN's.

Cheers
~Michael~
Anyone for a Mutiny ?
Niraj Kumar Verma
Trusted Contributor

Re: How much swap space is needed?

Hi,

1:1 ratio is doing good for
all our HP systems.

-Niraj
Niraj.Verma@philips.com
Vogra
Regular Advisor

Re: How much swap space is needed?

Leonard,
althoug 1.5 - 2 times RAM is the guideline, for system that have a lot of memory it's can be expensive, than you can begin with 1xRAM and use a pseudo swap area.
HYH.
We are spirits in the material world
Craig Rants
Honored Contributor
Solution

Re: How much swap space is needed?

Leonard,
Figure out what is best for you, you have to live with the box, we don't.

I would recommend that if you haven't seen this before, to read this document.

http://www.hp-partners.com/tcl_public/html/technical_support/tuning.html#swap

I've been lucky enough to have this guy visit our company and be in an OR with him. His theory's about performance are right on. For example buffer cache. Why do we need a huge buffer cache when your hit rate is 98% with a 500MB buffer cache, 98% is 98%. Things like that which apply to todays servers.

I'll get off my soap box now. I just want to make sure we are claiming something to be fact, when it is not.

C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Victor_5
Trusted Contributor

Re: How much swap space is needed?

Generally, it is 2 times of your physical memory, but there are exceptions in some cases, for example, on one of my N class, I have one 9G HD, I have 4G memory at the same time, so I can not follow this rule, otherwise I have no space for others only on 9G HD.

Regarding swap, we have device swap and file system swap, we can consider file system swap if we need.

John Payne_2
Honored Contributor

Re: How much swap space is needed?

"It depends" is the absolute correct answer. Oracle has some guidelines regarding swap that you should concider. (At least concider...) I do not have a system curently with more than 4GB of swap. Most get 2GB of swap, and they do not even use it. (We rarely if ever are in a situation where swap is needed.) Memory is cheap. That's all I have to say. If we have a box that starts thrashing, we purchase more memory for it.

Hope it helps.

John
Spoon!!!!
John Carr_2
Honored Contributor

Re: How much swap space is needed?

Hi

I would start by asking the application developers to specify what is a reasonable criteria. All our systems are below the old double figure oracle or no oracle.

cheers
john.
Wodisch
Honored Contributor

Re: How much swap space is needed?

Hi Leonard,

is simply depends on your kernel's "swapmem_on" parameter:
swapmem_on=0: you need MORE swap space than phsysical RAM, sometimes even more than 6 times your RAM!

swapmem_on=1: you need at least 3/4 of your RAM as spap space

In both cases you can (and should) spread that swap space over multiple drives...

HTH,
Wodisch
Bill Hassell
Honored Contributor

Re: How much swap space is needed?

There have been 'rules of thumb' for swap space for many years that ran from 2xRAM to 10xRAM but these rules (for HP-UX) have been obsolete for more than 6 years!

Unfortunately, a lot of vendors and even training courses make these obsolete recommendations. So let's start with the basics:

Starting at 10.00 (and a couple of revs at 9.xx), a new parameter was introduced: swapmem_on and it was set to 1 (or any non-zero value), thus removing the original 1:1 swap vs. RAM mapping that previous versions required. If swapmem_on=0, then all processes that are running must have a reserved area in swap coresponding to the process size. To run more processes than will fit in RAM, you will need more swap space than RAM, thus the old recommendation of 2xRAM or more for swap space.

As you can see, having 8Gb of RAM where only 5Gb is ever used will mean that the 8Gb of swap space (minimum) will never be used...what a waste!

Which is why pseudo-swap was created, a bad name for what is essentially a fairly standard behavior for most other operating systems. When pseudo-swap is enabled with swapmem_on=1, there no longer needs to be a 1:1 mapping of process space into swap space. If there is more than enough memory for all processes to run at the same time, then no swap space is needed at all (strictly speaking a minimum of a few megs is needed to satisfy the opsystem).

One caveat: if processes are using memory mapped files, then some swap space will be needed for these files.

With pseudo-swap, approximately 75% of RAM needs no additional swap space. After all, they are in RAM so there is no reason to have any swap space until more than 75% of RAM is required by more processes. Then you add swap space to accomodate the overflow.

So swap is not some magic memory tool, it is simply a place to put pages of processes that are deactivated and higher priority processes need the RAM. The majority of customer system I see have 0% swap space usage, sometimes 10 or 20 Gb, completely wasted as it will never be used.

There is a place for swap space. A small RAM system (less than 1Gb) might used as a documentation server and users look up information perhaps 2-3 times per day. Such a system (I managed one for 2,000 users) would run 300-500 copies of a 5 meg process in only 256 megs of RAM. Therefore, the 2500 megs of swap was indeed required and the majority was in use. Performance was fine since very few of the processes were busy at the same time and the 'think time' was very long for each user.


Bill Hassell, sysadmin