Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 46D63634F5B for ; Fri, 20 Mar 2009 20:39:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 15600-08 for ; Fri, 20 Mar 2009 20:39:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from brmea-mail-2.sun.com (brmea-mail-2.Sun.COM [192.18.98.43]) by mail.postgresql.org (Postfix) with ESMTP id A7A69632DE8 for ; Fri, 20 Mar 2009 20:39:17 -0300 (ADT) Received: from fe-amer-10.sun.com ([192.18.109.80]) by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n2KNdFvw028050 for ; Fri, 20 Mar 2009 23:39:15 GMT MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; format=flowed; charset=ISO-8859-1 Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java(tm) System Messaging Server 7.0-5.01 64bit (built Feb 19 2009)) id <0KGT00900W59KL00@mail-amer.sun.com> for pgsql-performance@postgresql.org; Fri, 20 Mar 2009 17:39:15 -0600 (MDT) Received: from [192.168.1.3] ([unknown] [96.237.55.23]) by mail-amer.sun.com (Sun Java(tm) System Messaging Server 7.0-5.01 64bit (built Feb 19 2009)) with ESMTPSA id <0KGT002SHWDEPP90@mail-amer.sun.com>; Fri, 20 Mar 2009 17:39:15 -0600 (MDT) Date: Fri, 20 Mar 2009 19:39:13 -0400 From: "Jignesh K. Shah" Subject: Re: Proposal of tunable fix for scalability of 8.4 In-reply-to: <20090320220513.GS8313@alvh.no-ip.org> To: Alvaro Herrera Cc: Scott Carey , Robert Haas , Greg Smith , Kevin Grittner , "pgsql-performance@postgresql.org" Message-id: <49C42921.8050508@sun.com> References: <603c8f070903191349p5e8fb00as2816581d584fcefd@mail.gmail.com> <20090320154601.GC8313@alvh.no-ip.org> <20090320215813.GR8313@alvh.no-ip.org> <20090320220513.GS8313@alvh.no-ip.org> User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/310 X-Sequence-Number: 33232 Alvaro Herrera wrote: > Alvaro Herrera escribió: > > >> So Simon's correct. >> > > And perhaps this explains why Jignesh is measuring an improvement on his > benchmark. Perhaps an useful experiment would be to turn this behavior > off and compare performance. This lack of measurement is probably the > cause that the suggested patch to fix it was never applied. > > The patch is here > http://archives.postgresql.org//pgsql-hackers/2004-11/msg00935.php > > One of the reasons why my patch helps is it keeps this check intact but allows other exclusive Wake up.. Now what PostgreSQL calls "Wakes" is in reality just makes a variable indicating wake up and not really signalling a process to wake up. This is a key point to note. So when the process wanting the exclusive fights the OS Scheduling policy to finally get time on the CPU then it check the value to see if it is allowed to wake up and potentially due the delay between when some other process marked that process "Waked up" and when the process check the value "Waked up" it is likely that the lock is free (or other exclusive process had the lock, did its work and releaed it ). Over it works well since it lives within the logical semantics of the locks but just uses various differences in OS scheduling and inherent delays in the system. It actually makes sense if the process is on CPU wanting exclusive while someone else is doing exclusive, let them try getting the lock rather than preventing it from trying. The Lock semantic will make sure that they don't issue exclusive locks to two process so there is no issue with it trying. It's late in Friday so I wont be able to explain it better but when load is heavy, getting on CPU is an achievement, let them try an exclusive lock while they are already there. Try it!! -Jignesh