Re: [GENERAL] memory

From: Daniel Kalchev <daniel(at)digsys(dot)bg>
To: pgsql-general(at)hub(dot)org
Subject: Re: [GENERAL] memory
Date: 1999-12-05 14:06:27
Message-ID: 199912051406.QAA03457@dcave.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-ports

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

owner-pgsql-general-digest(at)hub(dot)org said:
> 1) Can someone explain how postgreSQL uses memory so that I can
> understand
> what I should be doing here.
> BTW, I am running postgres with -B 884. Can someone also explain how
> postgres uses shared mem so that I can have a clue what would be a
> reasonable setting.
>
> 2) Can any BSDI folk give me any tuning tips. I am especially
> interested to
> hear from those who claim "some might tell you that we run equally
> well on
> FreeBSD" or "BSD is the One True Code", of course all help is
> gratefully
> received.

> I have run BSDI for years and never saw this problem. Not sure on a
> cause, though.

Bruce,

I too run BSD/OS for years and on all BSD/OS versions since 2.1 and Postgres
since 6.0 (earlier postrges releases didn't have much load here) observe the
same problem:

the postgres process never can allocate more than ~74MB of memory! It would
die with (printed on the controlling terminal!?) message:

sbrk: grow failed, return = 12

The postgres log would show

FATAL 1: Memory exhausted in AllocSetAlloc()

I have actually complained seveal time, and saw recently that the alloc
routines have been rewritten, but with the same result! I now think this may
be something BSD/OS related - I never ever see a postgres process allocate
more than 74 MB memory! :-)

The resource limits when postrges is started are:

coredumpsize unlimited
cputime unlimited
datasize 262144 kbytes
filesize unlimited
maxproc 4116
memorylocked 256164 kbytes
memoryuse 256160 kbytes
openfiles 13196
stacksize 262144 kbytes

This is one of the most mysterious things I ever saw on using BSD/OS and
PostgreSQL.... and of course - shared memory and semaphores! :-)

I have my BSD/OS kernel (3.1) configured with these options

options "DFLDSIZ=\(64*1024*1024\)"
options "MAXDSIZ=\(256*1024*1024\)"
options "CHILD_MAX=256"
options "OPEN_MAX=256"
options "KMAPENTRIES=4000" # Prevents kmem malloc errors !
options "KMEMSIZE=\(32*1024*1024\)"
# shared memory setup for Postgres
options "SHMMAXPGS=32768"
options "SHMMNI=400"
options "SHMSEG=204"
# More semaphores for Postgres
options "SEMMNS=600"

sometimes, it logs messages such as

IpcMemoryCreate: shmget failed (Cannot allocate memory) key=5432401,
size=2661376, permission=600

Postgres is started with

postmaster -D/usr/local/pgsql/data -B 256 -i -o "-e -S 8192" >>
/usr/local/pgsql/errlog 2>&1 &

Weird...

Daniel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message USSL 1999-12-05 15:13:20 PostgreSQL and Java
Previous Message Herbert Liechti 1999-12-05 11:06:41 Re: [GENERAL] PostgreSQL 6.5.3 on SuSE 6.1

Browse pgsql-ports by date

  From Date Subject
Next Message Bruce Momjian 1999-12-05 19:28:19 Re: [GENERAL] memory
Previous Message Bill Tuck 1999-12-04 16:01:53 POSTGRES_INCLUDE and POSTGRES_LIB??