Re: shared memory settings: SHMMAX and SHMALL - Mailing list pgsql-general

From Tatsuo Ishii
Subject Re: shared memory settings: SHMMAX and SHMALL
Date
Msg-id 20010316102457V.t-ishii@sra.co.jp
Whole thread Raw
In response to Re: shared memory settings: SHMMAX and SHMALL  (Gregory Bittar <gbittar@iqa.cc>)
List pgsql-general
> My last reply was made when I was exhausted.  Sorry.
>
> Reconsidering....
>
> According to my /usr/include/asm/shmparam.h,
> SHMMAX (should be) <= (PAGE_SIZE << _SHM_IDX_BITS) = (4096 bytes << 15)
> = 128MB.
>
> I still don't see where to find the PAGE_SIZE value, although 4096 seems
> to be a general default out there.

On my Linux box, I found:

#define PAGE_SHIFT    12
#define PAGE_SIZE    (1UL << PAGE_SHIFT)

so PAGE_SIZE must be 4096.

> Also according to my server's /usr/include/asm/shmparam.h,
> SHMALL  should be = (1 << (_SHM_IDX_BITS + _SHM_ID_BITS))  = (1 <<
> (9+15))  =  16.
>
> I wonder why some people are setting SHMALL and SHMMAX to the same value
> when one is a measurement in pages and the other a measurement in
> bytes.

Me too. Probably SHMALL in /proc/sys/kernel/shmall is treated
differently from the one defined in those header files?

> Also, I thought that SHMMAX should be the max allotment in bytes
> per application, rather than the max shared by all applications.  If I
> anticipate 10 postmasters, is it dangerous to set SHMMAX so high?

No, SHMMAX is for all applications (10 postmasters in your case?). I
guess you are using x86/Linux and from your mail I would say you could
set SHMMAX to 128MB(= 134217728 bytes).

Also please make sure that you have enough file table entries in your
kernel. You are going to run many postmasters which involves many
backends. In my case I set following in /etc/sysctl.conf.

fs.file-max = 16384

This works for recent red hat (or derived) distributions. If this
doesn't work for you, then you could set a variable in
/proc(file-max).
--
Tatsuo Ishii



pgsql-general by date:

Previous
From: Tatsuo Ishii
Date:
Subject: RE: How to read/write multibyte to database
Next
From: Anand Raman
Date:
Subject: Re: COPY again...