Re: update i386 spinlock for hyperthreading

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, markw(at)osdl(dot)org
Subject: Re: update i386 spinlock for hyperthreading
Date: 2003-12-29 22:28:08
Message-ID: 3FF0AA78.9050803@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Tom Lane wrote:

>>Is there an easy way find out which LWLock is contended?
>>
>>
>
>Not from oprofile output, as far as I can think. I've suspected for
>some time that the BufMgrLock is a major bottleneck, but have no proof.
>
>
Mark ran a DBT-2 testrun with the attached statistics patch applied: It
collects stats about all lightweight locks and dumps them during
shutdown. The hottest locks are

Lock Acquire %contention sleep calls
8(WALInsertLock) 8679205 0.030410 263934
1(LockMgrLock) 64089418 0.079783 5113215
5(SInvalLock) 68396470 0.001298 88812
0(BufMgrLock) 246307425 0.120293 29629089

The lock numbers are from 7.4, i.e. without the patch that removes
ShmemIndexLock. I've check that 8 is really WALInsertLock in the
assembly output.

The scary part from the system perspective are the 35 million context
switches that were generated by the BufMgrLock and the LockMgrLock. I
remember there were patches that tried other algorithms instead of the
simple LRU for the buffer manager. Has anyone tried to change the
locking of the buffer manager?

The effect of padding the lightweight locks to a full cacheline appears
to be negligable: With the padding, there were around 4 million
performance monitor hits on the 'lock xchg' instructions. Without it
(test run 300), there were 4.2 million hits.

The complete data is at

http://developer.osdl.org/markw/dbt2-pgsql/303/

The db log with the lock stats is at
http://developer.osdl.org/markw/dbt2-pgsql/303/db/log

(Warning: 6.9 MB)

--
Manfred

Attachment Content-Type Size
patch-lwl-stat text/plain 3.2 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-12-29 22:30:50 Re: Is my MySQL Gaining ?
Previous Message Ericson Smith 2003-12-29 22:16:55 Re: Is my MySQL Gaining ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2003-12-29 22:30:50 Re: Is my MySQL Gaining ?
Previous Message Ericson Smith 2003-12-29 22:16:55 Re: Is my MySQL Gaining ?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-12-29 22:50:52 Lock contention (was Re: [PATCHES] update i386 spinlock for hyperthreading)
Previous Message Ron Mayer 2003-12-29 05:48:16 Re: [COMMITTERS] pgsql-server/ oc/src/sgml/datatype.sgml