Languages

Archived - Mac OS X Server v10.6: Adjusting Shared memory segment values

Mac OS X Server v10.6 client who access applications that use shm_open(2), sometimes called System V Shared Memory segments, may need to configure resources for shared memory. For example, postgres and other databases may require tuned allocations of these resources.

Shared memory segments in Mac OS X Server are configured via sysctl variables. These variables are:

  • kern.sysv.shmmax - Maximum size in bytes of all shared memory segments
  • kern.sysv.shmmin - Minimum shared memory segment size (bytes)
  • kern.sysv.shmmni - Maximum number of shared segments, system-wide
  • kern.sysv.shmseg - Maximum number of shared segments, per-process
  • kern.sysv.shmall - Maximum number of pages allocated to shared memory segments, system-wide

This article has been archived and is no longer updated by Apple.

Important: This article contains advanced configuration instructions intended for experienced server administrators. Changing these values may adversely affect server performance. In most cases, these values do not need to be adjusted when using Mac OS X Server v10.6.

Reading values

The defaults value of the variables listed above varies depending on the server hardware configuration. To read the default value for each setting, in Terminal use the sysctl command with the name of the variable in question. For example:

sysctl kern.sysv.shmmax

...will report the default value for the kern.sysv.shmmax variable.
 

Setting values

In order to use segments larger than 128 MB, hardware that supports the 64-bit kernel in Mac OS X Server v10.6 is recommended. To determine if your hardware supports the 64-bit kernel, see this article. When using the 64-bit kernel, the primary limitation for the size of shared memory segments is the amount of physical RAM in the server. When planning the amount of memory to allocate to shared memory segments, you must account for memory used by the system as a whole.

For example, your server might use:

512 MB - wired kernel memory
3.8 GB - resident memory in use by all applications not counting shared memory segments
1 GB - Shared memory regions
5.3 GB - sum of the above

In this example, at least 6 GB of physical RAM is required to support a single 1 GB shared memory region. Additionally, page tables and virtual memory require additional memory, so a 1 GB Shared Memory segment shared across 500 processes will require far more than 1 GB.

To change the values of the variables listed above, create the file /etc/sysctl.conf with lines of text in this format:

kern.sysv.shmmax=1073741824

The example above will increase the maximum amount of shared memory size to 1 GB (1073741824 bytes). Use a separate line to set the value for each variable that will be changed from the default.

After creating the file, restart the server so the new values take effect.

Last Modified: Aug 2, 2013
Helpful?
Yes
No
  • Last Modified: Aug 2, 2013
  • Article: HT4022
  • Views:

    8522
  • Rating:
    • 100.0

    (1 Responses)

Additional Product Support Information

Start a Discussion
in Apple Support Communities
See all questions on this article See all questions I have asked