RE: Improve logging when using Huge Pages

From: "Shinoda, Noriyoshi (PN Japan FSIP)" <noriyoshi(dot)shinoda(at)hpe(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Subject: RE: Improve logging when using Huge Pages
Date: 2021-11-22 01:12:37
Message-ID: TU4PR8401MB1152ECB9368A5CCC9AB0835DEE9F9@TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sawada-san, Fujii-san,

Thank you for your reviews.

In a database with huge_pages = on / off explicitly set, if memory allocation fails, the instance cannot be started, so I think that additional logs are unnecessary.
The attached patch outputs the log only when huge_pages = try, and outputs the requested size if the acquisition of Huge Pages fails.

I have a completely different approach, setting GUC shared_memory_size_in_huge_pages to zero if the Huge Pages acquisition fails. This GUC is currently calculated independently of getting Huge Pages. The attached patch does not include this specification.

Regards,
Noriyoshi Shinoda

-----Original Message-----
From: Masahiko Sawada [mailto:sawada(dot)mshk(at)gmail(dot)com]
Sent: Thursday, November 11, 2021 2:45 PM
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>; Shinoda, Noriyoshi (PN Japan FSIP) <noriyoshi(dot)shinoda(at)hpe(dot)com>; PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>; Julien Rouhaud <rjuju123(at)gmail(dot)com>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>; Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Subject: Re: Improve logging when using Huge Pages

On Tue, Nov 2, 2021 at 1:24 AM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>
>
> On 2021/10/29 7:05, Justin Pryzby wrote:
> > Hi,
> >
> > On Wed, Oct 27, 2021 at 06:39:46AM +0000, Shinoda, Noriyoshi (PN Japan FSIP) wrote:
> >> Thank you for your comment.
> >> The attached patch stops message splitting.
> >> This patch also limits the timing of message output when huge_pages = try and HugePages is not used.
>
> The log message should be reported even when huge_pages=off (and huge
> pages are not used)? Otherwise we cannot determine whether huge pages
> are actually used or not when no such log message is found in the server log.
>
> Or it's simpler and more intuitive to log the message "Anonymous
> shared memory was allocated with huge pages" only when huge pages are
> successfully requested? If that message is logged, we can determine
> that huge pages are used whatever the setting is. OTOH, if there is no
> such message, we can determine that huge pages are not used for some
> reasons, e.g., OS doesn't support huge pages, shared_memory_type is not set to mmap, etc.

If users want to know whether the shared memory is allocated with huge pages, I think it’s more intuitive to emit the log only on success when huge_pages = on/try. On the other hand, I guess that users might want to use the message to adjust vm.nr_hugepages when it is not allocated with huge pages. In this case, it’d be better to log the message on failure with the request memory size (or whatever reason for the failure). That is, we end up logging such a message on failure when huge_pages = on/try.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

Attachment Content-Type Size
huge_pages_log_v10.diff application/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-11-22 01:23:15 Re: using extended statistics to improve join estimates
Previous Message Tomas Vondra 2021-11-22 00:47:28 Re: logical decoding and replication of sequences