postgresql/doc/FAQ_BSDI
2001-02-16 19:43:52 +00:00

82 lines
2.6 KiB
Plaintext

This outlines modifications to BSD/OS for running PostgreSQL:
1) How to increase resource limits
2) How to increase the number of shared memory buffers
3) How to increasing the number of semaphores
Bruce Momjian (pgman@candle.pha.pa.us) 2000-07-7
---------------------------------------------------------------------------
1) To increase the amount of malloc'ed memory and files opened by
PostgreSQL, add this:
:datasize-cur=256M:\
:openfiles-cur=256:
to your /etc/login.conf file.
---------------------------------------------------------------------------
2a) By default, only 4MB of shared memory is supported by BSDI. Keep in
mind that shared memory is not pageable. It is locked in RAM.
The shared memory parameters are:
#define SHMMAX /* max shared memory segment size (bytes) */
#define SHMMIN /* min shared memory segment size (bytes) */
#define SHMMNI /* max number of shared memory identifiers */
#define SHMSEG /* max shared memory segments per process */
#define SHMALL /* max amount of shared memory (pages) */
To increase the number of buffers supported by the postmaseter, add the
following to your kernel config file. A SHMALL value of 1024
represents 4MB of shared memory. Increase it accordingly:
options "SHMALL=4096"
options "SHMMAX=\(SHMALL*PAGE_SIZE\)"
For those running 4.1 or later, just recompile the kernel and reboot.
For those running earlier releases, see step 2b.
---------------------------------------------------------------------------
2b) For 4.01 and earlier, use bpatch to find the sysptsize value for
the current kernel. This is computed dynamically at bootup.
$ bpatch -r sysptsize
0x9 = 9
Next, change SYSPTSIZE to a hard-coded value. Use the bpatch value,
plus add 1 for every additional 4MB of shared memory you desire.
options "SYSPTSIZE=13"
sysptsize can not be changed by sysctl on the fly.
---------------------------------------------------------------------------
3) How to increasing the number of semaphores.
You may need to increase the number of sysv semaphores. By default,
PostgreSQL allocates 32 semaphores, one for each backend connection.
This is just over half the default system total of 60.
The defaults are in /sys/sys/sem.h:
#define SEMMNI 10 /* # of semaphore identifiers */
#define SEMMNS 60 /* # of semaphores in system */
#define SEMUME 10 /* max # of undo entries per process */
#define SEMMNU 30 /* # of undo structures in system */
Set the values you want in your kernel config file, e.g.:
options "SEMMNI=40"
options "SEMMNS=240"
options "SEMUME=40"
options "SEMMNU=120"