Salesforce

How to configure shared memory on UNIX

« Go Back

Information

 
TitleHow to configure shared memory on UNIX
URL NameP18482
Article Number000133104
EnvironmentProduct: Progress OpenEdge
Version: All supported versions
OS: UNIX, Linux
Question/Problem Description
How to configure shared memory on UNIX
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution

How do I configure shared memory?

Shared memory uses a set of parameters similar to the ones for message queues. The Squid DISKD implementation uses one shared memory area for each cache_dir. Each shared memory area is about 800 kilobytes in size. You will need to modify your system's shared memory parameters:

SHMSEG: Maximum number of shared memory segments per process.
SHMMNI: Maximum number of shared memory segments for the whole system.
SHMMAX: Largest shared memory segment size allowed.
SHMALL: Total amount of shared memory that can be used.
FreeBSD: Your kernel must have options SYSVSHM

Kernel parameters can be set as follows. This is just an example. Ensure the values are appropriate for your system and consult man pages.

options SHMSEG=16 # max shared memory id's per process
options SHMMNI=32 # max shared memory id's per system
options SHMMAX=2097152 # max shared memory segment size (bytes)
options SHMALL=4096 # max amount of shared memory (pages)

 

Name

Description

Reasonable values

SHMMAX

Maximum size of shared memory segment (bytes)

250kB + 8.2 kB * shared_buffers + 14.2 kB * max_connections or infinity

SHMMIN

Minimum size of shared memory segment (bytes)

1024

SHMALL

Total amount of shared memory available (bytes or pages)

if bytes: 
same as SHMMAX;
if pages: 
ceil(SHMMAX/PAGE_SIZE)

SHMSEG

Maximum number of shared memory segments per process

only 1 segment should be needed per database, the default value is usually much higher

SHMMNI

Maximum number of shared memory segments system-wide

like SHMSEG plus room for other applications

SEMMNI

Maximum number of semaphore identifiers (i.e., sets)

>= ceil(max_connections / 16)

SEMMNS

Maximum number of semaphores system-wide

ceil(max_connections / 16) * 17 + room for other applications

SEMMSL

Maximum number of semaphores per set

>= 17

SEMMAP

Number of entries in semaphore map

see text

SEMVMX

Maximum value of semaphore

>= 255 (The default is often 32767, don't change unless asked to.)

HP-UX

The default settings tend to suffice for normal installations.
On HP-UX 10, factory default for SEMMNS is 128, which might be too low for larger database sites.

IPC parameters can be set in the System Administration Manager (SAM) under:
Kernel Configuration->Configurable Parameters.
Hit Create A New Kernel when finished.

Linux

On Linux, the SHMSEG value inherits value from SHMMNI and by default has sufficient value (4096).
The default shared memory limit (both SHMMAX and SHMALL) is set to 33554432 (32 MB) in 2.2 kernels.

It can be changed in the proc file system (without reboot). For example, to allow 128 MB:

$ echo 134217728 >/proc/sys/kernel/shmall
$ echo 134217728 >/proc/sys/kernel/shmmax

To make these changes permanent (after reboot), edit /etc/sysctl.conf and add lines like the following to it:

kernel.shmall = 134217728
kernel.shmmax = 134217728

To set the semaphore parameters in CentOS/RedHat:
- to review current values:
cat /proc/sys/kernel/sem
250 32000 32 128
These values represent SEMMSL, SEMMNS, SEMOPM, and SEMMNI
Alternatively run ipcs -ls

 - to set new values:
echo 250 32000 100 128 > /proc/sys/kernel/sem
or 
sysctl -w kernel.sem="250 32000 100 128"

To make the change permanent, add or change the following line in the file /etc/sysctl.conf
echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf

For your specific Linux flavor consult the OS manual.

Other parameters are sufficiently sized for any application. To review the kernel values currently used view:
/usr/src/linux/include/asm-xxx/shmparam.h and
/usr/src/linux/include/linux/sem.h.

MacOS X

Edit the file /System/Library/StartupItems/SystemTuning/SystemTuning and change the following values:

sysctl -w kern.sysv.shmmax
sysctl -w kern.sysv.shmmin
sysctl -w kern.sysv.shmmni
sysctl -w kern.sysv.shmseg
sysctl -w kern.sysv.shmall

These values have the same meanings on MacOS X as those listed for previous operating systems.

SCO OpenServer

In the default configuration, only 512 kB of shared memory per segment is allowed, which is about enough for -B 24 -N 12. To increase the setting, first change directory to /etc/conf/cf.d. To display the current value of SHMMAX, in bytes, run

./configure -y SHMMAX

To set a new value for SHMMAX, run:

./configure SHMMAX=value

where value is the new value to set (in bytes). After setting SHMMAX, rebuild the kernel

./link_unix

and reboot.

Solaris

At least in version 2.6, the default maximum size of a shared memory segments is too low. The relevant settings can be changed in /etc/system, for example:

set shmsys:shminfo_shmmax=0x2000000
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=256
set shmsys:shminfo_shmseg=256
set semsys:seminfo_semmap=256
set semsys:seminfo_semmni=512
set semsys:seminfo_semmns=512
set semsys:seminfo_semmsl=32

Reboot for the changes to take effect.

UnixWare

On UnixWare 7, the maximum size for shared memory segments is 512 kB in the default configuration. This is enough for about -B 24 -N 12.

To display the current default, minimum and maximum values, in bytes of SHMMAX, run

/etc/conf/bin/idtune -g SHMMAX

To set a new value for SHMMAX, run:

/etc/conf/bin/idtune SHMMAX value

where value is the new value you want to use (in bytes).

After setting SHMMAX, rebuild the kernel

/etc/conf/bin/idbuild -B

Reboot for the changes to take effect.

AIX

Those kernel parameters are dynamically adjusted on AIX, as needed by the kernel. See the appropriate AIX® operating system documentation for more information:

http://publib16.boulder.ibm.com/pseries/en_US/infocenter/base/aix.htm

So, AIX kernel dynamically allocates shared memory and semaphore resources, hence the only way to run out of these resources on AIX would be to use up all available memory on the system.

Workaround
Notes
Keyword Phrase
Last Modified Date9/24/2020 6:14 PM

Powered by