BLOG POSTS
    MangoHost Blog / Benchmark Your Server with stress-ng, fio, and iperf3
Benchmark Your Server with stress-ng, fio, and iperf3

Benchmark Your Server with stress-ng, fio, and iperf3

What This Article Is About (and Why You Should Care)

Ever spun up a shiny new VPS, dedicated server, or Docker host—only to have it crawl like a snail when you throw real workloads at it? We’ve all been there: shelling into a box, wondering “Is it the CPU? The disk? The network? Or is my code just that bad?”
This article is your go-to, slightly geeky, totally practical guide to benchmarking your servers with three open-source heavy-hitters: stress-ng (CPU/memory torture), fio (disk IO maestro), and iperf3 (network speed demon).
Whether you’re a developer, sysadmin, DevOps engineer, or just a curious tinkerer, you’ll learn:

  • How to quickly stress-test your server hardware or VM
  • How to spot bottlenecks before your real users do
  • How to compare cloud providers, hardware, or configurations with actual data

Ready? Let’s get benchmarking.

The Dramatic Situation: “Slow, Sluggish, and Frustrated”

Picture this: It’s Friday, 4 PM. You just deployed your app to a new server. Your boss/client/random person on the internet expects “blazing fast” performance. You run a few requests, and… everything is slow. Like, “dial-up modem in 1997” slow. You check your code. You optimize your database queries. Still sluggish. What gives?

Turns out, your cloud provider gave you a potato disguised as a server. Or your disk is slower than cold molasses. Or your network throughput is capped at “grandma’s WiFi” levels. If only you’d benchmarked first…

Why Benchmarking Your Server Matters

  • Prevent nasty surprises: Know your limits before you hit them.
  • Choose the right hosting: Compare options with real numbers (not just marketing fluff).
  • Debug performance issues: Is it your code, or the server?
  • Capacity planning: Decide if you need to scale up, optimize, or move providers.
  • Peace of mind: Sleep better knowing your stack can handle the load.

How Do stress-ng, fio, and iperf3 Work? Under the Hood

stress-ng

Think of stress-ng as your server’s personal trainer. It pushes your CPU, RAM, and other components to their limits, using a huge menu of “stressors.” It’s like a gym on steroids for your hardware. You can simulate high CPU usage, RAM thrashing, cache misses, and more.

  • Algorithms: stress-ng uses busy-loops, intense math, memory allocation/free cycles, and more. It can run up to 200+ stress tests in parallel.
  • Structure: Each stressor is a process (or thread) that hammers a specific resource.

fio

fio is the Swiss Army knife of disk benchmarking. Want to see how your SSD handles random 4K writes? Sequential reads? Simulate 100 users at once? fio has you covered. It can do everything from basic disk speed checks to complex multi-job workloads.

  • Algorithms: fio uses configurable job files to simulate reads/writes with various block sizes, patterns, depths, and queueing strategies.
  • Structure: Each “job” is a thread or process. Results are precise and script-friendly.

iperf3

iperf3 is your network’s X-ray vision. It tests raw throughput between two endpoints. Run it in client-server mode and see your real TCP/UDP speeds (not just what your provider says you get).

  • Algorithms: iperf3 sends a stream of data over TCP or UDP, measures transfer rate, jitter, packet loss, and more.
  • Structure: One end is “server” (waiting for connections), the other is “client” (initiates connection and sends data).

Use Cases: When and Why to Benchmark

  • Pre-production sanity check: Test new servers before putting “real” apps on them.
  • Comparing providers: VPS vs. dedicated? Cloud A vs. Cloud B? Use benchmarks, not guesses.
  • Troubleshooting: Is your slow database due to disk, CPU, or network?
  • Scaling decisions: Can your current infra handle more users? Or will it choke?
  • Automated CI/CD checks: Bake benchmarks into your deployment pipeline.
  • Hardware upgrades: SSD vs. NVMe? More CPU cores? Check the uplift before spending $$$.

Quick Setup Guide: Get Benchmarking in Minutes

Here’s how to get all three tools running on a modern Linux box (tested on Ubuntu/Debian, but similar on CentOS/AlmaLinux/Rocky).

Step 1: Install the Tools

sudo apt update
sudo apt install stress-ng fio iperf3 -y

On CentOS/AlmaLinux/Rocky:

sudo dnf install epel-release -y
sudo dnf install stress-ng fio iperf3 -y

Step 2: Basic Usage Examples

CPU and Memory: stress-ng

# Hammer all CPU cores for 60 seconds
stress-ng --cpu 4 --timeout 60s

# Stress RAM with 2GB allocation
stress-ng --vm 2 --vm-bytes 1G --timeout 60s

Disk Speed: fio

# Quick random read/write test (4K blocks, 1GB file)
fio --name=randrw --ioengine=libaio --rw=randrw --bs=4k --size=1G --numjobs=4 --time_based --runtime=60 --group_reporting

Want to test sequential read/write? Change --rw=randrw to read or write.

Network Throughput: iperf3

On the “server” (can be your remote VPS, bare metal, etc.):

iperf3 -s

On your local machine (replace REMOTE_IP):

iperf3 -c REMOTE_IP

Want to test both directions? Add -R on the client.

Step 3: Interpret the Results

  • stress-ng: Look for “bogo ops/sec” (higher = better). Watch for thermal throttling, load avg, or memory errors in dmesg.
  • fio: Focus on “IOPS” (input/output ops/sec), bandwidth (MB/sec), and latencies.
  • iperf3: Check “sender” and “receiver” throughput (Mbps/Gbps). If numbers are way below your expectations, investigate network/firewall issues.

Bonus: Clean Up

fio leaves test files (like randrw)—delete them with:

rm -f randrw

Mini Glossary: Real-Talk Definitions

  • Stress Test: “Let’s see if this server sweats or just explodes.”
  • bogo ops/sec: “Bogus operations per second.” Not a real-world number, but good for comparisons.
  • IOPS: “How many disk tricks can my server pull off per second?”
  • Throughput: “How fast can we shove data down this pipe?”
  • Latency: “How long does it take for one thing to happen?”

Examples, Cases, and the Comic Metaphor Table

Let’s personify our tools like RPG characters. Who would you pick for your party?

Tool Comic Persona Superpower Weakness When to Use
stress-ng The Musclebound Gym Rat Pushes your CPU/RAM to the limit, finds overheating fast Doesn’t tell you about disk or network “Is my server actually as strong as the specs say?”
fio The OCD Librarian Diagnoses disk speed, random/sequential reads, latency Won’t help with CPU or network “Why is my DB slow? Is my SSD lying to me?”
iperf3 The Speedy Messenger Reveals true network speed (not just what’s advertised) Needs a server+client, can’t test CPU/disk “Is my VPS on a gigabit uplink, or a potato?”

Positive Case: You benchmark a fresh VPS. stress-ng shows all CPU cores go full throttle, fio reports decent SSD speeds, iperf3 matches your provider’s promised bandwidth. No surprises!
Negative Case: You run fio and see 10MB/sec writes on a “fast” NVMe drive. Uh oh: it’s a fake or throttled disk—time to ask for a refund or move to a real host like MangoHost VPS or dedicated server.

Beginner Mistakes, Myths, and Similar Tools

  • Myth 1: “My cloud provider says I get X, so I must get X.” Nah. Always test for yourself.
  • Myth 2: “One benchmark fits all.” Nope. Test each resource: CPU, disk, network.
  • Mistake 1: Running fio on a mounted production DB—ouch! Always use a test partition or volume.
  • Mistake 2: Forgetting to clean up after fio (disk fills up fast).
  • Similar tools:

“Use This If…” Flowchart

Let’s help you decide:

➡️  Need to test CPU or RAM?
    ⬇️
  [stress-ng]
    |
    V
➡️  Need to test disk speed (SSD, HDD, NVMe)?
    ⬇️
  [fio]
    |
    V
➡️  Need to test network speed between two servers?
    ⬇️
  [iperf3]

If you need all three (most do!), run them in sequence. For more database-specific benchmarks, check sysbench.

Cool Tricks: Automation, Scripting & Weird Uses

  • Automate daily/weekly benchmarks with cron jobs, log results to a file for trend analysis.
  • Integrate with Ansible/Puppet/Chef for automated server validation (if benchmarks fail, auto-redeploy or alert).
  • Weird use: Use stress-ng to simulate outages for chaos engineering!
  • fio as a performance bellwether: Run before/after any big kernel or firmware updates.

Sample “All-in-One” Benchmark Script

#!/bin/bash
echo "CPU/RAM Stress Test:"
stress-ng --cpu 2 --vm 2 --vm-bytes 512M --timeout 30s

echo "Disk Test:"
fio --name=quicktest --ioengine=libaio --rw=randread --bs=4k --size=512M --numjobs=2 --time_based --runtime=30 --group_reporting

echo "Network Test (to 198.51.100.42):"
iperf3 -c 198.51.100.42

echo "Done! Clean up:"
rm -f quicktest

The Sysadmin Saga: A Short Story

Once upon a time, a scrappy admin named Casey inherited a “high performance” server. But their webapp felt like it was running on a potato. Casey unleashed stress-ng (CPU? Fine), fio (disk? 15MB/s, yikes!), and iperf3 (network? Actually fast). The culprit: a “premium SSD” that was more like a USB stick in disguise. Casey took screenshots, sent them to support, and within hours got moved to a new node—app speed doubled. Moral: trust, but benchmark!

Wrap-Up & Recommendations

If you value your uptime, sanity, or reputation, benchmark every server before you trust it with production workloads. stress-ng, fio, and iperf3 are open-source, lightweight, and give you “X-ray vision” into your stack’s real performance—not just what the marketing slides promise.

  • For new deployments: Run all three tools. Save results for future comparisons.
  • For troubleshooting: Identify the bottleneck first, then focus your fixes.
  • For automation: Script your tests, alert on regressions, and always know if your infra is up to snuff.

Need a new, actually fast server for your next project? Check out a VPS or dedicated server from MangoHost. Run these benchmarks, see the results for yourself, and never get stuck with a “potato server” again!

Links:
stress-ng docs |
fio docs |
iperf3 official



This article incorporates information and material from various online sources. We acknowledge and appreciate the work of all original authors, publishers, and websites. While every effort has been made to appropriately credit the source material, any unintentional oversight or omission does not constitute a copyright infringement. All trademarks, logos, and images mentioned are the property of their respective owners. If you believe that any content used in this article infringes upon your copyright, please contact us immediately for review and prompt action.

This article is intended for informational and educational purposes only and does not infringe on the rights of the copyright owners. If any copyrighted material has been used without proper credit or in violation of copyright laws, it is unintentional and we will rectify it promptly upon notification. Please note that the republishing, redistribution, or reproduction of part or all of the contents in any form is prohibited without express written permission from the author and website owner. For permissions or further inquiries, please contact us.

Leave a reply

Your email address will not be published. Required fields are marked