Re: lwlocks and starvation

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: lwlocks and starvation
Date: 2004-11-25 12:07:54
Message-ID: 1101384474.4179.994.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2004-11-25 at 11:28, Neil Conway wrote:
> Simon Riggs wrote:
> > I'd been thinking about lock release order also, thinking that this
> > could be related to the CS storms observed earlier and the apparent
> > lock-step behaviour commented upon previously.
>
> As much as I would love to believe this (because it would mean we could
> probably solve the problem pretty easily), I don't think lock release
> order is the (primary) culprit behind the CS storm issue.

Wish we had a way to tell... though I think you are right.

> As I
> understand it, the heavily contended lock in those situations is the
> BufMgrLock, and that is _always_ acquired in exclusive mode.

So you're saying this doesn't effect BufMgrLock contention? Oh.

> > ISTM that waking
> > shared waiters in xid order would bring the most benefit and minimise
> > any data issues. Readers waiting behind an exclusive waiter, where the
> > reader has a lower xid might reasonably be woken without a problem since
> > they will never see the changes made by the exclusive waiter anyway.
>
> I'm not sure I understand. What "data issues" are you referring to?
> LWLocks are used to protect non-transactional resources (such as shared
> memory data structures), so the relative xids of two waiter processes
> doesn't affect whether they can see each other's modifications (i.e.
> because they always can).

Yes, understand the difference. But when we check for tuple visibility,
the changes would be ignored, hence it is OK to resort the list from
FIFO to xid order, but...

> In any case, the idea of considering information such as the xid when
> deciding which waiters to release is interesting. It's not immediately
> apparent to me quite *how* to make use of that info, but it's definitely
> something to consider...

Agreed.

It's a wacky idea and I'm not embarrassed having them. The day I stop
having them will be the day I stop having good ideas too. But please
don't let this distract from your own good-idea:

Well done to you, Neil.

--
Best Regards, Simon Riggs

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Will Arp 2004-11-25 14:04:01 problem installing 8.0.0beta5 on OS X 10.3
Previous Message Neil Conway 2004-11-25 11:28:50 Re: lwlocks and starvation