public inbox for [email protected]help / color / mirror / Atom feed
Setting huge_pages=off when HugePages are allocated in Linux? 5+ messages / 4 participants [nested] [flat]
* Setting huge_pages=off when HugePages are allocated in Linux? @ 2026-01-28 15:31 Ron Johnson <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Ron Johnson @ 2026-01-28 15:31 UTC (permalink / raw) To: Pgsql-admin <[email protected]> In the example in this (quite helpful) Cybertec post, 10475 HugePages are allocated. https://www.cybertec-postgresql.com/en/huge-pages-postgresql/ If we set "huge_pages = off" within PG and then restart PG, will Linux see those 10475 HugePages as off-limits to normal 4KiB allocations? -- Death to <Redacted>, and butter sauce. Don't boil me, I'm still alive. <Redacted> lobster! ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Setting huge_pages=off when HugePages are allocated in Linux? @ 2026-01-28 17:02 Laurenz Albe <[email protected]> parent: Ron Johnson <[email protected]> 0 siblings, 2 replies; 5+ messages in thread From: Laurenz Albe @ 2026-01-28 17:02 UTC (permalink / raw) To: Ron Johnson <[email protected]>; Pgsql-admin <[email protected]> On Wed, 2026-01-28 at 10:31 -0500, Ron Johnson wrote: > In the example in this (quite helpful) Cybertec post, 10475 HugePages are allocated. > https://www.cybertec-postgresql.com/en/huge-pages-postgresql/ > > If we set "huge_pages = off" within PG and then restart PG, will Linux see those 10475 HugePages as off-limits to normal 4KiB allocations? Yes. That's why it is a good idea to set "huge_pages = on" if you intend to use them with PostgreSQL. Otherwise it may happen that PostgreSQL resorts to allocating shared buffers using normal memory, and your huge pages just sit around and are wasted. Yours, Laurenz Albe ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Setting huge_pages=off when HugePages are allocated in Linux? @ 2026-01-29 11:31 Roland Müller <[email protected]> parent: Laurenz Albe <[email protected]> 1 sibling, 1 reply; 5+ messages in thread From: Roland Müller @ 2026-01-29 11:31 UTC (permalink / raw) To: Laurenz Albe <[email protected]>; +Cc: Ron Johnson <[email protected]>; Pgsql-admin <[email protected]> When does it make sense to use hugepages in Postgresql? Is usage of hugepages only available in release 18? Laurenz Albe <[email protected]> ezt írta (időpont: 2026. jan. 28., Sze 19:02): > On Wed, 2026-01-28 at 10:31 -0500, Ron Johnson wrote: > > In the example in this (quite helpful) Cybertec post, 10475 HugePages > are allocated. > > https://www.cybertec-postgresql.com/en/huge-pages-postgresql/ > > > > If we set "huge_pages = off" within PG and then restart PG, will Linux > see those 10475 HugePages as off-limits to normal 4KiB allocations? > > Yes. That's why it is a good idea to set "huge_pages = on" if you intend > to use them with > PostgreSQL. Otherwise it may happen that PostgreSQL resorts to allocating > shared buffers > using normal memory, and your huge pages just sit around and are wasted. > > Yours, > Laurenz Albe > > > ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Setting huge_pages=off when HugePages are allocated in Linux? @ 2026-01-29 14:57 Alicja Kucharczyk <[email protected]> parent: Roland Müller <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Alicja Kucharczyk @ 2026-01-29 14:57 UTC (permalink / raw) To: Roland Müller <[email protected]>; +Cc: Laurenz Albe <[email protected]>; Ron Johnson <[email protected]>; Pgsql-admin <[email protected]> > When does it make sense to use hugepages in Postgresql? > Usually when your shared memory footprint is very large, i.e. primarily very large shared_buffers. In practice, huge pages tend to pay off on dedicated, high-throughput systems where shared_buffers is really big (often tens of GB, and very commonly you start caring around ~100GB+) and you have high concurrency / tight latency goals. > Is usage of hugepages only available in release 18? > No, huge pages support has been around since PostgreSQL 9.4. But starting with PostgreSQL 15, it’s much easier to size/configure because PostgreSQL can tell you the required count via the runtime-computed setting shared_memory_size_in_huge_pages, before that you needed to calculate it on your own. regards, A.Kucharczyk ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Setting huge_pages=off when HugePages are allocated in Linux? @ 2026-01-29 15:09 Alicja Kucharczyk <[email protected]> parent: Laurenz Albe <[email protected]> 1 sibling, 0 replies; 5+ messages in thread From: Alicja Kucharczyk @ 2026-01-29 15:09 UTC (permalink / raw) To: Laurenz Albe <[email protected]>; +Cc: Ron Johnson <[email protected]>; Pgsql-admin <[email protected]> śr., 28 sty 2026 o 18:02 Laurenz Albe <[email protected]> napisał(a): > > In the example in this (quite helpful) Cybertec post, 10475 HugePages > are allocated. > > https://www.cybertec-postgresql.com/en/huge-pages-postgresql/ > > > > If we set "huge_pages = off" within PG and then restart PG, will Linux > see those 10475 HugePages as off-limits to normal 4KiB allocations? > > Yes. That's why it is a good idea to set "huge_pages = on" if you intend > to use them with > PostgreSQL. Otherwise it may happen that PostgreSQL resorts to allocating > shared buffers > using normal memory, and your huge pages just sit around and are wasted. > > Yours, > Laurenz Albe > I fully agree with Laurenz. And it’s basically the same story the other way around: if you set huge_pages = on but you reserved too many huge pages, the extra ones will also just sit there unused, i.e. wasted. What slightly worries me is this line in the docs: “While we need at least 3170 huge pages in this example, a larger setting would be appropriate if other programs on the machine also need huge pages.” I get what it’s trying to say (size for all consumers), but it can read a bit like “more is fine”. On a dedicated PostgreSQL server, “more” is usually just wasted memory unless you actually have another hugepage user. It might be worth adding a short note that unused huge pages don’t get used for regular memory allocations, so it’s best to size them as close to what you need as possible (especially on dedicated servers). regards, A.Kucharczyk ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-01-29 15:09 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-01-28 15:31 Setting huge_pages=off when HugePages are allocated in Linux? Ron Johnson <[email protected]> 2026-01-28 17:02 ` Laurenz Albe <[email protected]> 2026-01-29 11:31 ` Roland Müller <[email protected]> 2026-01-29 14:57 ` Alicja Kucharczyk <[email protected]> 2026-01-29 15:09 ` Alicja Kucharczyk <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox