Re: Spinlocks and semaphores in 9.2 and 9.3

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Spinlocks and semaphores in 9.2 and 9.3
Date: 2016-04-18 15:54:27
Message-ID: CA+Tgmoa1CYhQu4oUA77zWerJQ-1K4LGa95o5BfUgytgNq8GN+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 18, 2016 at 11:53 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Apr 18, 2016 at 11:34 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Andres Freund <andres(at)anarazel(dot)de> writes:
>>> On 2016-04-18 11:24:07 -0400, Tom Lane wrote:
>>>> (The thing that gave me pause about this was noticing that I could not
>>>> start two such postmasters concurrently on my RHEL6 box, without changing
>>>> the default system limits on number of SysV semaphores.)
>>
>>> Hm, is that different before/after the patch? Because afaics at around
>>> NBuffers = 1000, the number of semaphores should be lower after the
>>> patch?
>>
>> Yeah, that was probably the argument we used before. But it's true that a
>> postmaster built with --disable-spinlocks is harder to test than one built
>> without (because you're going from ~100 semas to ~1100 semas, at default
>> configuration). If we believe that the main real use-case for this switch
>> is testing, that's not a very nice property.
>>
>> The bottom line IMO is that --disable-spinlocks is actually not that awful
>> for low-stress, low-concurrency scenarios; for example, it doesn't change
>> the runtime of make installcheck-parallel very much for me. On the other
>> hand, for high-concurrency scenarios you'd darn well better get a real
>> spinlock implementation. Given that sort of scope of use, it seems like
>> a hundred or so underlying semas should be plenty, and it'd be less likely
>> to cause operational problems than 1024.
>
> I suppose that's probably true. I thought surely any system worth its
> salt wouldn't have a problem with 1024 semaphores, but a quick Google
> search for "hp-ux semmns" turned up this page:

Oops, hit send too soon.

http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/semmni.5.html

That's from 2007 and indicates a default maximum of 2048. So it would
be fairly easy to hit the limit.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-04-18 15:57:09 Re: Parser extensions (maybe for 10?)
Previous Message Julien Rouhaud 2016-04-18 15:53:34 Re: Memory leak in GIN index build