Re: shared memory settings: SHMMAX and SHMALL

Поиск
Список
Период
Сортировка
От Matthew Rice
Тема Re: shared memory settings: SHMMAX and SHMALL
Дата
Msg-id lvae6mvobq.fsf@sol.starnix.com
обсуждение исходный текст
Ответ на shared memory settings: SHMMAX and SHMALL  (Gregory Bittar <gbittar@iqa.cc>)
Список pgsql-general
Gregory Bittar <gbittar@iqa.cc> writes:
> According to my /usr/include/asm/shmparam.h,
> SHMMAX (should be) <= (PAGE_SIZE << _SHM_IDX_BITS) = (4096 bytes << 15)
> = 128MB.

Mine is just:

#define SHMMAX 0x2000000


> I still don't see where to find the PAGE_SIZE value, although 4096 seems
> to be a general default out there.

man getpagesize

or

matt@sol:/usr/include[106]% egrep 'define PAGE_S(IZE|HIFT)' */* 2>/dev/null
asm/page.h:#define PAGE_SHIFT   12
asm/page.h:#define PAGE_SIZE    (1UL << PAGE_SHIFT)
linux/a.out.h:#define PAGE_SIZE 0x400
sys/user.h:#define PAGE_SHIFT           12
sys/user.h:#define PAGE_SIZE            (1UL << PAGE_SHIFT)


Although, 'man postmaster' says that it used 8k (or "whatever BLCKSZ
is set to in config.h") for it's shared memory buffers.



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

My 2.2.16 kernel has 15 and 7, BTW.


> 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

Pure laziness, I'm sure.


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

I'm not certain.  I just used those numbers for a testing server (I actually
only told postmaster to use ~300MB).

Are you saying 10 postmasters or 10 backends?

Either way, you can set SHMMAX as high as you like.  Just don't tell the
postmasters to try and use them all.

Actually, I just did this:

echo 11111111111 >/proc/sys/kernel/shmmax

and got:

cat /proc/sys/kernel/shmmax
-1773790777

Probably not good, long term :)

My kernel also wouldn't let me make SHMALL higher than 16M
--
matthew rice <matt@starnix.com>                               starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products

В списке pgsql-general по дате отправления:

Предыдущее
От: Christopher Masto
Дата:
Сообщение: Re: Fast Inserts and Hardware Questions
Следующее
От: will trillich
Дата:
Сообщение: Re: Fw: Please Help