NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: postgresql 8.4 semaphores ...

On Sun, Jun 06, 2010 at 09:18:06AM +0200, Jean-Yves Migeon wrote:
|>Has anyone managed to get PostreSQL working with this combination?
|Try increasing kern.ipc.shmmax.

I'm assuming that's a byte value, so raised it to 1GB without any benefit ... 

I guess I don't really understand the nature of the things I'm tweaking here 
... offers some 
NetBSD-specific hints on how to change or set this in the kernel config:

|    The options SYSVSHM and SYSVSEM need to be enabled when the kernel is 
compiled. (They are by default.) The maximum size of shared memory is 
determined by the option SHMMAXPGS (in pages). The following shows an example 
of how to set the various parameters (OpenBSD uses option instead):
|    options        SYSVSHM
|    options        SHMMAXPGS=4096
|    options        SHMSEG=256
|    options        SYSVSEM
|    options        SEMMNI=256
|    options        SEMMNS=512
|    options        SEMMNU=256
|    options        SEMMAP=256
|    You might also want to configure your kernel to lock shared memory into 
RAM and prevent it from being paged out to swap. This can be accomplished using 
the sysctl setting kern.ipc.shm_use_phys. 

... so which sysctl variables would map to these?

kern.ipc.sysvsem = 1            # options SYSVSEM
kern.ipc.sysvshm = 1            # options SYSVSHM
kern.ipc.shmmax = 1073741824
kern.ipc.shmseg = 256           # options SHMSEG=256
kern.ipc.shmmaxpgs = 4096       # options SHMMAXPGS=4096
kern.ipc.semmni = 256           # options SEMMNI=256
kern.ipc.semmns = 512           # options SEMMNS=512
kern.ipc.semmnu = 256           # options SEMMNU=256

... can't seem to find an equivalent for SEMMAP however ... is that important?

I've added these to /etc/sysctl.conf and rebooted, but noticed that the shmmax 
value isn't 1GB as I'd set it, but around 16MB:

|mawrth[~] 5v>: sysctl -a | sort | grep kern.ipc
|kern.ipc.msgmni = 40
|kern.ipc.msgseg = 2048
|kern.ipc.semmni = 256
|kern.ipc.semmns = 512
|kern.ipc.semmnu = 256
|kern.ipc.shm_use_phys = 0
|kern.ipc.shmmax = 16777216
|kern.ipc.shmmaxpgs = 4096
|kern.ipc.shmmni = 128
|kern.ipc.shmseg = 256
|kern.ipc.sysvmsg = 1
|kern.ipc.sysvsem = 1
|kern.ipc.sysvshm = 1

still, postgresql fails to start with an error complaining about semaphores 
again (instead of memory):

|FATAL:  could not create semaphores: No space left on device
|DETAIL:  Failed system call was semget(31, 17, 03600).
|HINT:  This error does *not* mean that you have run out of disk space.
|       It occurs when either the system limit for the maximum number of 
semaphore sets (SEMMNI), or the system wide maximum number of semaphores 
(SEMMNS), would be exceeded.  You need to raise the respective kernel 
parameter.  Alternatively, reduce PostgreSQL's consumption of semaphores by 
reducing its max_connections parameter (currently 13).

starting to tear out my hair here ...


Malcolm Herbert                                This brain intentionally                                                left 

Home | Main Index | Thread Index | Old Index