Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsybU-00007O-OC for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Oct 2016 20:52:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bsybS-000129-RB for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Oct 2016 20:52:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bsybS-000122-94 for pgsql-hackers@postgresql.org; Sat, 08 Oct 2016 20:52:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bsybL-0007Zm-Gf for pgsql-hackers@postgresql.org; Sat, 08 Oct 2016 20:52:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u98Kq8pQ029245; Sat, 8 Oct 2016 16:52:08 -0400 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: Switch to unnamed POSIX semaphores as our preferred sema code? In-reply-to: References: <8536.1475704230@sss.pgh.pa.us> <15690.1475761593@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 06 Oct 2016 14:55:55 -0400" Date: Sat, 08 Oct 2016 16:52:08 -0400 Message-ID: <29244.1475959928@sss.pgh.pa.us> X-Pg-Spam-Score: -4.6 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > On Thu, Oct 6, 2016 at 9:46 AM, Tom Lane wrote: >> Can anyone think of a test case that would stress semaphore operations >> more heavily, without being unrealistic? > I think it's going to be pretty hard to come up with a non-artificial > test case that has exhibits meaningful lwlock contention on an 8-core > system. If you go back to 9.1, before we had fast-path locking, you > can do it, because the relation locks and vxid locks do cause > noticeable contention on the lock manager locks in that version. > ... > Alternatively, get a bigger box. :-) Well, I did both of the above. I tried 9.1 on "hydra", that 60-processor POWER7 box, and cranked the parallelism up to ridiculous levels: pgbench -S -j 250 -c 250 -M prepared -T 60 bench Median of 3 runs with sysv semaphores: number of transactions actually processed: 1554570 tps = 25875.432836 (including connections establishing) tps = 25894.938187 (excluding connections establishing) Ditto, for unnamed POSIX semaphores: number of transactions actually processed: 1726696 tps = 28742.486104 (including connections establishing) tps = 28765.963071 (excluding connections establishing) That's about a 10% win for POSIX semaphores. Now, at saner loads, I couldn't see much of any difference between the two semaphore APIs. So I'm still of the opinion that there's not likely to be any meaningful performance difference in practice, at least not on reasonably recent Linux machines. But this does indicate that if there is any difference, it will probably favor switching. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers