Subject: Re: [vserver] Shared Memory
From: Holger Amann <keeney@fehu.org>
Date: Tue, 27 Oct 2009 01:22:30 +0100


Am 27.10.2009 um 01:08 schrieb Holger Amann:

>
> Am 27.10.2009 um 00:50 schrieb Timothee Besset:
>
>> I'm probably not familiar enough with how PostgreSQL works to help  
>> you,
>> just going from my experience with Oracle here. I don't suppose  
>> pgsql's
>> 'shared memory' could mean OS shared memory (as in, a tmpfs mount),
>> because you have none. Oracle won't run if you're not giving it a
>> /dev/shm tmpfs mount, but it's possible to do that for a guest (I do
>> that). So all I can think of is that pgsql wants one and you haven't
>> given any.
>>
>> TTimo
>
> Thank you for your help!
>
> I tried it (if the following is ok) and restarted Postgres, but it  
> made no difference in memory usage
>
> guest1:/var/log/postgresql# mount
> /dev/hdv1 on / type ufs (defaults)
> none on /proc type proc (defaults)
> none on /tmp type tmpfs (size=16m,mode=1777)
> none on /dev/pts type devpts (gid=5,mode=620)
> tmpfs on /dev/shm type tmpfs (rw,size=4000M)
>
> Holger



I googled around and found an information [1], that Postgres does not  
use POSIX SHM. "PostgreSQL is using the old SYSV shared memory and  
semaphores, as evidenced
by ipcs[...]"

So the output of ipcs on the guest is:

guest1:/dev/shm# ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages


and on a real machine:

postgrestest:~# ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x0052e2c1 65536      postgres  600        378953728  7

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x0052e2c1 458752     postgres  600        17
0x0052e2c2 491521     postgres  600        17
0x0052e2c3 524290     postgres  600        17
0x0052e2c4 557059     postgres  600        17
0x0052e2c5 589828     postgres  600        17
0x0052e2c6 622597     postgres  600        17
0x0052e2c7 655366     postgres  600        17

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages


So is it a Postgres specific problem, and/or could that be solved with  
Linux-Vserver?

[1] http://www.mail-archive.com/pgsql-bugs@postgresql.org/msg17969.html