Showing results for 
Search instead for 
Did you mean: 

Postgres Configuration

Leandro Lucena.
Occasional Contributor

Postgres Configuration

Hey Buddies,

I have a N4000 with 8GB RAM, HP-UX 11.00 64bits and Postgres 7.4 installed. This database is working fine because SHARED_BUFFER parameter is set to 127.500 (8k) on postgresql.conf file. That correspond exactly 1 GB of shared memory. But that value is not enough for my database, due that we have 8GB of memory. So when I try to change this value (increase SHARED_BUFFER), the DB do not start. Do someone know what kernel parameters that I have to change to solve this matter. See the Postgreslog and the /stand/system files below.
Note that it is set to 129.000 (just a little more then 127.500) and it is not working.

Best Regards for all, Leandro Lucena.


* Tunable parameters

bufpages 0
create_fastlinks 1
dbc_max_pct 8
max_mem_window 2
max_thread_proc 256
maxdsiz 2147483648
maxdsiz_64bit 4294967296
maxfiles 2048
maxfiles_lim 2048
maxswapchunks 8192
maxtsiz 0X40000000
maxuprc ((NPROC*8)/10)
maxusers 400
maxvgs 80
msgmap (MSGTQL+2)
msgmax 32768
msgmnb 65535
msgmni (NPROC)
msgseg 32767
msgssz 128
msgtql (NPROC)
ncallout 2064
nfile (15*NPROC+2048)
nflocks (NPROC)
ninode (8*NPROC+2048)
nkthread 2048
nproc (((10*MAXUSERS)/3)+128)
npty 300
nstrpty 60
nstrtel (MAXUSERS)
nswapdev 25
semmni (NPROC*2)
semmns (SEMMNI*2)
semmnu (NPROC-4)
semume 100
semvmx 32768
shmmax 34359738368
shmmni 1024
shmseg 1000
swapmem_on 0
timeslice 10


FATAL: could not create shared memory segment: Not enough space
DETAIL: Failed system call was shmget(key=5432001, size=1085841408, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory se
gment exceeded available memory or swap space. To reduce the request size (curre
ntly 1085841408 bytes), reduce PostgreSQL's shared_buffers parameter (currently
129000) and/or its max_connections parameter (currently 100).
The PostgreSQL documentation contains more information about shared memo
ry configuration.

A. Clay Stephenson
Acclaimed Contributor

Re: Postgres Configuration

It is possible that you have only a small amount of swap space and pseudoswap is not enabled. Swapinfo -t will display the swap space. I suspect that the real problem is that although the OS is 64-bit the application is 32-bit code and you are hitting a 1GB quadrant barrier. If the code is 32-bit, you will need to enable SHMEM_MAGIC by running the chatr -M. Man chatr for details. It is also possible that you need to enable memory windows so that each group of related 32-bit processes gets its own 4GB address space rather than sharing it.
If it ain't broke, I can fix that.
Leandro Lucena.
Occasional Contributor

Re: Postgres Configuration

Hello, Stephenson!

First of all, I would likje you to thank you for the response.

I checked the swap space and constacted that we have 16 GB. Check below:

# swapinfo -t
dev 16777216 0 16777216 0% 0 - 1 /dev/vg00/lvol2
reserve - 63056 -63056
memory 6500212 34352 6465860 1%
total 23277428 97408 23180020 0% - 0 -

I think that this value is enouhg, don't? About pseudoswap, I don't know what it is. I was reseaching for it. Is it the SWAPMEM_ON parameter? If it is, it's was enable on kernel. Postgres is 32bits. I tryed to change to SHMEM_MAGIC using "chatr -M", but it failed cause Postgres bin is not set to EXEC_MAGIC. It is set to SHARE_MAGIC. Do you know how to change this to enable Postgres run at 64bits. I confess that I'm a little confused using chatr.

Please help us! Thanks a lot! Leandro Lucena.