Re: Auto-tune shared_buffers to use available huge pages

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Auto-tune shared_buffers to use available huge pages
Date: 2026-01-26 13:16:45
Message-ID: CAO6_XqrPdvW1UpE7WrzF7KhqMP7+YxxUNEMDE8WB__A7DZ4QoA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 23, 2026 at 4:50 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Not expressing an opinion on whether we should do this, but
> there is a comment on GetHugePageSize() that you seem to have
> falsified without bothering to correct:

Thanks for the review, I've updated the comment.

I've also revised the approach a bit. Using the free huge pages for
auto-tuning was too restrictive, it prevents setup like running
multiple Postgres on the same instance, which would require splitting
the available huge pages.

I've replaced it with a shared_buffers_autotune_target GUC, which
controls the amount of shared memory to target. If the requested
shared memory is below the target size, shared_buffers will be
increased to (approximately) reach this target.

By setting shared_buffers_autotune_target to the amount of available
huge pages, shared_buffers will be auto-tuned to use the leftover
space.

Regards,
Anthonin Bonnefoy

Attachment Content-Type Size
v2-0001-Create-dedicated-shmem-Autotune-functions.patch application/octet-stream 17.9 KB
v2-0004-Add-new-auto-tune-shared_buffers-GUC.patch application/octet-stream 7.8 KB
v2-0003-Pass-NBuffers-as-parameter-to-StrategyShmemSize.patch application/octet-stream 2.6 KB
v2-0002-Add-GUC-for-checkpointer-request-queue-size.patch application/octet-stream 7.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-01-26 13:24:15 Re: Use correct collation in pg_trgm
Previous Message Aleksander Alekseev 2026-01-26 13:06:35 Re: Time to drop RADIUS support?