Re: Final Thoughts for 8.3 on LWLocking and Scalability

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Final Thoughts for 8.3 on LWLocking and Scalability
Date: 2007-09-11 17:32:11
Message-ID: 46E6D11B.5060609@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Simon Riggs wrote:
> On Tue, 2007-09-11 at 10:21 -0400, Tom Lane wrote:
>> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
>>> 1. The ProcArrayLock is acquired Exclusive-ly by only one
>>> remaining operation: XidCacheRemoveRunningXids(). Reducing things
>>> to that level is brilliant work, Florian and Tom.
>> It would be brilliant if it were true, but it isn't. Better look
>> again.
>
> On the more detailed explanation, I say "in normal operation".
>
> My analytical notes attached to the original post show ProcArrayLock
> is acquired exclusively during backend start, exit and while making a
> prepared (twophase) commit. So yes, it is locked Exclusively in
> other places, but they happen rarely and they actually add/remove
> procs from the array, so its unlikely anything can change there
> anyhow.

Well, and during normal during COMMIT and ABORT, which might happen
rather frequently ;-)

I do agree, however, that XidCacheRemoveRunningXids() is the only site
left where getting rid of it might be possible, and might bring
measurable benefit for some workloads. With more effort, we might not
even need it during ABORT, but I doubt that the effort would be worth
it. While some (plpgsql intensive) workloads might abort subxacts rather
frequently, I doubt that same holds true for toplevel aborts.

I'm actually working on a patch to remove that lock from
XidCacheRemoveRunningXids(), but I'm not yet completely sure that my
approach is safe. Tom had some objections that I take rather seriously.
We'll see ;-)

greetings, Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-11 18:48:54 Re: invalidly encoded strings
Previous Message Tom Lane 2007-09-11 17:29:37 Re: What is happening on buildfarm member dugong

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-09-11 17:37:30 pgsql: Stamp releases 8.2.5, 8.1.10, 8.0.14, 7.4.18, 7.3.20.
Previous Message Andrew Dunstan 2007-09-11 16:46:16 prevent invalidly encoded input