SunSolve Internal

Infodoc ID   Synopsis   Date
6328   All about Shared Memory Parameters in 2.X   9 Mar 2000

Description Top

What are the various shared memory tunable parameters?  What do they mean?
What are their defaults?  How are they changed?  How are they checked?

The Solaris 2.X kernel comes configured with defaults for shared memory
parameters which may not be enough for large applications, such as databases.
Many database manufacturers, such as Oracle, Sybase and Informix require that
shared memory parameters be increased to handle their system.  In general,
any program which makes shared memory system service calls will be affected.

This document provides the default and maximum values for the shared memory
tunable parameters, and supplies a description of each of them.  In most
cases, the listed maxima is the largest value which will fit in the data type
of the parameter;  they are not intended as suggested settings.  Specific
maxima can not be provided in a general document, as they are dependent upon
the hardware resources available on the system being tuned, and on the
application(s) making use of them.

Some parameters list more than one value in the 'Max' column.  This indicates
that the maximum value changed at some point.  In these instances, each maxima
will be followed by an indication of which versions of Solaris it applies to.


Name	Default		Max		Description
------	---------------	--------------- -------------------------------------

shmmax	1048576 (1Meg)	4294967295	Limits the maximum size of a shared
			(4GB)		memory segment, which is the largest
			2.5.1 or	value which can be requested of
			higher		shmget(2).  Setting this value high
					does not hurt anything, as the
			2147483647	resource it controls is not
			(2GB)		pre allocated;  it is allocated on
			2.5 or lower	demand.
					

shmmin	1		4294967295	Limits the minimum size of a shared
			2.5.1 or	memory segment.  There is no need to
			higher		change this from the default, as doing
					so will only break code which attempts
			2147483647	to allocate smaller amounts than the
			2.5 or lower	new shmmin value allows.


shmseg	6		32767		Limits the maximum number of shared
			(32k)		memory segments per process.  It
					serves as a high water mark, checked
					before another segment is allocated.
					No resources are pre allocated based on
					value.  If a value larger than 32k is
					specified, a NOTICE will be generated
					and the value will be set to 32k.


shmmni	100		2147483647	Defines the number of shared memory
			(2GB)		identifiers available on the system.
					Every shared memory segment has an
					associated identifier, returned from
					shmget(2).  Approximately 120 bytes
					of kernel memory is pre allocated  for
					each identifier;  the exact amount is
					Solaris release dependent.  In release
					2.5 and higher, shared memory
					identifiers are prevented from taking
					more than 1/4 of all kernel memory;
					if shmmni is set to a value which
					would surpass this limit, a WARNING is
					generated, and the shared memory
					module is not be loaded.


Setting Shared Memory Parameters
--------------------------------

Shared memory parameters are changed by editing the /etc/system file and
adding lines of the form:

  set shmsys:shminfo_variable = value

where 'variable' is one of the entries from the name column, above.  For
example, the entry:

  set shmsys:shminfo_shmmni = 150

would change shmmni to 150.

After changing the /etc/system file, reboot the system to have it take
effect.


Checking Shared Memory Parameters
---------------------------------

InterProcess Communication (IPC) parameters can be checked via the sysdef
command:

  $ sysdef -i

Toward the bottom of the output, there will a section which should look
something like the following:

*
* IPC Shared Memory
*
1048576	max shared memory segment size (SHMMAX)
     1	min shared memory segment size (SHMMIN)
   100	shared memory identifiers (SHMMNI)
     6	max attached shm segments per process (SHMSEG)

The values at the left will reflect either the default value, or the value
specified in the /etc/system file, if that parameter has been modified.

If the values displayed are all zero, load the shared memory module:

  # modload -p sys/shmsys

and run sysdef -i again.  


If, after the parameters have been adjusted, the machine has been
rebooted, no errors were displayed on startup and loading the shmsys
module shows the parameters to be set to the desired value and an
application or database still fails to start then the failing application
should be trussed from startup.  The truss utility will show system
calls and should identify the system call that the application is
failing on.  The error number returned from the failing system call
can then be checked in the appropriate man page for the failed system
call itself (i.e. in the shmget or shmop or shmctl man page for
example) to help narrow down what the problem is.  Further information
on the truss utility can be found in Infodoc 14141.


Other Information Sources
-------------------------

More information on shared memory parameters can be obtained at:

http://www.sun.com/sunworldonline/swol-09-1997/swol-09-insidesolaris.html
Bug ID n/a
Patch ID n/a
Product Area Kernel
Product Config
OS Solaris 2.X
Release n/a
Hardware All

Top

SunWeb Home SunWeb Search SunSolve Home Simple Search

Sun Proprietary/Confidential: Internal Use Only
Feedback to SunSolve Team