How to Benchmark CPU and Memory Performance in Ubuntu Using sysbench

Whether you have deployed a new Ubuntu virtual private server (VPS), upgraded a physical desktop’s CPU and RAM, or want to evaluate server performance under load, measuring computational throughput with quantitative benchmarks is essential. Standard monitoring tools like top or htop show current utilization, but they do not provide objective performance scores.

The standard multi-purpose benchmarking suite for Linux systems is sysbench. Originally developed to stress-test MySQL databases, sysbench includes modular subsystems designed specifically for testing CPU arithmetic throughput, multi-threaded task distribution, and memory bandwidth without complex configurations.

Step 1: Install sysbench on Ubuntu

The sysbench package is maintained in the standard Ubuntu universe repository:

  1. Open the Ubuntu Terminal (Ctrl + Alt + T) or connect via SSH.
  2. Update your package index and install sysbench:
sudo apt update
sudo apt install -y sysbench

Once installed, verify the installation by checking the version:

sysbench --version

Step 2: Benchmark Single-Core CPU Performance

The sysbench CPU benchmark measures how quickly the processor can calculate prime numbers up to a specified limit. To establish a baseline single-core score:

sysbench cpu --cpu-max-prime=20000 --threads=1 run

Evaluate the key performance metrics in the output report:

CPU speed:
    events per second:   942.15

Throughput:
    events/s (eps):      942.15
    time elapsed:        10.0003s
    total number of events: 9422

Latency (ms):
         min:                                  1.04
         avg:                                  1.06
         max:                                  1.38
         95th percentile:                      1.10

The most important figure is events per second. A higher number indicates superior single-thread processing speed. The 95th percentile latency indicates consistency; lower, tighter latency figures demonstrate stable clock frequencies without thermal throttling.

Step 3: Benchmark Multi-Core CPU Performance

Modern workloads rely heavily on parallel multi-threading. To evaluate total multi-core performance, set the --threads flag to match your processor’s total thread count (or check your available logical cores with nproc):

sysbench cpu --cpu-max-prime=20000 --threads=$(nproc) run

Compare the resulting events per second against your single-thread test. On a well-cooled 8-core / 16-thread CPU, your events per second should scale approximately 10x to 14x higher, demonstrating efficient multi-thread parallelization.

Step 4: Benchmark RAM Read and Write Bandwidth

Memory throughput plays a massive role in database performance, compiler operations, and container responsiveness. Sysbench tests RAM performance by allocating memory blocks and measuring transfer speed:

sysbench memory --memory-block-size=1M --memory-total-size=10G --memory-oper=write run

In this test:

  • --memory-block-size=1M: Writes memory in 1-megabyte chunks.
  • --memory-total-size=10G: Transfers a total of 10 gigabytes of data.
  • --memory-oper=write: Tests sequential memory write bandwidth (you can also specify read).

Evaluate the resulting transfer speed metric:

Total operations: 10240 (1023.82 per second)
10240.00 MiB transferred (10238.21 MiB/sec)

The MiB transferred (MiB/sec) value reflects your real-world memory bandwidth. Modern DDR4 systems typically output between 8,000 and 15,000 MiB/s, while high-speed DDR5 channels easily exceed 20,000 to 35,000 MiB/s.

Best Practices for Clean Benchmark Results

To ensure valid, reproducible benchmarking data:

  • Close Resource-Intensive Apps: Terminate browsers, database engines, and background cron jobs before testing.
  • Monitor Thermal Throttling: Run watch -n 1 vcgencmd measure_temp or sensors in a separate terminal window to ensure temperatures remain below critical thermal limits.
  • Run Multiple Passes: Execute each test three times and average the results to account for transient background OS interrupts.

Using sysbench provides an objective, lightweight, and standardised method to evaluate Ubuntu compute performance and verify hardware stability.

Get the best tech tips delivered straight to your inbox.

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