BUG #13416: Postgres >= 9.3 doesn't use optimized shared memory on Solaris anymore

From: stadtkind2(at)gmx(dot)de
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13416: Postgres >= 9.3 doesn't use optimized shared memory on Solaris anymore
Date: 2015-06-08 13:24:32
Message-ID: 20150608132432.2796.77742@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13416
Logged by: Stefan Krüger
Email address: stadtkind2(at)gmx(dot)de
PostgreSQL version: 9.4.1
Operating system: Solaris 11.2
Description:

Hi,

starting with Postgres 9.3, there seems to be a bug with SysV Shared Memory
on Solaris. Postgres doesn't seem to use ISM anymore.

http://docs.oracle.com/cd/E23824_01/html/821-1450/chapter2-73.html

"A special kind of shared memory known as intimate shared memory (ISM) is
used by DBMS vendors to maximize performance.
When a shared memory segment is made into an ISM segment, the memory for the
segment is locked.
This feature enables a faster I/O path to be followed and improves memory
usage.
A number of kernel resources describing the segment are then shared between
all processes that attach to the segment in ISM mode"

I'm using Solaris 11.2 on Sparc (T5220) and the "official" solaris11/sparc
binaries from your site.

PostgreSQL 9.4.1:

"dynamic_shared_memory_type" was set to sysv (also tried 'posix' and 'mmap',
same results)

root(at)solaris:/ # ipcs -mA
IPC status from <running system> as of Wednesday, February 18, 2015 02:04:56
PM CET
T ID KEY MODE OWNER GROUP CREATOR CGROUP
NATTCH SEGSZ CPID LPID ATIME DTIME CTIME ISMATTCH
PROJECT
Shared Memory:
m 49 0x7be9c1bd --rw------- postgres postgres postgres postgres
4 2316 1726 2809 13:22:02 16:55:41 13:22:02 4
user.postgres
m 48 0x52e2c1 --rw------- postgres postgres postgres postgres
4 56 1726 2809 13:22:00 16:55:41 13:22:00 4
user.postgres

root(at)solaris:/ # pmap -sx 1726
Address Kbytes RSS Anon Locked Pgsz Mode
Mapped File
...
00007FFEFF000000 8 8 - 8 8K rwxsR [
ism shmid=0x32 ]
00007FFEFF800000 8 8 - 8 8K rwxsR [
ism shmid=0x33 ]
FFFFFFFB50000000 282624 282624 - - 4M rw-s- [
anon ]
FFFFFFFB61400000 16773120 7290880 - - - rw-s- [
anon ]
FFFFFFFF61000000 159744 159744 - - 4M rw-s- [
anon ]

Notice that there are 2 ISM's, but they're way too small. All the "fun"
happens in an anonymous memory region
which does not benefit from large(r) page support (anon memory seems to be
limited to 4MB pages,
whereas ISM can use up to 2 GB pages on certain SPARC CPUs).

PostgreSQL 9.2.10 is fine though:

root(at)solaris:/ # ipcs -mA
IPC status from <running system> as of Wednesday, February 18, 2015 02:08:49
PM CET
T ID KEY MODE OWNER GROUP CREATOR CGROUP
NATTCH SEGSZ CPID LPID ATIME DTIME CTIME ISMATTCH
PROJECT
Shared Memory:
m 50 0x52e2c1 --rw------- postgres postgres postgres postgres
4 17605672960 18225 18232 14:08:42 14:08:43 14:08:40 4
user.postgres

Notice the huge SEGSZ!

root(at)solaris:/ # pmap -sx 18225 | grep ism
Address Kbytes RSS Anon Locked Pgsz Mode
Mapped File
...
00007FFAE0000000 17039360 17039360 - 17039360 256M rwxsR [
ism shmid=0x32 ]
00007FFEF0000000 151552 151552 - 151552 4M rwxsR [
ism shmid=0x32 ]
00007FFEF9400000 2112 2112 - 2112 64K rwxsR [
ism shmid=0x32 ]
00007FFEF9610000 16 16 - 16 8K rwxsR [
ism shmid=0x32 ]

This looks good.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-06-08 15:08:34 Re: BUG #13413: pg_stat_statements don't statistics "DEALLOCATE ALL" statements
Previous Message held911 2015-06-08 06:24:15 BUG #13413: pg_stat_statements don't statistics "DEALLOCATE ALL" statements