Home How ToHow to Benchmark a Linux Server: CPU, Disk and Network

How to Benchmark a Linux Server: CPU, Disk and Network

by Knowledge Base Linux
Benchmark Linux server performance with CPU disk and network gauges

You just provisioned a new VPS — but is it actually as fast as the provider promised? The only way to know is to benchmark a Linux server yourself. A proper benchmark measures CPU, disk and network performance separately, giving you a baseline to compare providers, detect noisy neighbors and verify upgrades. In this guide you will benchmark a Linux server with three standard tools: sysbench for CPU, fio for disk, and iperf3 for network.

Before You Benchmark a Linux Server

Benchmarks are only useful if they are repeatable and fair. Keep these rules in mind:

  • Run benchmarks on an idle system — other workloads skew results
  • Run each test at least twice and compare; big variations on a VPS hint at oversold hardware
  • Record results with dates, so you can spot degradation months later
  • Do not run aggressive disk tests on production servers with live databases

It also helps to know your machine’s basic specs first — see our guides on how to check RAM on Linux and how to check disk space if you need a refresher.

Step 1: Install the Benchmark Tools – How to Benchmark a Linux Server

# Ubuntu / Debian
sudo apt update
sudo apt install -y sysbench fio iperf3

# RHEL / AlmaLinux / Rocky
sudo dnf install -y sysbench fio iperf3

Step 2: Benchmark CPU with sysbench – How to Benchmark a Linux Server

The sysbench CPU test calculates prime numbers across threads. Run it single-threaded first, then with all cores:

sysbench cpu --threads=1 run
sysbench cpu --threads=$(nproc) run

The key figure is events per second. Compare the multi-thread score against the single-thread one: on a 4 vCPU VPS you should see roughly 3.5–4x scaling. Poor scaling suggests the host is oversubscribed or your vCPUs are throttled.

sysbench can also test memory throughput:

sysbench memory --memory-oper=read run
sysbench memory --memory-oper=write run
Tools used to benchmark Linux server CPU disk and network speed

Step 3: Benchmark Disk with fio

Disk performance decides how databases and websites feel, and headline numbers lie — random I/O matters far more than sequential throughput. Test sequential writes first:

fio --name=seqwrite --ioengine=libaio --direct=1 --bs=1M \
  --size=4G --rw=write --runtime=30 --time_based --filename=/tmp/fio-test

Then the realistic test: 4K random read/write, which mimics database and VM workloads:

fio --name=randrw --ioengine=libaio --direct=1 --bs=4k \
  --size=4G --rw=randrw --rwmixread=70 --iodepth=32 \
  --runtime=30 --time_based --filename=/tmp/fio-test
rm -f /tmp/fio-test

Read the IOPS and average latency (lat avg) lines. A healthy NVMe VPS delivers tens of thousands of random IOPS with sub-millisecond latency; a few thousand IOPS and 10 ms latency means spinning disks or heavy throttling. The fio documentation explains every parameter and workload pattern.

Step 4: Benchmark the Network with iperf3

iperf3 needs a server endpoint. Use a public test server, or start iperf3 on another machine you control:

# On the other machine
iperf3 -s

# On the server being tested
iperf3 -c other-machine-ip
iperf3 -c other-machine-ip -R   # reverse direction
iperf3 -c other-machine-ip -P 4 # four parallel streams

The sender and receiver lines show real throughput. Test both directions: many VPS plans are asymmetric, and a single stream may be limited by latency rather than bandwidth, which the -P 4 parallel test reveals.

Step 5: Record and Interpret Your Baseline

Save your results somewhere durable, for example:

mkdir -p ~/benchmarks
sysbench cpu --threads=$(nproc) run | tee ~/benchmarks/cpu-$(date +%F).txt

Interpretation guidelines:

  • CPU: compare events/sec against reference values for the same vCPU class
  • Disk: prioritize random 4K IOPS and latency over sequential MB/s
  • Network: sustained throughput in both directions, not just peak
  • Variance: re-run at a different time of day; a VPS that is fast at 03:00 but slow at 20:00 has noisy neighbors

Troubleshooting

Results change every run: background jobs, updates or other tenants are interfering. Check load with uptime and steal time in top (the st value); high steal means the hypervisor is oversold.

fio test file left behind: always clean up the multi-GB test file afterwards, and never point --filename at a real device unless you intend to destroy its contents.

iperf3 connection refused: the server side is not listening or port 5201 is blocked by a firewall — allow it temporarily for the test, then remove the rule.

A Quick Sanity Check Before Deep Benchmarks

If you only have two minutes, a fast fio run and a glance at CPU steal tell you most of what you need. Watch the %Cpu(s) line in top while the system is supposedly idle: the st (steal) column shows CPU cycles the hypervisor gave to other tenants. Sustained steal above 5–10 percent on an idle VM means the host is oversold, and no amount of tuning inside your server will fix it — that is evidence for a support ticket or a migration, backed by your benchmark logs. Similarly, if your 4K random IOPS are an order of magnitude below what the plan advertises, the fio output, with timestamps, is exactly what provider support will ask for.

Conclusion

Now you can benchmark a Linux server properly: sysbench for CPU and memory, fio for honest disk numbers, and iperf3 for network throughput. Run these tests on day one with any new provider, keep the baseline, and re-run quarterly — the numbers will tell you the truth long before your users complain.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.