NetBSD-Users archive

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

Re: postgresql 8.4 semaphores ...



On 06/06/10 10:39, Malcolm Herbert wrote:
I guess I don't really understand the nature of the things I'm tweaking here 
... http://www.postgresql.org/docs/8.4/static/kernel-resources.html offers some 
NetBSD-specific hints on how to change or set this in the kernel config:

|NetBSD
|OpenBSD
|
|    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?

It tweaks the number of entries in a semaphore map; I don't think it is related to your memory exhaustion problem.

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 ...

Hmm, I don't think that the max number of sets or identifiers is the problem here, but rather the maximum number of memory that could be shared for locking. Do you still have ENOSPC when you increase 'kern.ipc.shmmaxpgs'?

--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost




Home | Main Index | Thread Index | Old Index