SMA and LLA Guide : Creating and running SMA applications : Creating SMA applications - overview : Modifying shared memory kernel parameters for SMA on Linux
  
Modifying shared memory kernel parameters for SMA on Linux
The default values for shared memory kernel parameters on Linux may not be sufficient for running a SMA application. To modify the shared memory kernel parameters on Linux, edit the /etc/sysctl.conf file.
Before you begin
You must have root authority to modify kernel parameters.
About this task
The following steps show how to update kernel parameters on Red Hat and SUSE Linux using the shared memory requirements set by solidDB®. Other processes running on the same system may require higher limit values.
In Linux environments, you may need to modify the following shared memory parameters:
SHMMNI — Maximum number of shared memory segments on a system
SHMMAX — Maximum size of a single shared memory segment on a system
SHMALL — Maximum allocation of shared memory pages on a system
Procedure
1 Run the ipcs -l command.
For example:
Note Comments have been added following the // to show what the parameter names are. # ipcs -l
Shared Memory Limits
max number of segments = 4096                 // SHMMNI
max seg size (kbytes) = 32768                 // SHMMAX
max total shared memory (kbytes) = 8388608    // SHMALL
2 Analyze the output to determine if there are any necessary changes required for your system.
Minimum requirements of shared memory kernel parameters for SMA (Linux)
Kernel parameter
Description
When to modify
Notes
SHMMNI
Maximum number of shared memory segments on a system
If the value is smaller than the solidDB® process size (MB) divided by 32
For example, for a process size of 1 GB (1024 MB), at least 32 segments are needed.
Set this parameter to a clearly higher value than required by your database size; a higher value has no side effects.
SHMMAX
Maximum size of a single shared memory segment on a system
If the value is smaller than 32768 KB (32 MB)
Setting this parameter to a higher value has no side effects.
Note The ipcs output has converted SHMMAX kilobytes. The kernel requires the SHMMAX value in bytes.
SHMALL
Maximum allocation of shared memory pages on a system
If MaxSharedMemorySize=0 and the value of this parameter is smaller than the maximum size of the physical memory size of your computer in KB divided by 4.
or
If the value of this parameter is smaller than the value (in KB divided by 4) you have set with the parameter MaxSharedMemorySize.
The value set with the MaxSharedMemorySize parameter takes precedence over the value set with the kernel parameter. Thus, the value set with the MaxSharedMemorySize parameter must never be higher than the value set with the kernel parameter.
By default, solidDB® is set to use the maximum size of the physical memory of the computer (MaxSharedMemorySize=0). Thus, the default value set with the kernel parameter may be too low.
Note The ipcs output has converted SHMALL into kilobytes. The kernel requires the SHMALL value as a number of pages.
3 To modify these kernel parameters, edit the /etc/sysctl.conf file.
If the file does not exist, create it. For example, create a file with the following lines:
#Example shmmni for a 1 GB database
kernel.shmmni=400
#Example shmmax for a 64-bit system
kernel.shmmax=1073741824
#Example shmall for 16 GB memory
kernel.shmall=3774873
4 Run sysctl with -p parameter to load in sysctl settings from the default file /etc/sysctl.conf.
sysctl -p
5 Make the changes effective after every reboot.
In SUSE Linux: make boot.sysctl active.
In Red Hat Linux: the rc.sysinit initialization script reads the /etc/sysctl.conf file automatically.
What to do next
If you modified the shared memory parameters after getting an out of memory error, you may need to clear hanging shared memory segments with the ipcrm command. For more details, see Troubleshooting SMA.
Modifying shared memory kernel parameters for SMA on Solaris
The default values for shared memory kernel parameters on Solaris 10 may not be sufficient for running a SMA application. In Solaris 10, the shared memory kernel parameter values can be changed dynamically with the Solaris resource control facilities.
Before you begin
You must have root authority to modify shared memory parameters.
About this task
The following steps show how to set shared memory kernel parameters on Solaris 10. The minimum values that are shown according to the requirements set by solidDB®. Other processes running on the same system may require higher limit values.
In Solaris environments, you may need to modify the following shared memory parameters:
max-shm-ids — Maximum number of shared memory segments on a system
max-shm-memory — Maximum size of all shared memory segments on a system (MB)
In the examples below, the operating system default project is used.
Procedure
1 View the shared memory parameters to determine if there are any necessary changes required for your system.
View the project.max-shm-ids parameter:
prctl -n project.max-shm-ids -i project default
project: 3: default
NAME   PRIVILEGE     VALUE   FLAG  ACTION       RECIPIENT
project.max-shm-ids
        privileged     128      -  deny         -
        system       16.8M    max  deny         -
View the project.max-shm-memory parameter:
prctl -n project.max-shm-memory -i project default
project: 3: default
NAME   PRIVILEGE     VALUE   FLAG  ACTION       RECIPIENT
project.max-shm-memory
        privileged  62.7GB      -  deny         -
        system      16.0EB    max  deny
Minimum requirements of shared memory kernel parameters for SMA (Solaris)
Parameter
Description
When to modify
Notes
max-shm-ids
Maximum number of shared memory segments on a system
If the value is smaller than the solidDB® process size (MB) divided by 32
For example, for a process size of 1 GB (1024 MB), at least 32 segments are needed.
Set this parameter to a clearly higher value than required by your database size; a higher value has no side effects.
max-shm-memory
Maximum size of all shared memory segments on a system
If MaxSharedMemorySize=0 and the memory size set with this parameter is smaller than the maximum size of the physical memory size of your computer.
or
If the memory size set with this parameter is smaller than the memory size you have set with the parameter MaxSharedMemorySize.
Setting this parameter to a higher value has no side effects.
The value set with the MaxSharedMemorySize parameter takes precedence over the value set with the kernel parameter. Thus, the value set with the MaxSharedMemorySize parameter must never be higher than the value set with the kernel parameter.
By default, solidDB® is set to use the maximum size of the physical memory of the computer (MaxSharedMemorySize=0). Thus, the default value set with the kernel parameter may be too low.
2 To modify the parameters, use the prctl command.
For example, to set the maximum number of shared memory segments to 1024, use the following command:
prctl -n project.max-shm-ids -r -v 1024 -i project default
3 Make the changes effective after every reboot.
/usr/sbin/projmod -sK "project.max-shm-ids=(privileged,1024,deny)" default
What to do next
If you modified the shared memory parameters after getting an out of memory error, you may need to clear hanging shared memory segments with the ipcrm command. For more details, see Troubleshooting SMA.
See also
Creating SMA applications - overview