Re: Reducing ClogControlLock contention
От | Simon Riggs |
---|---|
Тема | Re: Reducing ClogControlLock contention |
Дата | |
Msg-id | CANP8+jJ1TnPPZfkBA3tGOsLGJp61g6TuDKp1=OqKaFDJA+mu_A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Reducing ClogControlLock contention (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: Reducing ClogControlLock contention
(Amit Kapila <amit.kapila16@gmail.com>)
Re: Reducing ClogControlLock contention (Andres Freund <andres@anarazel.de>) |
Список | pgsql-hackers |
On 1 July 2015 at 09:00, Amit Kapila <amit.kapila16@gmail.com> wrote:
--
On Tue, Jun 30, 2015 at 12:32 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
>
> ClogControlLock contention is high at commit time. This appears to be due to the fact that ClogControlLock is acquired in Exclusive mode prior to marking commit, which then gets starved by backends running TransactionIdGetStatus().
>
> Proposal for improving this is to acquire the ClogControlLock in Shared mode, if possible.
>This approach looks good way for avoiding the contention aroundClogControlLock. Few things that occurred to me while looking atpatch are thata. the semantics of new LWLock (CommitLock) introducedby patch seems to be different in the sense that it is just taken inExclusive mode (and no Shared mode is required) as per your proposal. Wecould use existing LWLock APi's, but on the other hand we could eveninvent new LWLock API for this kind of locking.
LWLock API code is already too complex, so -1 for more changes there
b. SimpleLruReadPage_ReadOnly() - This API's is meant mainly forread-access of page and the description also says the same, but nowwe want to use it for updating page as well. It might be better to inventsimilar new API or at the very least modify it's description.
Agreed, perhaps SimpleLruReadPage_Optimistic()
> Two concurrent writers might access the same word concurrently, so we protect against that with a new CommitLock. We could partition that by pageno also, if needed.
>I think it will be better to partition it or use it in some other way to avoidtwo concurrent writers block at it, however if you want to first see thetest results with this, then that is also okay.
Many updates would be on same page, so partitioning it would need to be at least 4-way to be worth doing. Maybe we could stripe into 512 bye pages.
Overall the idea seems good to pursue, however I have slight feelingthat using 2 LWLocks (CLOGControlLock in shared mode and newCommitLock in Exclusive mode) to set the transaction informationis somewhat odd, but I could not see any problem with it.
Perhaps call it the CommitSerializationLock would help. There are already locks that are held only in Exclusive mode.
Locking two separate resources at same time is common in other code.
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: