SMA and LLA Guide : Creating and running SMA applications : Creating SMA applications - overview : Modifying shared memory kernel parameters - overview
  
Modifying shared memory kernel parameters - overview
Shared memory is allocated in segments. The shared memory system parameters control the maximum size and number of segments allowed on your system.
Typically solidDB® uses 32 MB segment sizes.
The shared memory parameters and their management mechanisms depend on the system. In Linux and UNIX environments, you may need to address the type of kernel parameters described below.
Important: This section and the sections below discuss only the requirements set by solidDB®. Other processes running on the same system may require higher limit values.
Maximum size of a shared memory segment
Typically you do not need to modify the default system setting. This is because the solidDB® segment size of 32 MB is considerably small.
Maximum number of shared memory segments in a system/process
– Because solidDB® allocates most of the segments in 32 MB, you may need more segments than allowed by your system by default, especially if you have a large database.
The maximum number of shared memory segments must be at least the solidDB® process size in MB divided by 32.
For example, for a process size of 1 GB (1024 MB), at least 32 segments are needed.
– Set the maximum number of segments to a clearly higher value than required by your database size. A higher value has no side effects.
– solidDB® uses only one process; if your environment requires you to set the maximum number of segments for a process and for the system separately, you can use the same value for both.
Maximum total size of all shared memory segments
The total combined size of all shared memory segments depends on the size of your database and availability of disk space.
Note In addition to this kernel parameter, the maximum total size of shared memory used by solidDB® is controlled with the solidDB® parameter MaxSharedMemorySize (in the [SharedMemoryAccess] section of the solid.ini file) as follows:
– 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.
Example 1
If the system has 2 GB of memory and MaxSharedMemorySize is set to 0, solidDB® uses maximum of 2 GB of memory. If the kernel parameter for maximum total size of all shared memory segments is then set to 1 GB, solidDB® runs out of memory when the 1 GB is reached.
Example 2
If the system has 2 GB of memory and MaxSharedMemorySize is set to 500M, solidDB® never uses more than 500 MB of memory. As long as the kernel parameter for maximum total size of all shared memory segments is set to 500 MB or higher, solidDB® never runs out of memory. It is recommended to set the value to a higher value than the memory required by solidDB®.
Shared memory kernel parameters for SMA on AIX
On AIX systems, the shared memory kernel parameters do not need to be modified. The upper limits are defined for the AIX IPC mechanisms, which are not configurable. The shared memory limits are allocated and deallocated dynamically as needed, so that the memory requirements always depend on the current system usage.
Important: Do not set the page space allocation policy to early page space allocation. Instead, use the deferred (default) or late space allocation policy.
Modifying shared memory kernel parameters for SMA on HP‑UX
The default values for shared memory kernel parameters on HP-UX may not be sufficient for running a SMA application. The kernel parameter values can be changed dynamically using the kctune command.
Before you begin
You must have root authority to modify shared memory kernel parameters.
About this task
The following steps show how to set shared memory kernel parameters on HP-UX. 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 HP-UX environments, you may need to modify the following shared memory kernel parameters:
shmmni — Maximum number of shared memory segments on the system
shmseg — Maximum number of shared memory segments attached to a process
shmmax — Maximum size of a single shared memory segment (bytes)
Procedure
1 View the shared memory kernel parameters to determine if there are any necessary changes required for your system.
View the shmmni parameter:
kctune -v shmmni
Tunable             shmmni
Description         Maximum number of shared memory
                    segments on the system
Module              vm_asi
Current Value       400 [Default]
Value at Next Boot  400 [Default]
Value at Last Boot  400
Default Value       400
Constraints         shmmni >= 3
                    shmmni <= 32768
                    shmmni >= shmseg
Can Change          Immediately or at Next Boot
View the shmseg parameter:
kctune -v shmseg
Tunable             shmseg
Description         Maximum number of shared memory segments
                    attached to a process
Module              vm_asi
Current Value       300 [Default]
Value at Next Boot  300 [Default]
Value at Last Boot  300
Default Value       300
Constraints         shmseg >= 1
                    shmseg <= shmmni
Can Change          Immediately or at Next Boot
View the shmmax parameter:
kctune -v shmmax
Tunable             shmmax
Description         Maximum size of a shared memory segment
                    (bytes)
Module              vm_asi
Current Value       1073741824 [Default]
Value at Next Boot  1073741824 [Default]
Value at Last Boot  1073741824
Default Value       1073741824
Constraints         shmmax >= 2048
                    shmmax <= 4398046511104
Can Change          Immediately or at Next Boot
Minimum requirements of shared memory kernel parameters for SMA (HP-UX)
Parameter
Description
When to modify
Notes
shmmni
Maximum number of shared memory segments on the 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.
shmseg
Maximum number of shared memory segments attached to a process
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.
Because solidDB® uses only 1 process, the value of shmmni and shmseg can be the same.
shmmax
Maximum size of a single shared memory segment (bytes)
If the value is smaller than 32768 KB (32 MB)
Setting this parameter to a higher value has no side effects.
2 To modify the parameters, use the kctune command. For example, to set the maximum number of shared memory segments to 1024, use the following command:
kctune shmmni=1024
The parameter value change becomes effective immediately and stays effective after reboot.
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 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