Re: shared memory settings: SHMMAX and SHMALL

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: gbittar(at)iqa(dot)cc
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: shared memory settings: SHMMAX and SHMALL
Date: 2001-03-16 01:24:57
Message-ID: 20010316102457V.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mont Erickson 2001-03-16 03:08:59 Postgres SQL Query (Generating Date Groups)
Previous Message Tatsuo Ishii 2001-03-16 01:24:51 RE: How to read/write multibyte to database