Benchmarking a Linux system measures how fast its CPU, memory, storage, and overall responsiveness are under controlled loads. This guide walks you through running standard open-source benchmarks, interpreting the results, and comparing them to known baselines. You’ll need a Linux machine with root or sudo access, internet access to install packages, and a basic comfort with the terminal.
What You’ll Need
- A Linux system (any mainstream distribution, e.g., Ubuntu, Debian, Fedora, Arch)
- Root or sudo privileges to install benchmark tools
- Internet connection to download packages
- At least 2 GB of free disk space for test files (for disk benchmarks)
- Basic familiarity with the command line
Step-by-Step
- Update your package list. Open a terminal and run
sudo apt update(on Debian/Ubuntu) or the equivalent for your distribution (e.g.,sudo dnf check-updateon Fedora,sudo pacman -Syon Arch). This ensures you get the latest versions of the benchmark tools. - Install the benchmark suite. For a comprehensive test, install
sysbench,hdparm, andfio. On Debian/Ubuntu:sudo apt install sysbench hdparm fio. On Fedora:sudo dnf install sysbench hdparm fio. On Arch:sudo pacman -S sysbench hdparm fio. If you prefer a single tool that covers CPU, memory, and disk,phoronix-test-suiteis a popular choice, but it’s heavier to set up. - Run a CPU benchmark.
sysbench cpu runruns a CPU performance test. It calculates prime numbers up to a limit (default 10000) and reports events per second. A higher number is better. For a more realistic test, you can specify the number of threads:sysbench cpu --threads=4 run(adjust 4 to your CPU’s core count). - Run a memory benchmark. Test memory read and write speeds with
sysbench memory run. This allocates a buffer (default 1 GB) and performs sequential read/write operations. The output shows the total data transferred and the throughput in MiB/s. Higher is better. For write tests, usesysbench memory --memory-oper=write run. - Run a disk benchmark with fio.
fiois more flexible than hdparm for realistic I/O patterns. Create a test file and run a sequential read test:fio --name=seqread --rw=read --bs=1m --size=2g --numjobs=1 --runtime=30 --group_reporting. This reads a 2 GB file in 1 MB blocks for 30 seconds. The output shows read IOPS and bandwidth (MB/s). Similarly, test sequential write:fio --name=seqwrite --rw=write --bs=1m --size=2g --numjobs=1 --runtime=30 --group_reporting. For random I/O (more representative of typical workloads), use--rw=randreador--rw=randwritewith a smaller block size (e.g.,--bs=4k). - Run a quick disk speed test with hdparm (optional). For a fast, rough read speed test, use
sudo hdparm -Tt /dev/sda(replace/dev/sdawith your actual disk device). The-Ttests cache read speed, and-ttests buffered disk read speed. This is not as thorough as fio, but it’s quick. - Record your results. Take note of the key numbers: CPU events per second, memory throughput (MiB/s), disk read/write bandwidth (MB/s), and IOPS. Save them in a file or spreadsheet for comparison.
- Compare with baselines. Search online for your specific CPU model, RAM type, and disk model to find typical benchmark results. Sites like Phoronix Test Suite’s OpenBenchmarking.org have community-submitted results. Compare your numbers to see if your system is performing as expected.
Common Mistakes
- Running benchmarks while the system is busy. Other processes, background updates, or even a web browser can skew results. Close all unnecessary applications and ideally run benchmarks from a terminal without a graphical desktop.
- Using the wrong disk device. Running hdparm on a partition (e.g.,
/dev/sda1) instead of the whole disk (/dev/sda) can give misleading results. Always use the whole disk device. - Not specifying the right block size. For disk benchmarks, block size matters. Using 1 MB for random I/O tests is unrealistic; typical workloads use 4 KB blocks. Match the block size to the workload you’re simulating.
- Ignoring thermal throttling. On laptops or small form-factor PCs, the CPU may throttle down under sustained load, reducing scores. Run a short test first to see if the system is already hot, and let it cool down between runs.
- Comparing results across different file systems. ext4, XFS, and Btrfs have different performance characteristics. When comparing, ensure the file system is the same.
Tips
- Run each benchmark multiple times. At least three runs per test, and take the median or average. This smooths out transient variations.
- Use the same benchmark version. If you’re comparing results from different systems, make sure the benchmark tool versions are the same, as they may have different optimization levels.
- Monitor system temperature. Use
sensors(from thelm-sensorspackage) to watch CPU temperature during benchmarks. If it exceeds 80°C (176°F), consider improving cooling before drawing conclusions. - For disk benchmarks, test the file system, not just the raw disk. fio tests on a file within your file system, which is what you actually experience. hdparm tests the raw disk, which is less representative.
- Consider using a full suite like Phoronix Test Suite. It automates many tests and can generate a comprehensive report, but it requires more setup and downloads.
Troubleshooting
- Command not found. If you get
sysbench: command not found, the package isn’t installed. Double-check the installation step and ensure you used the correct package manager for your distribution. - Permission denied. Some commands (like hdparm) require root. Use
sudobefore the command. If you still get permission errors, check that your user is in thesudogroup. - fio: failed to open file. This usually means the working directory is not writable. Run fio in a directory where you have write access, e.g.,
cd /tmpor your home directory. - Benchmark results are extremely low. Check if the system is under heavy load (run
top). Also ensure no other benchmark is running simultaneously. If it’s a laptop, check the power profile—it may be in power-saving mode. Switch to performance mode (sudo cpupower frequency-set -g performanceon many systems). - hdparm hangs. If hdparm seems stuck, the disk may be busy. Wait a few minutes, or try a different device. Also, some disks (especially SSDs) don’t respond well to hdparm’s cache test; use fio instead.
Frequently Asked Questions
Q: What is a good CPU benchmark score for sysbench?
A: It varies widely by CPU. A modern desktop CPU (e.g., Intel i5-12400) might get around 10,000 events per second with default settings. Older or low-power CPUs will score lower. Compare with online results for your specific model.
Q: Should I benchmark with all CPU cores or just one?
A: Both are useful. Single-threaded tests show per-core performance, while multi-threaded tests show overall throughput. Use --threads=1 for single-thread, and --threads=N (where N is your core count) for multi-thread.
Q: How long should a disk benchmark take?
A: With fio, you can set a runtime with --runtime=30 (seconds). A typical benchmark with a 2 GB file takes about a minute. For more thorough tests, use a larger file or longer runtime, but be prepared for it to take several minutes.
Q: Can I benchmark my system without installing anything?
A: Yes, you can use built-in tools like time to measure how long a command takes, but that’s not a standardized benchmark. For reliable results, installing dedicated tools is recommended.
Q: Why do my results vary between runs?
A: Background processes, thermal throttling, and system load can cause variation. Run multiple times and take the median. Also ensure the system is idle and cool.
Q: What is the difference between IOPS and throughput?
A: IOPS (input/output operations per second) measures how many read/write operations the disk can handle per second, which is critical for small random accesses. Throughput (MB/s) measures how much data can be transferred per second, which matters for large sequential transfers. Both are important depending on the workload.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Turn Off Shutter Sound on iPhone
- VPN Setup on iPhone SE: Step-by-Step Guide
- Fix Internet Not Working on Windows 11
- How to Limit Ad Tracking on iPhone Apps
- Fix Right Click Not Working in Firefox
- Compare Two Columns with Comma Separated Values in Excel