From owner-freebsd-current@FreeBSD.ORG Tue Apr 10 14:39:18 2007 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E833316A402; Tue, 10 Apr 2007 14:39:18 +0000 (UTC) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mx1.freebsd.org (Postfix) with ESMTP id AA5AE13C4C2; Tue, 10 Apr 2007 14:39:18 +0000 (UTC) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l3AENgaG025574; Tue, 10 Apr 2007 10:23:43 -0400 (EDT) To: Mark Kirkwood In-reply-to: <461B69C0.4060707@paradise.net.nz> References: <20070226002234.GA80974@xor.obsecurity.org> <461B69C0.4060707@paradise.net.nz> Comments: In-reply-to Mark Kirkwood message dated "Tue, 10 Apr 2007 22:41:04 +1200" Date: Tue, 10 Apr 2007 10:23:42 -0400 Message-ID: <25573.1176215022@sss.pgh.pa.us> From: Tom Lane X-Mailman-Approved-At: Tue, 10 Apr 2007 16:07:19 +0000 Cc: pgsql-hackers , performance@FreeBSD.org, current@FreeBSD.org, Kris Kennaway Subject: Re: [HACKERS] Anyone interested in improving postgresql scaling? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2007 14:39:19 -0000 Mark Kirkwood writes: > Kris Kennaway wrote: >> If so, then your task is the following: >> >> Make SYSV semaphores less dumb about process wakeups. Currently >> whenever the semaphore state changes, all processes sleeping on the >> semaphore are woken, even if we only have released enough resources >> for one waiting process to claim. i.e. there is a thundering herd >> wakeup situation which destroys performance at high loads. Fixing >> this will involve replacing the wakeup() calls with appropriate >> amounts of wakeup_one(). > I'm forwarding this to the pgsql-hackers list so that folks more > qualified than I can comment, but as I understand the way postgres > implements locking each process has it *own* semaphore it waits on - > and who is waiting for what is controlled by an in (shared) memory hash > of lock structs (access to these is controlled via platform Dependant > spinlock code). So a given semaphore state change should only involve > one process wakeup. Correct. The behavior Kris describes is surely bad, but it's not relevant to Postgres' usage of SysV semaphores. regards, tom lane