Disclaimer

Thursday 9 September 2021

shmmax Vs shmall - Kernel Parameter

Kernel parameters 


1 fs.aio-max-nr = 1048576

 2 fs.file-max = 6815744

 3 kernel.shmall = 2097152

 4 kernel.shmmax = 536870912

 5 kernel.shmmni = 4096

 6 kernel.sem = 250 32000 100 128

 7 net.ipv4.ip_local_port_range = 9000 65500

 8 net.core.rmem_default = 262144

 9 net.core.rmem_max = 4194304

10 net.core.wmem_default = 262144

11 net.core.wmem_max = 1048576


1. kernel.shmmax :


The official recommendation is worth :

Oracle makes use of one of the 3 memory management models to create the SGA during database startup and it does this in following sequence.

👉First Oracle attempts to use the one-segment model and if this fails, 

👉it proceeds with the next one which’s the contiguous multi-segment model and 

👉if that fails too, it goes with the last option which is the non-contiguous multi-segment model.


So during startup it looks for shmmax parameter and compares it with the initialization parameter 

*.sga_target. If shmmax > *.sga_target, 

then oracle goes with one-segment model approach where the entire SGA is created within a single shared memory segment.

But the above attempt (one-segment) fails if SGA size otherwise 

*.sga_target > shmmax, 

then Oracle proceeds with the 2nd option – contiguous multi-segment model. 

Contiguous allocations, as the name indicates are a set of shared memory segments which are contiguous within the memory and if it can find such a set of segments then entire SGA is created to fit in within this set.

But if cannot find a set of contiguous allocations then last of the 3 option’s is chosen – non-contiguous multi-segment allocation and in this Oracle has to grab the free memory segments fragmented between used spaces.


32 position linux System : The maximum value can be 4GB ( 4294967296 bytes ) -1byte , namely 4294967295 . 

Recommended value is more than half of memory , So if it is 32 For the system , Generally, it can be taken as 4294967295 . 

32 Bit system pair SGA There's a limit to the size , therefore SGA It can definitely be included in a single shared memory segment .


64 position linux System : The maximum value that can be taken is the physical memory value -1byte , 

The recommended value is more than half of the physical memory , Generally, the value is greater than SGA_MAX_SIZE that will do , You can get physical memory -1byte .


How to calculate value of shmmax?


1  Memory is  12G  when , The value is  12*1024*1024*1024-1 = 12884901887

2  Memory is  16G  when , The value is  16*1024*1024*1024-1 = 17179869183

3  Memory is  32G  when , The value is  32*1024*1024*1024-1 = 34359738367

4  Memory is  64G  when , The value is  64*1024*1024*1024-1 = 68719476735

5  Memory is  128G  when , The value is  128*1024*1024*1024-1 = 137438953471



2. kernel.shmall :

👉As SHMALL is the total size of Shard Memory Segments System wide, 

it should always be less than the Physical Memory on the System and should be greater than sum of SGA’s of all the oracle databases on the server.

This parameter controls the total number of pages of shared memory that can be used . 

Linux The shared memory page size is 4KB, The size of the shared memory segment is an integral multiple of the size of the shared memory page .

The maximum size of a shared memory segment is 16G , 

So the number of pages that need to be shared memory is 16GB/4KB==4194304 ( page ),


How to calculate value of shmall?

#getconf PAGE_SIZE

4096

 

Calculate proper value for shmall:

The value of shmall should be:


👉shmall=total size of the SGAs on the system/page size.


Let’s assume the size of the SGA is 16GB in the system then it would be 1024 * 1024 * 1024 * 16 / 4096 = 4194304

Here:- shmall=4194304


👇Shmall values for memory respectively as below ðŸ‘‡:-

1  When memory is  12G  when , kernel.shmall = 3145728

2  When memory is  16G  when , kernel.shmall = 4194304

3  When memory is  32G  when , kernel.shmall = 8388608

4  When memory is  64G  when , kernel.shmall = 16777216

5  When memory is  128G  when , kernel.shmall = 33554432

 



No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...