pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sobomax@freebsd.org
To: pgsql-bugs@postgresql.org
Subject: BUG #14206: Switch to using POSIX semaphores on FreeBSD
Date: Tue, 21 Jun 2016 19:34:12 +0000
Message-ID: <20160621193412.5792.65085@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14206
Logged by:          Maksym Sobolyev
Email address:      sobomax@freebsd.org
PostgreSQL version: 9.5.2
Operating system:   FreeBSD 10.3-RELEASE amd64
Description:        

Traditionally, SYSV semaphores are used to do synchronization on FreeBSD.

However, according to the analysis done by Konstantin Belousov here
https://www.kib.kiev.ua/kib/pgsql_perf_v2.0.pdf there is at the very least
some performance benefit on using POSIX semaphones instead of SYSV
semaphones in the PG running on FreeBSD host.

In addition to that performance benefit, the SYSV primitives are usually
very limited resource by default, so in order to run any more or less
significant amount of connections on your DB server you need to tweak kernel
option to increase number of those. And last but not least,  SYSV primitives
once allocated need explicit removal, which might not be performed when PG
process dies or SIGKILLed. None of those is an issue with POSIX
semaphores.

We've been testing that patch on 9.1, 9.2 and 9.5 versions of the PG for few
weeks now and it performs at least as good as with old SYSV builds. We also
see drop of semaphores in use to 0 in the ipcs(1) output, so that the patch
actually does what it's supposed to do. 

inline patch 1: src/template/freebsd (+1/-0 lines) download inline-1.patch--- src/template/freebsd +++ src/template/freebsd @@ -3,3 +3,4 @@ case $host_cpu in alpha*) CFLAGS="-O";; # alpha has problems with -O2 esac +USE_NAMED_POSIX_SEMAPHORES=1
-- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs

view thread (14+ messages)  latest in thread

Message-ID: <20160621193412.5792.65085@wrigleys.postgresql.org>
Permalink:  ../20160621193412.5792.65085@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160621193412.5792.65085@wrigleys.postgresql.org

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sobomax@freebsd.org
  Subject: Re: BUG #14206: Switch to using POSIX semaphores on FreeBSD
  In-Reply-To: <20160621193412.5792.65085@wrigleys.postgresql.org>
  References: <20160621193412.5792.65085@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox