XMRig: RandomX CPU Mining & Benchmark Guide
In modern distributed computing and proof-of-work blockchain ecosystems, GPUs and dedicated ASICs historically dominated hash generation. However, late in 2019, Monero introduced the RandomX proof-of-work algorithm to counter ASIC centralization.
RandomX generates random code sequences executed in an isolated virtual machine directly on physical central processors. By demanding intensive L3 cache throughput, high memory bandwidth, robust branch prediction, and complex floating-point calculations, RandomX returned general-purpose consumer and server CPUs (such as AMD Ryzen and EPYC architectures) to the forefront of computation.
At the center of this architectural shift stands xmrig/xmrig.
With more than 10,200+ GitHub Stars and nearly 4,000 Forks, XMRig is recognized across the open-source community as the most efficient unified CPU and GPU miner available. Beyond cryptocurrency mining, hardware enthusiasts and system builders widely deploy XMRig as a rigorous, real-world CPU and memory stress-testing benchmark.
🌟 Architecture and Core Performance Features
Crafted in high-performance C and C++, XMRig achieves exceptional hardware utilization across modern architectures:
1. Vector Instructions and Multi-Arch Acceleration
- x86 and x64 Optimizations: Features hand-tuned assembly loops with AVX2, AVX-512, and Vector AES (VAES) support. Provides customized execution paths for AMD Zen 3, Zen 4, Zen 5, and Intel architectures.
- ARM64 and Apple Silicon: Native support for ARMv8 crypto extensions and NEON vector processing. Runs at full efficiency on Apple M series processors (M1 through M4), Raspberry Pi, and cloud ARM servers such as AWS Graviton.
- Pioneering RISC-V Support: Release v6.26.0 introduced vectorized RandomX main loops and automatic vector hardware AES discovery for RISC-V platforms.
2. Huge Pages Memory Allocation
- The RandomX scratchpad requires 2 MB of low-latency memory space per active worker thread.
- Standard operating system page sizes (4 KB) cause severe Translation Lookaside Buffer (TLB) misses and costly paging overhead.
- Enabling 2 MB Huge Pages or 1 GB Gigabyte Pages in XMRig reduces memory access latency dramatically, yielding a 30% to 50% increase in overall hash throughput.
3. Model Specific Register (MSR) Prefetcher Tuning
- Modern processors incorporate aggressive hardware prefetchers designed for sequential everyday computing tasks.
- In RandomX, where memory access patterns are intentionally non-linear, hardware prefetchers inadvertently flood the L3 cache with unwanted data lines.
- XMRig interacts directly with processor MSR registers (via
/dev/cpu/*/msron Linux or kernel helpers on Windows) to deactivate conflicting prefetchers, securing an additional 5% to 15% performance gain.
4. Cache-to-Thread Allocation Formula
Allocating more threads than your hardware cache can sustain triggers severe cache thrashing:
- Optimal Calculation:
Recommended Threads = Total L3 Cache (MB) / 2 MB - For example, an AMD Ryzen 7 5700X with 32 MB of L3 cache supports
32 / 2 = 16threads. - A CPU equipped with only 12 MB of L3 cache will achieve maximum efficiency at 6 threads, even if the CPU features 16 logical cores.
💻 Practical Usage: Benchmarks and Mining Setup
XMRig features an offline stress-testing and benchmark suite that runs without network access or pool configurations.
1. Offline RandomX Benchmark
Execute a standardized one-million hash benchmark:
xmrig --benchmark 1M --submit
Run a rapid diagnostic benchmark to verify system stability:
xmrig --benchmark
During execution, XMRig prints real-time details regarding detected instruction sets, Huge Pages allocation status, MSR tweaks, and individual core hash rates (H/s).
2. Basic Mining Pool Connection
XMRig can be launched with standard parameters or configured using a detailed config.json file:
./xmrig -o stratum+tcp://xmr-asia1.nanopool.org:14433 -u YOUR_WALLET_ADDRESS -p x --tls
⚡ Performance Optimization Guide
Follow these steps to unlock maximum performance on Linux workstations and servers:
1. Enable Huge Pages on Linux
Temporarily allocate 128 Huge Pages (2 MB each):
sudo sysctl -w vm.nr_hugepages=128
Make Huge Pages persistent across system reboots:
echo "vm.nr_hugepages=128" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
2. Grant MSR Driver Permissions
Run XMRig with root privileges or ensure the MSR module is loaded:
sudo modprobe msr
🚀 Fast Download Links via GH-Proxy
Accessing GitHub Releases directly can encounter intermittent latency or throttling. Use the GH-Proxy mirror service to download official release archives at full connection speed.
Direct Release Downloads (v6.26.0)
- Linux x86_64 Static Binary (Recommended for Ubuntu / Debian / CentOS): Download xmrig-6.26.0-linux-static-x64.tar.gz
- Windows x64 Official Archive (MSVC Build): Download xmrig-6.26.0-windows-x64.zip
- macOS ARM64 Archive (Apple Silicon M1 / M2 / M3 / M4): Download xmrig-6.26.0-macos-arm64.tar.gz
- Windows ARM64 Archive (Snapdragon X Elite / Laptops): Download xmrig-6.26.0-windows-arm64.zip
Linux Terminal One-Liner Download and Extraction
Download and unpack the latest release in a single stream:
curl -L https://gh-proxy.org/https://github.com/xmrig/xmrig/releases/download/v6.26.0/xmrig-6.26.0-linux-static-x64.tar.gz | tar -xz
cd xmrig-6.26.0
./xmrig --version
🛠️ Building from Source
To compile XMRig with compiler flags specific to your local processor architecture:
git clone https://gh-proxy.org/https://github.com/xmrig/xmrig.git
mkdir -p xmrig/build && cd xmrig/build
cmake .. -DWITH_HWLOC=OFF
make -j$(nproc)
The resulting binary will be ready inside the xmrig/build directory.
🔗 Project Links and Community Resources
- GitHub Repository: xmrig/xmrig
- GH-Proxy Mirror Service: gh-proxy.org Home
- Global CPU Benchmark Database: XMRig Benchmark Portal
- Configuration Generator: XMRig Config Wizard