Oracle & MySQL Support

InfraStack-Labs Oracle & MySQL DBA Services help you manage, maintain, and optimize your critical Oracle systems. We deliver 24/7, year-round support with flexible monthly contracts that don’t lock you in.

Please contact me :- ajith.narayanan@infrastack-labs.in

Saturday, October 9, 2010

SGA & Hugepages Myth

Hi All,

I'd like to shed some light on how Hugepages works and its relation to SGA in order to eliminate some confusion you might have.

1- These 2 are not related, no need for huegapgaes to be set, but it's advisable to set it for better memory utilization.

2- If hugepages is set, then the value is affected by the SGA size

3- If SGA is changing(increase/decrease) , hugepages must be recalculated accordingly.

Let me illustrate it:

_*Case 1 -- Hugepages not set*_
========================

* cat /proc/meminfo and if HugePages_Total = 0 , this indicates, that the hugepages not set

* Suppose we want to set the hugepages for 5GB SGA, do the following:

o 1st we must convert the 5GB to MB, so 5*1024 which equals to 5120MB

o Divide the above value by 2, so 5120/2 = 2560

o Add 3% (for over head)to the above value, so 2560+85(3%)= 2645 which is value of hugepages

o Set vm.nr_hugepages = 2645 in /etc/sysctl.conf



_*Case 2 - SGA size changed*_
======================

* If the SGA is changed(buffer cache or shared_pool), then we need to adjust the hugepages accordingly as follows:

* Suppose we're increasing the SGA by 2GB (from 5GB to 7GB), so we must increase the hugepages by 2 GB or set it to 7GB if it's not set; let's assume that the current value is set correctly and we just need to increase it by 2 GB; then we do:

o Convert the 2GB to MB, so 2*1024 which equals to 2048MB

o Divide the above value by 2, so 2048/2 = 1024 and add 3%

o Add the above value to he current hugepages value, so 2645+1054= 3799 which is the new value of hugepages

o Set vm.nr_hugepages = 3749 in /etc/sysctl.conf


And remember that you must always check the value of kernel.shmmax & kernel.shmall in /etc/sysctl.conf

Pls refer to the attached table below on how to set the value for these parameter:












HAPPY LEARNING!

No comments:

Post a Comment

Thanks for you valuable comments !