Re: Lock contention high

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ashkil Dighin <ashkildighin76(at)gmail(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Lock contention high
Date: 2021-10-27 22:22:01
Message-ID: 2A5AB443-64E5-42DC-936A-C521ADD6B1BD@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

On October 27, 2021 2:44:56 PM PDT, Ashkil Dighin <ashkildighin76(at)gmail(dot)com> wrote:
>Hi,
>Yes, lock contention reduced with postgresqlv14.
>Lock acquire reduced 18% to 10%
>10.49 %postgres postgres [.] LWLockAcquire
>5.09% postgres postgres [.] _bt_compare
>
>Is lock contention can be reduced to 0-3%?

Probably not, or at least not easily. Because of the atomic instructions the locking also includes some other costs (e.g. cache misses, serializing store buffers,...).

There's a good bit we can do to increase the cache efficiency around buffer headers, but it won't get us quite that low I'd guess.

>On pg-stat-activity shown LwLock as “BufferCounter” and “WalInsert”

Without knowing what proportion they have to each and to non-waiting backends that unfortunately doesn't help that much..

Andres

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tim Slechta 2021-10-28 02:31:00 Views don't seem to use indexes?
Previous Message Ashkil Dighin 2021-10-27 21:44:56 Re: Lock contention high