Re: [HACKERS] Fix performance degradation of contended LWLock on NUMA - Mailing list pgsql-hackers

From Sokolov Yura
Subject Re: [HACKERS] Fix performance degradation of contended LWLock on NUMA
Date
Msg-id b5bff2e90b4b2c6d600f44f87bed5757@postgrespro.ru
Whole thread Raw
In response to [HACKERS] Fix performance degradation of contended LWLock on NUMA  (Sokolov Yura <funny.falcon@postgrespro.ru>)
Responses Re: [HACKERS] Fix performance degradation of contended LWLock on NUMA
Re: [HACKERS] Fix performance degradation of contended LWLock on NUMA
List pgsql-hackers
On 2017-06-05 16:22, Sokolov Yura wrote:
> Good day, everyone.
> 
> This patch improves performance of contended LWLock.
> Patch makes lock acquiring in single CAS loop:
> 1. LWLock->state is read, and ability for lock acquiring is detected.
>   If there is possibility to take a lock, CAS tried.
>   If CAS were successful, lock is aquired (same to original version).
> 2. but if lock is currently held by other backend, we check ability for
>   taking WaitList lock. If wait list lock is not help by anyone, CAS
>   perfomed for taking WaitList lock and set LW_FLAG_HAS_WAITERS at 
> once.
>   If CAS were successful, then LWLock were still held at the moment 
> wait
>   list lock were held - this proves correctness of new algorithm. And
>   Proc is queued to wait list then.
> 3. Otherwise spin_delay is performed, and loop returns to step 1.
> 

I'm sending rebased version with couple of one-line tweaks.
(less skip_wait_list on shared lock, and don't update spin-stat on 
aquiring)

With regards,
-- 
Sokolov Yura aka funny_falcon
Postgres Professional: https://postgrespro.ru
The Russian Postgres Company
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [HACKERS] JSONB - JSONB operator feature request
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] GSoC 2017: Foreign Key Arrays