Skip to main content

Performance tuning

RandomX is sensitive to memory setup. The two settings that matter most are huge pages and the MSR mod. Together they often make a large difference on the same CPU.

Huge pages​

RandomX reads a 2 GB dataset at random. Huge pages cut the cost of each lookup.

Linux​

Reserve huge pages for the current boot. 1280 pages of 2 MB covers the dataset plus one scratchpad per thread on most desktop CPUs:

sudo sysctl -w vm.nr_hugepages=1280

To keep the setting after a reboot:

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

Confirm XMRig picked them up. The startup log shows a HUGE PAGES line with a percentage. Aim for 100%.

Windows​

See Large pages on Windows.

1 GB pages​

Some Linux systems support 1 GB pages, which add a few percent more. Set "1gb-pages": true under randomx in the config. This needs root and CPU support.

MSR mod​

XMRig can write CPU model-specific registers to turn off hardware prefetchers that hurt RandomX. It does this when wrmsr is enabled and the miner has root (Linux) or Administrator (Windows) rights.

  • On Linux, the msr kernel module must be loaded: sudo modprobe msr.
  • On systems with Secure Boot, writing MSRs may be blocked.

Threads and cache​

RandomX needs about 2 MB of L3 cache per thread. Running more threads than your cache can hold lowers the total hashrate. XMRig picks a sensible count by default; leave it there unless you have measured a better one.

Leave a core free if you use the machine for other work.

Why not to mine inside WSL2​

WSL2 runs Linux inside a lightweight Hyper-V virtual machine. From inside it:

  • Huge pages are not passed through from Windows in the usual setup.
  • MSR writes are blocked, so the MSR mod can’t run.
  • Memory is managed by the VM, which adds overhead to every dataset read.

The result is a large drop in hashrate compared with the native Windows miner on the same CPU. Use the native Windows binaries where you can.

Laptops and thermals​

RandomX keeps the CPU at full load. On laptops, plug in and watch temperatures. Throttling will lower hashrate more than any config change can raise it.