RE: Shared Memory: How to use SYSV rather than MMAP ?

From: "REIX, Tony" <tony(dot)reix(at)atos(dot)net>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, "EMPEREUR-MOT, SYLVIE" <sylvie(dot)empereur-mot(at)atos(dot)net>, "BERGAMINI, DAMIEN" <damien(dot)bergamini(at)atos(dot)net>
Subject: RE: Shared Memory: How to use SYSV rather than MMAP ?
Date: 2018-11-23 15:53:57
Message-ID: AM4PR0202MB280260DDBF90323F2A0B2E2F86D40@AM4PR0202MB2802.eurprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andres, Thomas,

Here is a patch for enabling SystemV Shared Memory on AIX, for 64K or bigger page size, rather than using MMAP shared memory, which is slower on AIX.

We have tested this code with 64K pages and pgbench, on AIX 7.2 TL2 Power 9, and it provided a maximum of +37% improvement.

We'll test this code with Large Pages (SHM_LGPAGE | SHM_PIN | S_IRUSR | S_IWUSR flags of shmget() ) ASAP.

However, I wanted first to get your comments about this change in order to improve it for acceptance.

Thanks/Regards,

Cordialement,

Tony Reix

tony(dot)reix(at)atos(dot)net

ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>
________________________________
De : REIX, Tony
Envoyé : mercredi 21 novembre 2018 09:45:12
À : Thomas Munro; Andres Freund
Cc : Robert Haas; Pg Hackers; EMPEREUR-MOT, SYLVIE; BERGAMINI, DAMIEN
Objet : RE: Shared Memory: How to use SYSV rather than MMAP ?

Hi Thomas, Andres,

I still have to reread/study in depth the discussion in this thread in order to understand all these information. However, we've already got a very good performance improvement of pgbench on AIX 7.2 / Power9 with that change: + ~38% in best case. See below for the details.

This +38% improvement has been measured by comparison with a PostgreSQL v11.1 code which was built with: XLC -O2 + power9-tuning, plus some changes about inlining for AIX and some fixes dealing with issues with XLC and PostgreSQL #ifdef. Maybe GCC provides better results, we'll know later.

Once we are done with this performance analysis campaign, I'll have to submit patches.

Meanwhile, if anyone has ideas about where the choices made for PostgreSQL on Linux may have an impact to the performance on AIX, I'm very interested!

Regards,

Tony

Changes in PostgreSQL11.1 sources for SYSV large pages (64K) support :

* Main shared memory segment in sysv_shmem.c

removal of #define USE_ANONYMOUS_SHMEM

* Dynamic shared memory implementations in src/include/storage/dsm_impl.h :

#define USE_DSM_POSIX
// #define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_POSIX
#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
#endif

* Changes in PostgreSQL11.1 XCOFF binary with ledit :

* ldedit -btextpsize=64K -bdatapsize=64K -bstackpsize=64K /opt/freeware/bin/postgres_64
* Env variable LDR_CNTRL=SHMPSIZE=64K

Cordialement,

Tony Reix

tony(dot)reix(at)atos(dot)net

ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>

Attachment Content-Type Size
postgresql-11.1-AIX-SysV-SharedMemory-LargePagesV2.patch text/x-patch 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-23 16:08:11 Re: prewarm compiler warnings
Previous Message Erik Rijkers 2018-11-23 15:34:29 prewarm compiler warnings