mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.5 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=600M:\
 | |
|           :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.
 | |
| 
 | |
| To increase the number of buffers supported by the postmaseter, increase
 | |
| SHMMAXPGS by 1024 for every additional 4MB of shared memory:
 | |
| 
 | |
| /sys/sys/shm.h:69:#define       SHMMAXPGS       1024    /* max hardware pages...
 | |
| 
 | |
| The default setting of 1024 is for a maximum of 4MB of shared memory.
 | |
| 
 | |
| 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.
 | |
| 
 | |
| /sys/i386/i386/i386_param.c:28:#define  SYSPTSIZE 0        /* dynamically...
 | |
| 
 | |
| 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:
 | |
| 
 | |
| /* Configuration parameters */
 | |
| #ifndef SEMMNI
 | |
| #define SEMMNI  10              /* # of semaphore identifiers */
 | |
| #endif
 | |
| #ifndef SEMMNS
 | |
| #define SEMMNS  60              /* # of semaphores in system */
 | |
| #endif
 | |
| #ifndef SEMUME
 | |
| #define SEMUME  10              /* max # of undo entries per process */
 | |
| #endif
 | |
| #ifndef SEMMNU
 | |
| #define SEMMNU  30              /* # of undo structures in system */
 | |
| #endif
 | |
| 
 | |
| Set the values you want in your kernel config file, e.g.:
 | |
| 
 | |
| options "SEMMNI=40"
 | |
| options "SEMMNS=240"
 | |
| options "SEMUME=40"
 | |
| options "SEMMNU=120"
 | |
| 
 |