Re: BUG #14206: Switch to using POSIX semaphores on FreeBSD

From: Maxim Sobolev <sobomax(at)freebsd(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, Konstantin Belousov <kib(at)freebsd(dot)org>
Subject: Re: BUG #14206: Switch to using POSIX semaphores on FreeBSD
Date: 2016-06-21 20:12:06
Message-ID: CAH7qZfuEgJ4RfRy2NXEn1CMy8QRDjbaqmrne6f3NYgekjRLBzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom, thanks for looking at it so promptly. I am adding kib@ into the
discussion. Perhaps he would comment on the SYSV vs. POSIX in FreeBSD and
named vs. unnamed.

As far as I can tell, the sem_init(3) interface is present in the FreeBSD
10.3, so maybe we can use those instead?

-Max

On Tue, Jun 21, 2016 at 12:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> sobomax(at)freebsd(dot)org writes:
> > 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.
>
> I wonder how thorough that performance testing was. The reason that the
> named-POSIX-semaphore code exists is that it used to be the only kind of
> semaphore available on ancient OS X versions. But we got rid of that as
> soon as we could, for the reason explained in template/darwin:
>
> # Select appropriate semaphore support. Darwin 6.0 (Mac OS X 10.2) and up
> # support System V semaphores; before that we have to use POSIX semaphores,
> # which are less good for our purposes because they eat a file descriptor
> # per backend per max_connection slot.
>
> The extra FDs slow down launching of new backends (due to having to dup
> all the postmaster's FDs for the semaphores) and if max_connections is
> large they can take a pretty serious chunk out of your system-wide file
> table, at worst max_connections squared.
>
> Now maybe FreeBSD is different enough from OSX that these are not problems
> for you, but I'm dubious.
>
> Have you got unnamed POSIX semaphores, and if so have you tried that
> variant?
>
> regards, tom lane
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Emre Hasegeli 2016-06-21 20:25:58 Re: Line intersection point is wrong
Previous Message Tom Lane 2016-06-21 19:59:25 Re: BUG #14206: Switch to using POSIX semaphores on FreeBSD