11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.41 2000/12/03 14:36:45 petere Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.42 2000/12/17 11:22:00 petere Exp $
33-->
44
55<Chapter Id="runtime">
@@ -1300,11 +1300,12 @@ env PGOPTIONS='-c geqo=off' psql
13001300 limits of the IPC resources then the postmaster will refuse to
13011301 start up and should leave a marginally instructive error message
13021302 about which problem was encountered and what needs to be done
1303- about it. The relevant kernel parameters are named
1303+ about it. (See also <xref linkend="postmaster-start-failures">.)
1304+ The relevant kernel parameters are named
13041305 consistently across different systems; <xref
13051306 linkend="sysvipc-parameters"> gives an overview. The methods to
13061307 set them, however, vary; suggestions for some platforms are given
1307- below. Be aware that you will have to reboot your
1308+ below. Be aware that you willprobably have to reboot your
13081309 machine at least, possibly even recompile the kernel, to change these
13091310 settings.
13101311 </para>
@@ -1332,13 +1333,13 @@ env PGOPTIONS='-c geqo=off' psql
13321333 <row>
13331334 <entry><varname>SHMMIN</></>
13341335 <entry>Minimum size of shared memory segment (bytes)</>
1335- <entry>1 (at most144 )</>
1336+ <entry>1 (at mostabout 256 kB )</>
13361337 </row>
13371338
13381339 <row>
13391340 <entry><varname>SHMSEG</></>
13401341 <entry>Maximum number of shared memory segments per process</>
1341- <entry>must be at least 3 , but the default is much higher</>
1342+ <entry>only 1 segment is needed , but the default is much higher</>
13421343 </row>
13431344
13441345 <row>
@@ -1356,13 +1357,13 @@ env PGOPTIONS='-c geqo=off' psql
13561357 <row>
13571358 <entry><varname>SEMMNS</></>
13581359 <entry>Maximum number of semaphores system-wide</>
1359- <entry>max_connectionsrounded up to multiple of 16, + room for other applications</>
1360+ <entry>ceil( max_connections/ 16) * 17 + room for other applications</>
13601361 </row>
13611362
13621363 <row>
13631364 <entry><varname>SEMMSL</></>
13641365 <entry>Maximum number of semaphores per set</>
1365- <entry>>=16 </>
1366+ <entry>>=17 </>
13661367 </row>
13671368
13681369 <row>
@@ -1396,34 +1397,36 @@ env PGOPTIONS='-c geqo=off' psql
13961397 estimate the required segment size as the number of buffers times
13971398 the block size (8192 kB by default) plus ample overhead (at least
13981399 half a megabyte). Any error message you might get will contain the
1399- size of the failed allocation. (<productname>Postgres</> will
1400- actually use three shared memory segments, but the size of the
1401- other two is negligible for this consideration.)
1400+ size of the failed allocation.
14021401 </para>
14031402
14041403 <para>
14051404 Less likely to cause problems is the minimum size for shared
1406- memory segments (<varname>SHMMIN</>), whichmust be atleast 144
1407- for <productname>Postgres</> (it's usually just 1), and the
1408- maximum number of segments system-wide (<varname>SHMMNI</>, as
1409- mentioned, 3 are needed ) or per-process (<varname>SHMSEG</>,
1410- ditto). Some systems also have a limit on the total amount of
1411- shared memory in the system; see theplatform-specific
1412- instructions below.
1405+ memory segments (<varname>SHMMIN</>), whichshould be atmost
1406+ somewhere around 256 kB for <productname>Postgres</> (it is
1407+ usually just 1). The maximum number of segments system-wide
1408+ (<varname>SHMMNI</> ) or per-process (<varname>SHMSEG</>) should
1409+ not cause a problem unless your system has them set to zero. Some
1410+ systems also have a limit on thetotal amount of shared memory in
1411+ the system; see the platform-specific instructions below.
14131412 </para>
14141413
14151414 <para>
14161415 <productname>Postgres</> uses one semaphore per allowed connection
1417- (<option>-N</> option), in sets of 16. The maximum number of
1418- semaphores in the system is set by <varname>SEMMNS</>, which
1419- consequently must be at least as high as the connection setting.
1420- The parameter <varname>SEMMNI</> determines the limit on the
1421- number of semaphore sets that can exist on the system at one time.
1422- Hence this parameter must be at least
1423- <literal>ceil(max_connections / 16)</>. Lowering the number of
1424- allowed connections is a temporary workaround for failures, which
1425- are usually confusingly worded <quote><errorname>No space left on
1426- device</></>, from the function <function>semget()</>.
1416+ (<option>-N</> option), in sets of 16. Each such set will also
1417+ contain a 17th semaphore which contains a <quote>magic
1418+ number</quote>, to avoid collision with semaphore sets used by
1419+ other applications. The maximum number of semaphores in the system
1420+ is set by <varname>SEMMNS</>, which consequently must be at least
1421+ as high as the connection setting plus one extra for each 16
1422+ allowed connections (see the formula in <xref
1423+ linkend="sysvipc-parameters">. The parameter <varname>SEMMNI</>
1424+ determines the limit on the number of semaphore sets that can
1425+ exist on the system at one time. Hence this parameter must be at
1426+ least <literal>ceil(max_connections / 16)</>. Lowering the number
1427+ of allowed connections is a temporary workaround for failures,
1428+ which are usually confusingly worded <quote><errorname>No space
1429+ left on device</></>, from the function <function>semget()</>.
14271430 </para>
14281431
14291432 <para>
@@ -1441,7 +1444,7 @@ env PGOPTIONS='-c geqo=off' psql
14411444
14421445 <para>
14431446 The <varname>SEMMSL</> parameter, which determines how many
1444- semaphores can be in a set, must be at least16 for
1447+ semaphores can be in a set, must be at least17 for
14451448 <productname>Postgres</>.
14461449 </para>
14471450
@@ -1558,11 +1561,11 @@ options SEMMAP=256
15581561
15591562
15601563 <varlistentry>
1561- <term>HPUX </>
1564+ <term>HP-UX </>
15621565 <listitem>
15631566 <para>
15641567 The default settings tend to suffice for normal installations.
1565- On <productname>HPUX </> 10, the factory default for
1568+ On <productname>HP-UX </> 10, the factory default for
15661569 <varname>SEMMNS</> is 128, which might be too low for larger
15671570 database sites.
15681571 </para>
@@ -1581,11 +1584,23 @@ options SEMMAP=256
15811584 <term>Linux</>
15821585 <listitem>
15831586 <para>
1584- System V IPC is enabled by default and sufficiently sized for
1585- most uses. The relevant parameters are in
1587+ The default shared memory limit (both
1588+ <varname>SHMMAX</varname> and <varname>SHMALL</varname>) is 32
1589+ MB in 2.2 kernels, but it can be changed in the
1590+ <filename>proc</filename> file system (without reboot). For
1591+ example, to allow 128 MB:
1592+ <screen>
1593+ <prompt>$</prompt> <userinput>echo 134217728 >/proc/sys/kernel/shmall</userinput>
1594+ <prompt>$</prompt> <userinput>echo 134217728 >/proc/sys/kernel/shmmax</userinput>
1595+ </screen>
1596+ You could put these commands into a script run at boot-time.
1597+ </para>
1598+
1599+ <para>
1600+ Other parameters are sufficiently sized for any application.
1601+ If you want to see for yourself look into
15861602 <filename>/usr/src/linux/include/asm-<replaceable>xxx</>/shmparam.h</>
1587- and <filename>/usr/src/linux/include/linux/sem.h</>. Be sure
1588- to do <command>make dep</> before rebuilding the kernel.
1603+ and <filename>/usr/src/linux/include/linux/sem.h</>.
15891604 </para>
15901605 </listitem>
15911606 </varlistentry>