sysctl.si › Parameters › vm.nr_hugepages
vm.nr_hugepages
Number of reserved 2 MB huge pages, used by databases to cut page-table overhead.
- Default
- 0
- Typical value
- shared_buffers / 2 MB plus 5%
When to change it
Reserve huge pages for PostgreSQL or similar software to cut page-table overhead. Reserved memory cannot be used for anything else.
Check the current value
sysctl vm.nr_hugepages
Change it until the next reboot
sudo sysctl -w vm.nr_hugepages=VALUE
Replace VALUE with the number that fits your server. The generator can size it for you.
Make it permanent
echo "vm.nr_hugepages = VALUE" | sudo tee /etc/sysctl.d/99-custom.conf sudo sysctl --system
Related parameters
vm.swappiness · vm.dirty_ratio · vm.dirty_background_ratio · vm.overcommit_memory · vm.max_map_count · vm.min_free_kbytes
Generate a full sysctl config for your server
Values are starting points. Test on a staging machine and measure before and after.