Navigation Bar

Saturday, August 26, 2023

Oracle 11g RAC Kernel Parameters Explained

 When an oracle instance is started, memory is allocated to it for SGA and PGA. This memory configuration for the SGA and the PGA and consequently for the kernel parameters depends on whether Automatic Memory Management (AMM) or Automatic Shared Memory Management(ASMM) or Manual Memory Management is used.

In AMM, MEMORY_TARGET and MEMORY_MAX_TARGET are the main parameters that need to be set while in ASMM, SGA_TARGET and SGA_MAX_SIZE are the main parameters that need to be set. When ASMM is used, the corresponding shared segments allocated can be viewed using the command

#ipcs -lm

Shared Memory Limits

max number of segments = 4096

max segment size (kbytes) = 67108864

max total shared memory (kbytes) = 17179869184

min seg size (bytes) = 1

The choice of memory management determines the operating system call to allocate memory. shmget() is used for ASMM while the mmap() system call is used for AMM.

kernel.shmax parameter - sets the maximum size in bytes for a shared memory segment. By default on OEL5 this parameter is set to 68719476736 which is 64 GB. Typically this parameter should be greater than the Oracle Initialization parameter SGA_MAX_SIZE. If it is smaller than the SGA_MAX_SIZE parameter, the SGA will not be created in a single shared segment. Oracle will use multiple smaller shared segments to create the SGA. The oracle validated rpm sets the values for this parameter at 4 TB for a x86-64 system and at 4 GB for an x86 system.

kernel.shmmni parameter - this parameter sets the maximum number of shared memory segments for an oracle instance. So if one segment is used for one SGA, this parameter reflects the maximum number of oracle instances, including ASM instances that you wish to start on a single server. The default value for this parameter by the oracle validated rpm is 4096.

kernel.shmall parameter - this defines the maximum number of shared memory pages that can be allocated on the system. Its default value is 4294967296. Assuming a page size of 4 KB, this is equivalent to 16 TB of memory, the oracle validated rpm value for this parameter is 1073741824 which is equivalent to 16TB of memory. The system default setting and the oracle validated rpm value for this parameter, both are much higher than the physical memory supported on an x86-64 architecture.

semaphores - At a broad level semaphores are controlling mechanisms by which multiple processes can have access to the same resource in a logical organised manner.

Semaphores are used by Oracle for resource management. They serve as a post/wait mechanism by enqueues and writers for events such as free buffer waits. These semaphores are allocated to oracle at the time of instance startup by the linux kernel. Oracle processes use these semaphores to access system resources by waiting on the semop() system call. Semaphores can be set by the sysctl command or in the /etc/sysctl.conf file.

Semaphore limits can be set using the ipcs -ls command.

The output of this command is

Semaphore Limits

max number of arrays    = 128

max semaphores per array = 250

max semaphores system wide = 32000

max ops per semop call = 100

semaphore max value = 32767

The kernel.sem parameter is used to control the number of semaphores in the system. Thus

kernel.sem = 250 32000 100 128

These values correspond to semmsl, semmns, semopm and semmni parameters respectively.

semmns is the total number of semaphores permitted in the linux system.

semmsl sets the maximum number of semaphores per set and semmni sets the number of semaphore sets. 

Thus the number of semaphores that can be allocated in the system is the minimum of semmns and (semmsl * semmni). Thus the product of the system default values for semmsl (250) and semmni (128) is exactly equal to the value set for semmns (32000). Although the oracle recommended value for semmni is 142, this will get overridden by the semmns parameter. 

semopm sets the number of semaphore operations that can be performed by the semop() system call. This system call can set up multiple semaphores in a single call. The recommended setting for this value is 100. 


References
Pro Oracle 11g RAC on Linux : Steve Shaw and Martin Bach

Thought for the day
The secret of getting ahead is getting started
--Unknown

No comments:

Post a Comment