Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7F4F5632A3D for ; Wed, 18 Mar 2009 20:07:06 -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 21110-07 for ; Wed, 18 Mar 2009 20:06:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128087.authsmtp.co.uk (outmail128087.authsmtp.co.uk [62.13.128.87]) by mail.postgresql.org (Postfix) with ESMTP id 304B063299D for ; Wed, 18 Mar 2009 20:06:56 -0300 (ADT) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt8.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n2IN6pqM029467; Wed, 18 Mar 2009 23:06:51 GMT Received: from [192.168.0.2] (85-211-223-92.dyn.gotadsl.co.uk [85.211.223.92]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n2IN6oKN074294; Wed, 18 Mar 2009 23:06:50 GMT Subject: Re: Proposal of tunable fix for scalability of 8.4 From: Simon Riggs To: Tom Lane Cc: Matthew Wakeling , "pgsql-performance@postgresql.org" In-Reply-To: <15144.1237408005@sss.pgh.pa.us> References: <603c8f070903121829r31cf1472ha9876e5c480a542e@mail.gmail.com> <12292.1236964604@sss.pgh.pa.us> <49BB699D.1070809@enterprisedb.com> <1237362833.3953.186.camel@ebony.2ndQuadrant> <15144.1237408005@sss.pgh.pa.us> Content-Type: text/plain Date: Wed, 18 Mar 2009 23:06:56 +0000 Message-Id: <1237417616.3953.318.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 770d93b9-1411-11de-bc7b-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFaQ1bYFhD HGQLW11EUl57WWV/ bgsfZQBDYEtPQQdo U1ZAQE1QEQdtHhxP WBxnLB8tDHtGf3py bEIsXHRaVAp9ckYp S00GHHAHYWZhdWEe BBVFJVBTIh5Kfh4T aFl/U3NfNGdJBC9q VzwLEgofGg96HWxt WAYVKkkbRQ4MEHYg WhYLFzEiVUMEV209 KAZuMVUVGE8bM0Ez LUppXlxQY1lOYiwg X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1378/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/261 X-Sequence-Number: 33183 On Wed, 2009-03-18 at 16:26 -0400, Tom Lane wrote: > Simon Riggs writes: > > On Mon, 2009-03-16 at 16:26 +0000, Matthew Wakeling wrote: > >> One possibility would be for the locks to alternate between exclusive > >> and > >> shared - that is: > >> > >> 1. Take a snapshot of all shared waits, and grant them all - > >> thundering > >> herd style. > >> 2. Wait until ALL of them have finished, granting no more. > >> 3. Take a snapshot of all exclusive waits, and grant them all, one by > >> one. > >> 4. Wait until all of them have been finished, granting no more. > >> 5. Back to (1) > > > I agree with that, apart from the "granting no more" bit. > > > Currently we queue up exclusive locks, but there is no need to since for > > ProcArrayLock commits are all changing different data. > > > The most useful behaviour is just to have two modes: > > * exclusive-lock held - all other x locks welcome, s locks queue > > * shared-lock held - all other s locks welcome, x locks queue > > My goodness, it seems people have forgotten about the "lightweight" > part of the LWLock design. "Lightweight" is only useful if it fits purpose. If the LWlock design doesn't fit all cases, especially with critical lock types, then we can have special cases. We have both spinlocks and LWlocks, plus we split hash tables into multiple lock partitions. If we have 3 types of lightweight locking, why not consider having 4? -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support