How to Benchmark CPU Performance in Linux Terminal Using 7-Zip

Evaluating CPU compute capacity and multi-threaded scaling is a staple task for Linux system administrators, hardware hobbyists, and cloud engineers. While synthetic stress tools like stress-ng measure raw component endurance, real-world algorithmic workloads provide far more actionable data when comparing VPS instances, testing overclock stability, or profiling server deployments. One of the most respected, cross-platform benchmarks for assessing processor integer and memory latency throughput is the built-in benchmarking tool inside 7-Zip (7z b).

Because LZMA compression relies heavily on integer mathematical calculations, branch prediction accuracy, and L1/L2/L3 cache latency, the 7-Zip benchmark translates CPU performance into standardised Million Instructions Per Second (MIPS) metrics. This tutorial explains how to install 7-Zip on Linux distributions, run single-threaded and multi-threaded CPU benchmarks, test custom RAM dictionary sizes, and interpret your machine’s diagnostic ratings.

Installing 7-Zip on Modern Linux Distributions

Recent Linux distributions offer the modern 7zip package (the official C++ rewrite maintained by Igor Pavlov), while older releases carry the legacy p7zip port. Both packages provide the required benchmarking flag.

On Ubuntu, Debian, and Linux Mint

sudo apt update && sudo apt install 7zip -y

Note: If your release repository does not contain 7zip, install the standard legacy package via sudo apt install p7zip-full -y.

On Fedora, RHEL, and AlmaLinux

sudo dnf install 7zip -y

On Arch Linux and Manjaro

sudo pacman -S 7zip

Verify that the binary functions properly by checking its version information:

7z --help

Running the Default Multi-Threaded Benchmark

The simplest way to initiate the test is executing the benchmark command without arguments:

7z b

When triggered without parameters, 7-Zip executes two comprehensive workload phases:

  1. Compression Phase: Stresses CPU integer arithmetic, cache bandwidth, and memory subsystems by compressing simulated datasets using the LZMA algorithm.
  2. Decompression Phase: Stresses instruction pipelining and branch prediction logic by unpacking the compressed data structures.

By default, 7-Zip detects all available logical CPU cores (threads) and allocates a standard 32 MB dictionary size across multiple test passes, updating a real-time progress monitor in your terminal.

Customising Threads and RAM Allocation

Fine-tuning the benchmark parameters allows you to measure single-core IPC (Instructions Per Cycle), evaluate thread scaling efficiency, or push system memory bandwidth limits.

Benchmarking Single-Core CPU Performance

To measure the raw single-thread throughput of your processor without multi-core scaling distortion, restrict the thread count to 1 using the -mmt switch:

7z b -mmt1

Comparing the single-thread MIPS score against your multi-threaded score helps calculate your processor’s multi-core efficiency percentage.

Benchmarking Specific Core Counts

If you are provisioning a virtual machine with 4 virtual CPUs or wish to benchmark performance on physical performance cores (P-cores) alone, specify the designated thread count:

7z b -mmt4

Adjusting the Dictionary Buffer Size

The dictionary size determines how much RAM is occupied per thread during compression analysis. The default is 32 MB (-md=32m). To test larger cache boundaries or simulate enterprise archive pipelines, scale the dictionary up to 64 MB, 128 MB, or 256 MB:

7z b -md=64m

Caution: Larger dictionary sizes multiplied across high thread counts require substantial available RAM. Ensure your system does not swap to disk during execution.

Setting Custom Iteration Passes

To obtain a statistically robust benchmark score or verify thermal throttling over an extended period, specify the number of passes (e.g. 10 iterations):

7z b 10

To run 5 iterations restricted to 8 threads with a 64 MB dictionary size, combine all arguments in sequence:

7z b 5 -mmt8 -md=64m

Interpreting Benchmark Results and MIPS Scores

Upon completing the assigned iterations, 7-Zip prints a summary table formatted with granular performance metrics. The output is divided into columns:

Column Header Metric Description Analytical Purpose
Speed (KB/s) Real-time processing throughput Measures data compression throughput per second
Usage (%) Processor core utilisation Shows CPU scheduling efficiency (100% = 1 full core)
R/U Rating Rating divided by CPU Usage Normalised metric showing per-clock efficiency
Rating (MIPS) Absolute Million Instructions Per Second The primary benchmark score; higher numbers indicate greater performance

At the bottom of the table, review the Tot: line under the Total Rating section. This figure synthesises the overall average across compression and decompression passes, serving as your final comparative benchmark score.

Scripting and Logging Benchmark Results

To automate hardware benchmarking across multiple Linux servers or write results to a timestamped log file for reporting, redirect standard output using standard shell syntax:

7z b 3 -mmt$(nproc) > ~/cpu_benchmark_$(date +%Y%m%d_%H%M%S).txt

The $(nproc) variable automatically detects your system’s core count, ensuring the command executes dynamically across diverse server configurations.

Troubleshooting Common Benchmarking Problems

  • Command ‘7z’ not found: Ensure the package is installed. Depending on whether you installed 7zip or legacy p7zip-full, invoke either 7z b or 7za b.
  • System freezes or process killed (OOM): When running multi-threaded tests on systems with limited memory (such as 1 GB or 2 GB cloud VPS nodes), high thread counts combined with default dictionary sizes trigger the Linux Out-Of-Memory (OOM) killer. Mitigate this by explicitly reducing the dictionary size: 7z b -md=16m.
  • Inconsistent MIPS scores between runs: Variable results typically stem from aggressive thermal throttling, dynamic CPU governor states, or background processes. Set your CPU governor to high performance prior to testing: sudo cpupower frequency-set -g performance.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.