Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3acc10c

Browse files
committed
Increase the number of buffer mapping partitions to 128.
Testing by Amit Kapila, Andres Freund, and myself, with and without other patches that also aim to improve scalability, seems to indicate that this change is a significant win over the current value and over smaller values such as 64. It's not clear how high we can push this value before it starts to have negative side-effects elsewhere, but going this far looks OK.
1 parent 9528726 commit 3acc10c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/backend/storage/lmgr/lwlock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ static LWLockTranche MainLWLockTranche;
7373

7474
/*
7575
* We use this structure to keep track of locked LWLocks for release
76-
* during error recovery. The maximum size could be determined at runtime
77-
* if necessary, but it seems unlikely that more than a few locks could
78-
* ever be held simultaneously.
76+
* during error recovery. Normally, only a few will be held at once, but
77+
* occasionally the number can be much higher; for example, the pg_buffercache
78+
* extension locks all buffer partitions simultaneously.
7979
*/
80-
#define MAX_SIMUL_LWLOCKS 100
80+
#define MAX_SIMUL_LWLOCKS 200
8181

8282
static int num_held_lwlocks = 0;
8383
static LWLock *held_lwlocks[MAX_SIMUL_LWLOCKS];

src/include/storage/lwlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
136136
*/
137137

138138
/* Number of partitions of the shared buffer mapping hashtable */
139-
#define NUM_BUFFER_PARTITIONS 16
139+
#define NUM_BUFFER_PARTITIONS 128
140140

141141
/* Number of partitions the shared lock tables are divided into */
142142
#define LOG2_NUM_LOCK_PARTITIONS 4

0 commit comments

Comments
 (0)