Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Relating SGA and Swap Memory

SOLVED
Go to solution
Abram
Occasional Visitor

Relating SGA and Swap Memory

Hello Everyone,
I wanted to know, if there was any thumb rule relationship between SGA and Swap Memory.
i.e.;
1. Given the SGA, would you be able to guess what the optimal Swap Memory settings on that system should have been?

If so,
2. Given the fact that, there are 3 Oracle databases running, with 2 GB SGA each, on an UNIX box, what should have been the Swap Memory ideally?
(would it be an additive result of the answer to question 1?, if not why?)

Thanks in advance,
Abram
There are only 10 types of people; those understand binary, and those who don't
4 REPLIES
Patrick Wallek
Honored Contributor
Solution

Re: Relating SGA and Swap Memory

SGA and swap space really have no relationship whatsoever.

Your SGA should be a function of: 1) PRIMARILY -- How much can you afford in terms of RAM use , and 2) what is best for the DB. You should, ideally have LOTS of RAM on an Oracle machine so you can have a sizeable SGA which can make the DBs perform better.

The amount of swap space you have defined is also a function of the amount of RAM on your machine. To be able to fully utilize ALL of your RAM, you must have AS MUCH swap space, of some fashion (ie. device, filesystem (NOT ideal) or pseudo swap (the swapmem_on kernel parm) as you have RAM in your system.



So the relationship really is more like: SGA -> RAM -> Swap space
Abram
Occasional Visitor

Re: Relating SGA and Swap Memory

Hi Patrick,
Thanks for your reply.
I had read somewhere that Oracle recommends SGA to be approx 1/3rd of Swap Memory.

So, cant we relate the two in any way??

Thanks,
Abram
There are only 10 types of people; those understand binary, and those who don't
A. Clay Stephenson
Acclaimed Contributor

Re: Relating SGA and Swap Memory

There is really no relationship between the two and the explanation is really simple; if your system doesn't have enough physical memory to prevent swapping, you are going to take a huge performance hit (~100x). In that case, you would be far better advised to reduce the size of the SGA(s) because any gains you would get from database cache hits would be swamped by the performance hit that paging causes.

The rules are actually very simple; buy enough memory in the first place so that you don't swap and then allocate either 1X memory for swap if you disable pseudoswap and have at least 0.25x memory as swap if you are running pseudoswap. In modern systems with lots of memory (16GB and up), it's very common to have perhaps 512MB-1GB of primary swap (you must have some), enable pseudoswap, and then let the remainder of the .25x RAM be comprised of filesystem swap. Since, you aren't going to beusing the disk anyway, filesystem swap is just fine and that let's the system fully utilize it's physical memory.

PS. Swap space should really have nothing to do with dump space.
If it ain't broke, I can fix that.
Abram
Occasional Visitor

Re: Relating SGA and Swap Memory

Thank you for your answers, I guess I get a better picture now.

Cheers,
Abram
There are only 10 types of people; those understand binary, and those who don't