Re: Thoughts about NUM_BUFFER_PARTITIONS - Mailing list pgsql-hackers

From wenhui qiu
Subject Re: Thoughts about NUM_BUFFER_PARTITIONS
Date
Msg-id CAGjGUAKeTV2SUmWO90dqZgQjpqYUEMOL1==1fDVFc=+6ZJ8hhQ@mail.gmail.com
Whole thread Raw
In response to Re: Thoughts about NUM_BUFFER_PARTITIONS  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Thoughts about NUM_BUFFER_PARTITIONS
List pgsql-hackers
Hi Heikki Linnakangas 
    I think the larger shared buffer  higher the probability of multiple backend processes accessing the same bucket slot BufMappingLock simultaneously, (   InitBufTable(NBuffers + NUM_BUFFER_PARTITIONS); When I have free time, I want to do this test. I have seen some tests, but the result report is in Chinese


Best wishes

Heikki Linnakangas <hlinnaka@iki.fi> 于2024年2月8日周四 19:26写道:
On 08/02/2024 12:17, wenhui qiu wrote:
> HI hackers
>      When I read this text in this document there is a paragraph in
> it(https://www.interdb.jp/pg/pgsql08/03.html
> <https://www.interdb.jp/pg/pgsql08/03.html>)
> /*
> The BufMappingLock is split into partitions to reduce contention in the
> buffer table (the default is 128 partitions). Each BufMappingLock
> partition guards a portion of the corresponding hash bucket slots.
> */,
>
> Physical servers with terabytes of RAM are now commonplace,I'm looking
> at the comments inside the source code.I'm looking at the comments
> inside the source code to see if they still match the current hardware
> capability?

The optimal number of partitions has more to do with the number of
concurrent processes using the buffer cache, rather than the size of the
cache. The number of CPUs in servers has increased too, but not as much
as RAM.

But yeah, it's a valid question if the settings still make sense with
modern hardware.

> The  comment says that in the future there may be a
> parameter,Iam a  dba now and I try to think of implementing this
> parameter, but I'm not a professional kernel developer, I still want the
> community senior developer to implement this parameter

The first thing to do would be to benchmark with different
NUM_BUFFER_PARTITIONS settings, and see if there's benefit in having
more partitions.

--
Heikki Linnakangas
Neon (https://neon.tech)

pgsql-hackers by date:

Previous
From: Mats Kindahl
Date:
Subject: Re: glibc qsort() vulnerability
Next
From: James Coleman
Date:
Subject: Re: Question about behavior of deletes with REPLICA IDENTITY NOTHING