Enable hugepages on Proxmox 8 for XMRig container

12 February 2025

To configure Proxmox 8 so that XMRig can take full advantage of hugepages, we must know how many huge pages you need. The XMRig documentation recommends 1280 pages "per NUMA node" for RandomX algorithms and 128 per system for other algorithms.

Note that 1280 pages means 2560 MB of memory will be reserved on the host and will not available for system, container or virtual machine use.

To check the current configuration:

sysctl vm.nr_hugepages

To reserve hugepages until next boot:

sysctl -w vm.nr_hugepages=1280

To persist hugepages reservation on boot:

echo 'vm.nr_hugepages=1280' | tee /etc/sysctl.d/20-hugepages.conf

In the future, I want to create a custom snippet to enable or increase hugepages to >=1280 pages upon starting an XMRig container and reduce or disable them up stopping the container. That way we won't be trying up memory when it's not being used.

Hugepages may be used by other software, including KVM. Leaving some reserved is probably more widely beneficial.