Обсуждение: Question on memory management sysv/posix on Linux

Поиск
Список
Период
Сортировка

Question on memory management sysv/posix on Linux

От
Daniel Westermann
Дата:
Hi

I have a question about memory management in PostgreSQL. I understand the default on Linux usually is "posix" which creates files in /dev/shm. With the default settings of 128MB for shared_buffers this is the result:

ls -la /dev/shm
total 4
drwxrwxrwt  2 root     root       60 Feb 17 11:19 .
drwxr-xr-x 18 root     root     3100 Feb 17 09:36 ..
-rw-------  1 postgres postgres 2316 Feb 17 11:19 PostgreSQL.1804289383

Question: Why is this file only 2316 bytes?


Switching to sysv (same setting for shared_buffers):

ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x0052e2c1 622592     postgres   600        56         5                       
0x6b8b4567 655361     postgres   600        2316       5                       

Again 2316 bytes. Why?

Is the 56 bytes segment related to Robert's post and only used for determining which processes are attached?
http://rhaas.blogspot.com/2012/06/absurd-shared-memory-limits.html



Thanks in advance
Daniel


Re: Question on memory management sysv/posix on Linux

От
Tom Lane
Дата:
Daniel Westermann <daniel.westermann@dbi-services.com> writes:
> ls -la /dev/shm
> total 4
> drwxrwxrwt 2 root root 60 Feb 17 11:19 .
> drwxr-xr-x 18 root root 3100 Feb 17 09:36 ..
> -rw------- 1 postgres postgres 2316 Feb 17 11:19 PostgreSQL.1804289383

> Question: Why is this file only 2316 bytes?

It holds a DSM control header, nothing more.  If you were actually doing
anything with dynamic shared memory, you'd see more such files.

            regards, tom lane