Re: spinlock contention

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: spinlock contention
Date: 2011-07-21 23:10:46
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jul18, 2011, at 04:36 , Robert Haas wrote:
> On Fri, Jul 8, 2011 at 6:02 AM, Florian Pflug <fgp(at)phlo(dot)org> wrote:
>>> I don't want to fiddle with your git repo, but if you attach a patch
>>> that applies to the master branch I'll give it a spin if I have time.
>> Patch attached.
>> Beware that it needs at least GCC 4.1, otherwise it'll use a per-partition
>> spin lock instead of "locked xadd" to increment the shared counters.
> [ Back from vacation, catching up on email. ]
> gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
> pgbench -n -S -T 180 -c 32 -j 32
> with lwlock-part patch:
> tps = 36974.644091 (including connections establishing)
> unpatched cd34647c666be867f95ef8fc0492c30356043f10:
> tps = 39432.064293 (including connections establishing)
> And with -c 8 -j 8:
> tps = 26946.202428 (including connections establishing)
> tps = 27206.507424 (including connections establishing)

:-( That's disappointing, to say the least.

I also completely fail to understand what the heck is going on there.

I mean, you did conclusively prove that commenting out the SInval stuff
made a huge difference. There's also supposed to hardly any invalidation
going on during a pgbench -S run. So, since the patch removes two of the
three spin-lock acquisitions from SIGetDataEntries() (so long as there are
no exclusive lockers of SInvalReadLock), there should be some effect.
Or so I'd think at least...

If anyone has I theory, I'd love to hear it.

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-07-21 23:34:58 Re: sinval synchronization considered harmful
Previous Message Jim Nasby 2011-07-21 23:05:36 Re: storing TZ along timestamps