5 ms·
Interesting - would you be able to expand a bit on why hugepages makes a difference for Postgres? I have only the most basic knowledge of hugepages - picked up
by pocketarc 4y ago
Interesting - would you be able to expand a bit on why hugepages makes a difference for Postgres?
I have only the most basic knowledge of hugepages - picked up on it being a necessity for stable performance in VMs, but don't understand why it would matter for Postgres as well.
And do you end up having to configure Postgres to use hugepages, or does it pick them up automatically?
- gladiatr72 4y agoIt's the difference of configuring the kernel to pre-allocate the contiguous memory for huge page allocation vs. _transparent_ huge pages that requires the kernel compaction process. Postgresql needs to be reconfigured to use them properly. The shared_buffers setting needs to be adjusted to allocate in [huge page size] units.
- pocketarc 4y agoI appreciate that, thanks for the explanation. I understand the difference between hugepages and transparent huge pages, I just don't understand how not using hugepages was impacting the parent's Postgres, or causing OOM errors. @menaerus actually has a great comment on this that digs deeper into it, looking forward to seeing what comes out of that thread as well.
- gnfargbl 4y agoI gave a more detailed response on the post by 'menaerus, but to answer your question on config directly, you first need to enable the appropriate number of hugepages with a kernel boot parameter, e.g. hugepagesz=1G hugepages=940 and then add these config lines to postgresql.conf: huge_pages = on huge_page_size = 1GB