Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY1Ti-00DtFq-UL for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 10:17:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rY1Tg-00GShv-Tm for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 10:17:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY1Tg-00GShm-Kb for pgsql-hackers@lists.postgresql.org; Thu, 08 Feb 2024 10:17:56 +0000 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rY1TZ-0066aj-12 for pgsql-hackers@postgresql.org; Thu, 08 Feb 2024 10:17:55 +0000 Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-dc6d9a8815fso1689474276.3 for ; Thu, 08 Feb 2024 02:17:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707387467; x=1707992267; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jKEqDyyOCvuxhMPzncX8AfbD3GG26MepXgeemcFHhL0=; b=JwgEM4qdALzBthTUvXTsAmc2bdgqIN8wrlwzDt0j4DrdpIP54RdYf1C1b49OJi1Ob6 aHjcG6yTeRoYPyBjVVw5Hw1/29pXz+L/kUw5MiPlpchrM3gm42wi5JtLwIniyM0EbgY3 B+HAJf5TWgYZ806IuZuk3307DD0Zn3CJiiiXAQzvORj1DnPQ9xFnRAK1iDoM/hUDUpsM u4fODgMlqHoy9B5WGaKOtpYy/NkOZAwoETIwO1UJ0ExxBUBDBKxZqDJ2MraEIaKNiKdT o2bxn8/lzdAnqlmO2SISZVqA2iTS4GvEhHe93Jc3LY+cV6bZkktJbucBhbwL6P1x8mCs c/Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707387467; x=1707992267; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jKEqDyyOCvuxhMPzncX8AfbD3GG26MepXgeemcFHhL0=; b=k/P3vTquZRw+iZxepBm5cKZ8xIXO2AZHa2cvBwmP/f2K3Em770+0mxSVHM9mhAmniH +AdptOD8UOPXwWOxA22ftOyz44zIPEeffo44WC/X60XObS0Afq082IsqV8ycIt25NrGz BNIghy5gwverHDHoBPw5X0Nxh7aAh4HayTXmfcpOLmY0uCE5alofe8vikmWrJyawmDj1 65QT9od8oXuK6zNIBfAzfyJxOgwAWwICPlK9KNG+xTnVDILMbIRvx3O7WViU500v0kj/ knjzQfJ+OkzxFyWU5CC2jOLmIMo/aACofslQroC5zt0n+F3F+a40NAuW9cnrrmC6VLNq ON+g== X-Gm-Message-State: AOJu0YyRK2xhJ/LuXkiSXvvS7RbntyRz4binmIXBN80T3Uf4iWwVwUzN xVcbFYqDkkbQ5bVR58wlMJGIc1vXN0askiF4j+anQwiRON9NbYVCmltLNy/PebPrq/MwOUZgBgH EuM7AqSYyQ7t4yxAiFJWRpYygIjbSXhhU2y0= X-Google-Smtp-Source: AGHT+IFX0PiZsEtWRM70QNKAgkVrePGo53J79qNZ1ZJkV/EXVGSmsfg03P/1Hv5I1gvRwhjBZ+vBUb4uVZip4QO/F+o= X-Received: by 2002:a25:9707:0:b0:db5:4ece:ad01 with SMTP id d7-20020a259707000000b00db54ecead01mr8513803ybo.25.1707387467075; Thu, 08 Feb 2024 02:17:47 -0800 (PST) MIME-Version: 1.0 From: wenhui qiu Date: Thu, 8 Feb 2024 18:17:36 +0800 Message-ID: Subject: Thoughts about NUM_BUFFER_PARTITIONS To: pgsql-hackers Content-Type: multipart/alternative; boundary="0000000000007814950610dc1f50" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007814950610dc1f50 Content-Type: text/plain; charset="UTF-8" HI hackers When I read this text in this document there is a paragraph in it( 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 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 /* * It's a bit odd to declare NUM_BUFFER_PARTITIONS and NUM_LOCK_PARTITIONS * here, but we need them to figure out offsets within MainLWLockArray, and * having this file include lock.h or bufmgr.h would be backwards. */ /* Number of partitions of the shared buffer mapping hashtable */ #define NUM_BUFFER_PARTITIONS 128 /* * The number of partitions for locking purposes. This is set to match * NUM_BUFFER_PARTITIONS for now, on the basis that whatever's good enough for * the buffer pool must be good enough for any other purpose. This could * become a runtime parameter in future. */ #define DSHASH_NUM_PARTITIONS_LOG2 7 #define DSHASH_NUM_PARTITIONS (1 << DSHASH_NUM_PARTITIONS_LOG2) --0000000000007814950610dc1f50 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
HI hackers
=C2=A0 =C2=A0 When I read this text in this= document there is a paragraph in it(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 guard= s a portion of the corresponding hash bucket slots.
*/,

Physical = servers with terabytes of RAM are now commonplace,I'm looking at the co= mments inside the source code.I'm looking at the comments inside the so= urce code to see if they still match the current hardware capability? The = =C2=A0comment says that in the future there may be a parameter,Iam a =C2=A0= 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 develope= r to implement this parameter

/*
=C2=A0* It's a bit odd to de= clare NUM_BUFFER_PARTITIONS and NUM_LOCK_PARTITIONS
=C2=A0* here, but we= need them to figure out offsets within MainLWLockArray, and
=C2=A0* hav= ing this file include lock.h or bufmgr.h would be backwards.
=C2=A0*/
/* Number of partitions of the shared buffer mapping hashtable */
#= define NUM_BUFFER_PARTITIONS =C2=A0128

/*
=C2=A0* The number of p= artitions for locking purposes.=C2=A0 This is set to match
=C2=A0* NUM_B= UFFER_PARTITIONS for now, on the basis that whatever's good enough for<= br>=C2=A0* the buffer pool must be good enough for any other purpose.=C2=A0= This could
=C2=A0* become a runtime parameter in future.
=C2=A0*/#define DSHASH_NUM_PARTITIONS_LOG2 7
#define DSHASH_NUM_PARTITIONS (1 &= lt;< DSHASH_NUM_PARTITIONS_LOG2)

--0000000000007814950610dc1f50--