pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
12+ messages / 5 participants
[nested] [flat]

Commits from this thread:
  2024-10-18 9e2d813d59 053b6daeb9 0f4045814f ff0713d181  Adjust documentation for configuring Linux huge pages.
* Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-11 08:25  Seino Yuki <seinoyu@oss.nttdata.com>
  0 siblings, 2 replies; 12+ messages in thread

From: Seino Yuki @ 2024-10-11 08:25 UTC (permalink / raw)
  To: pgsql-hackers

Hello,

Add a reference method for shared_memory_size_in_huge_pages
with the "SHOW" command.

The current documentation explains the use of the postgres -C command,
but this method may be limited in DBaaS or managed service environments.
In particular, CloudNativePG does not allow the server to be stopped,
making the execution of $ postgres -C impossible.

Alternatively, the "SHOW" command can be used, though the documentation 
states,
"Note that the server must be shut down to view this runtime-computed 
parameter.[1]"
This wording could be misunderstood to imply that the parameter cannot 
be accessed
while the server is running.

[1] - 
https://www.postgresql.org/docs/devel/kernel-resources.html#LINUX-HUGE-PAGES

Regards,
--
Yuki Seino
NTT DATA CORPORATION

Attachments:

v1-0001-shared_memory_size_in_huge_pages_using_show.patch (text/x-diff, 809B) download diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 2c4d5ef640..aaac025c90 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1441,6 +1441,17 @@ $ <userinput>grep ^Hugepagesize /proc/meminfo</userinput> Hugepagesize: 2048 kB $ <userinput>ls /sys/kernel/mm/hugepages</userinput> hugepages-1048576kB hugepages-2048kB +</programlisting> + + If the server is running, this parameter can be viewed using the + <command>SHOW</command> command. + This might look like: +<programlisting> +postgres=# <userinput>SHOW shared_memory_size_in_huge_pages;</userinput> + shared_memory_size_in_huge_pages +---------------------------------- + 3170 +(1 row) </programlisting> In this example the default is 2MB, but you can also explicitly request
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 00:31  Michael Paquier <michael@paquier.xyz>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  1 sibling, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2024-10-16 00:31 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; +Cc: pgsql-hackers

On Fri, Oct 11, 2024 at 05:25:04PM +0900, Seino Yuki wrote:
> Alternatively, the "SHOW" command can be used, though the documentation
> states,
> "Note that the server must be shut down to view this runtime-computed
> parameter.[1]"
> This wording could be misunderstood to imply that the parameter cannot be
> accessed
> while the server is running.

I am not sure that neither mentioning nor recommending SHOW for this
area is a good idea, the point being to encourage its use before the
server is running as we don't want to allocate anything when tuning
it.

Point taken that the current wording can be confusing because of the
"*must* be shut down".  How about doing a simpler s/must/should/ for a
softer wording?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 01:26  Nathan Bossart <nathandbossart@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Nathan Bossart @ 2024-10-16 01:26 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers

On Wed, Oct 16, 2024 at 09:31:49AM +0900, Michael Paquier wrote:
> I am not sure that neither mentioning nor recommending SHOW for this
> area is a good idea, the point being to encourage its use before the
> server is running as we don't want to allocate anything when tuning
> it.

Agreed.

> Point taken that the current wording can be confusing because of the
> "*must* be shut down".  How about doing a simpler s/must/should/ for a
> softer wording?

Well, the point is that you can't use "postgres -C" to view this GUC while
the server is running.  I can see how the present wording might be
misinterpreted, though.  Perhaps we should change this sentence to
something like:

	Note that the server must be shut down to view this runtime-computed
	parameter with the postgres command.

-- 
nathan





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 01:46  David G. Johnston <david.g.johnston@gmail.com>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  1 sibling, 0 replies; 12+ messages in thread

From: David G. Johnston @ 2024-10-16 01:46 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; +Cc: pgsql-hackers

On Friday, October 11, 2024, Seino Yuki <seinoyu@oss.nttdata.com> wrote:

>
>
> The current documentation explains the use of the postgres -C command,
> but this method may be limited in DBaaS or managed service environments.
> In particular, CloudNativePG does not allow the server to be stopped,
> making the execution of $ postgres -C impossible.


If your environment doesn’t allow shutting down the Postgres service it
seems highly unlikely you’d be able to perform the other low-level
operating system actions required here as well.

I think the wording is fine as-is, though for consistency with an earlier
mention on the page we could instead write:

This parameter can be viewed before starting the server with a postgres command
like:

David J.

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 05:18  Michael Paquier <michael@paquier.xyz>
  parent: Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2024-10-16 05:18 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers

On Tue, Oct 15, 2024 at 08:26:06PM -0500, Nathan Bossart wrote:
> Well, the point is that you can't use "postgres -C" to view this GUC while
> the server is running.  I can see how the present wording might be
> misinterpreted, though.  Perhaps we should change this sentence to
> something like:
> 
> 	Note that the server must be shut down to view this runtime-computed
> 	parameter with the postgres command.

I'm OK with the "postgres command" addition.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 06:31  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Fujii Masao @ 2024-10-16 06:31 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; Nathan Bossart <nathandbossart@gmail.com>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers



On 2024/10/16 14:18, Michael Paquier wrote:
> On Tue, Oct 15, 2024 at 08:26:06PM -0500, Nathan Bossart wrote:
>> Well, the point is that you can't use "postgres -C" to view this GUC while
>> the server is running.  I can see how the present wording might be
>> misinterpreted, though.  Perhaps we should change this sentence to
>> something like:
>>
>> 	Note that the server must be shut down to view this runtime-computed
>> 	parameter with the postgres command.
> 
> I'm OK with the "postgres command" addition.

Another idea is to use the same wording as for num_os_semaphores in runtime.sgml, like this:

     This parameter can be viewed
     before starting the server with a <command>postgres</command> command like:

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION






^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-16 14:44  Nathan Bossart <nathandbossart@gmail.com>
  parent: Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Nathan Bossart @ 2024-10-16 14:44 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: Michael Paquier <michael@paquier.xyz>; Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers

On Wed, Oct 16, 2024 at 03:31:05PM +0900, Fujii Masao wrote:
> Another idea is to use the same wording as for num_os_semaphores in runtime.sgml, like this:
> 
>     This parameter can be viewed
>     before starting the server with a <command>postgres</command> command like:

WFM

-- 
nathan





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-17 05:07  Seino Yuki <seinoyu@oss.nttdata.com>
  parent: Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Seino Yuki @ 2024-10-17 05:07 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Fujii Masao <masao.fujii@oss.nttdata.com>; Michael Paquier <michael@paquier.xyz>; pgsql-hackers

Thank you, everyone.

> the point being to encourage its use before the server is running
> as we don't want to allocate anything when tuning it.
I was mistaken and now understand that it needs to be run before the 
server is running.

>> Another idea is to use the same wording as for num_os_semaphores in 
>> runtime.sgml, like this:
> 
> WFM
I've fixed the patch and will register it in the CF.

Regards,
--
Yuki Seino
NTT DATA CORPORATION

Attachments:

v2-0001-shared_memory_size_in_huge_pages_docfix.patch (text/x-diff, 871B) download diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 2c4d5ef640..63669f2d2e 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1431,9 +1431,9 @@ export PG_OOM_ADJUST_VALUE=0 the operating system to provide enough huge pages of the desired size. To determine the number of huge pages needed, use the <command>postgres</command> command to see the value of - <xref linkend="guc-shared-memory-size-in-huge-pages"/>. Note that the - server must be shut down to view this runtime-computed parameter. - This might look like: + <xref linkend="guc-shared-memory-size-in-huge-pages"/>. This parameter + can be viewed before starting the server with a <command>postgres</command> + command like: <programlisting> $ <userinput>postgres -D $PGDATA -C shared_memory_size_in_huge_pages</userinput> 3170
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-17 21:59  Nathan Bossart <nathandbossart@gmail.com>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Nathan Bossart @ 2024-10-17 21:59 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; +Cc: Fujii Masao <masao.fujii@oss.nttdata.com>; Michael Paquier <michael@paquier.xyz>; pgsql-hackers

On Thu, Oct 17, 2024 at 02:07:32PM +0900, Seino Yuki wrote:
> I've fixed the patch and will register it in the CF.

Thanks.  Here is what I have staged for commit.

-- 
nathan

Attachments:

v3-0001-Adjust-documentation-for-configuring-Linux-huge-p.patch (text/plain, 1.9K) download From 8aff8ec54a6588614f952693f509b75bf240851c Mon Sep 17 00:00:00 2001 From: Nathan Bossart <nathan@postgresql.org> Date: Thu, 17 Oct 2024 16:56:52 -0500 Subject: [PATCH v3 1/1] Adjust documentation for configuring Linux huge pages. The present wording about viewing shared_memory_size_in_huge_pages seems to suggest that the parameter cannot be viewed after startup at all, whereas the intent is to make it clear that you can't use "postgres -C" to view this GUC while the server is running. This commit rephrases this section to remove the ambiguity. Author: Seino Yuki Reviewed-by: Michael Paquier, David G. Johnston, Fujii Masao Discussion: https://postgr.es/m/420584fd274f9ec4f337da55ffb3b790%40oss.nttdata.com Backpatch-through: 15 --- doc/src/sgml/runtime.sgml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 2c4d5ef640..a47fa67b38 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1429,11 +1429,10 @@ export PG_OOM_ADJUST_VALUE=0 with <varname>CONFIG_HUGETLBFS=y</varname> and <varname>CONFIG_HUGETLB_PAGE=y</varname>. You will also have to configure the operating system to provide enough huge pages of the desired size. - To determine the number of huge pages needed, use the - <command>postgres</command> command to see the value of - <xref linkend="guc-shared-memory-size-in-huge-pages"/>. Note that the - server must be shut down to view this runtime-computed parameter. - This might look like: + The runtime-computed parameter + <xref linkend="guc-shared-memory-size-in-huge-pages"/> reports the number + of huge pages required. This parameter can be viewed before starting the + server with a <command>postgres</command> command like: <programlisting> $ <userinput>postgres -D $PGDATA -C shared_memory_size_in_huge_pages</userinput> 3170 -- 2.39.5 (Apple Git-154)
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-17 22:10  Michael Paquier <michael@paquier.xyz>
  parent: Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2024-10-17 22:10 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; pgsql-hackers

On Thu, Oct 17, 2024 at 04:59:54PM -0500, Nathan Bossart wrote:
> Thanks.  Here is what I have staged for commit.

Fine by me.  Thanks.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-18 05:47  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Fujii Masao @ 2024-10-18 05:47 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; Nathan Bossart <nathandbossart@gmail.com>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers



On 2024/10/18 7:10, Michael Paquier wrote:
> On Thu, Oct 17, 2024 at 04:59:54PM -0500, Nathan Bossart wrote:
>> Thanks.  Here is what I have staged for commit.
> 
> Fine by me.  Thanks.

LGTM, too. Thanks!

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION






^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command.
@ 2024-10-18 15:22  Nathan Bossart <nathandbossart@gmail.com>
  parent: Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 0 replies; 12+ messages in thread

From: Nathan Bossart @ 2024-10-18 15:22 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: Michael Paquier <michael@paquier.xyz>; Seino Yuki <seinoyu@oss.nttdata.com>; pgsql-hackers

On Fri, Oct 18, 2024 at 02:47:37PM +0900, Fujii Masao wrote:
> On 2024/10/18 7:10, Michael Paquier wrote:
>> Fine by me.  Thanks.
> 
> LGTM, too. Thanks!

Committed.

-- 
nathan





^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2024-10-18 15:22 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-11 08:25 Doc: shared_memory_size_in_huge_pages with the "SHOW" command. Seino Yuki <seinoyu@oss.nttdata.com>
2024-10-16 00:31 ` Michael Paquier <michael@paquier.xyz>
2024-10-16 01:26   ` Nathan Bossart <nathandbossart@gmail.com>
2024-10-16 05:18     ` Michael Paquier <michael@paquier.xyz>
2024-10-16 06:31       ` Fujii Masao <masao.fujii@oss.nttdata.com>
2024-10-16 14:44         ` Nathan Bossart <nathandbossart@gmail.com>
2024-10-17 05:07           ` Seino Yuki <seinoyu@oss.nttdata.com>
2024-10-17 21:59             ` Nathan Bossart <nathandbossart@gmail.com>
2024-10-17 22:10               ` Michael Paquier <michael@paquier.xyz>
2024-10-18 05:47                 ` Fujii Masao <masao.fujii@oss.nttdata.com>
2024-10-18 15:22                   ` Nathan Bossart <nathandbossart@gmail.com>
2024-10-16 01:46 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox