How to Run Performance Benchmarks on Debian 12 Bookworm System
Categories:
5 minute read
Performance benchmarking is essential for understanding how your Debian 12 Bookworm system performs under various loads and usage scenarios. Whether you’re optimizing for server workloads, application development, or desktop performance, proper benchmarking tools and methodologies help identify bottlenecks, validate hardware performance, and compare different configurations.
This guide provides a detailed walkthrough of how to run performance benchmarks on a Debian 12 system. We’ll cover tools for CPU, memory, disk I/O, and network performance, including installation, usage examples, and result interpretation.
1. Why Benchmark Your System?
Benchmarking is about measuring the performance of your system’s components—such as CPU, memory, storage, and network—to:
- Ensure hardware is functioning as expected.
- Compare different hardware or configurations.
- Identify system bottlenecks.
- Support capacity planning.
- Validate system tuning or updates.
On Debian 12 Bookworm, many mature and open-source benchmarking tools are available. The default repositories include most of what you need to get started quickly.
2. Preparation: Update Your System
Before installing benchmarking tools, it’s good practice to update your system:
sudo apt update && sudo apt upgrade -y
You may also want to install build-essential
and linux-perf
for compiling and analyzing performance tools:
sudo apt install build-essential linux-perf
3. CPU Benchmarking
Tool: sysbench
sysbench
is a versatile benchmarking tool that can test CPU, memory, I/O, and more.
Install sysbench
sudo apt install sysbench
Run a CPU benchmark
sysbench cpu --cpu-max-prime=20000 run
--cpu-max-prime=20000
: Sets the maximum prime number to calculate.- The output includes events per second, total time taken, and CPU usage.
Interpreting Results
Look at total time
, events per second
, and 95th percentile latency
. Lower latency and higher events/sec indicate better performance.
4. Memory Benchmarking
Tool: sysbench
(again)
You can also benchmark memory using sysbench:
sysbench memory --memory-block-size=1M --memory-total-size=10G run
--memory-block-size
: Size of memory block to test.--memory-total-size
: Total size to allocate during the test.
Alternative Tool: mbw
mbw
(Memory Bandwidth Benchmark) measures memory copy bandwidth between buffers.
Install mbw
sudo apt install mbw
Example usage
mbw -n 10 100
-n
: Number of runs.100
: Buffer size in MB.
It reports memory bandwidth in MB/s using methods like memcpy
, bcopy
, and duff
.
5. Disk I/O Benchmarking
Tool: fio
fio
(Flexible I/O Tester) is a powerful disk benchmarking tool.
Install fio
sudo apt install fio
Random Read/Write Example
fio --name=randrw --ioengine=libaio --rw=randrw --bs=4k --direct=1 \
--size=1G --numjobs=4 --runtime=60 --group_reporting
--rw=randrw
: Mix of random reads/writes.--bs=4k
: Block size of 4KB.--numjobs=4
: Simulate 4 concurrent jobs.--direct=1
: Bypass OS cache.--runtime=60
: Run test for 60 seconds.
Output Explanation
IOPS
: I/O operations per second.Latency
: Read/write response time.BW
: Bandwidth (read/write speed).
Tool: hdparm
For a simple disk read speed test:
sudo hdparm -Tt /dev/sdX
Replace /dev/sdX
with your actual disk. This gives a rough idea of cached and buffered read speeds.
6. Network Benchmarking
Tool: iperf3
iperf3
is widely used for testing network throughput between two machines.
Install iperf3
sudo apt install iperf3
On the server machine
iperf3 -s
On the client machine
iperf3 -c <server_ip_address>
Output includes
- Bandwidth (Mbps or Gbps)
- Retransmissions
- Transfer time
Tool: nuttcp
(Alternative)
nuttcp
is another reliable tool for testing TCP/UDP throughput and latency.
sudo apt install nuttcp
Usage is similar to iperf and can provide more detailed statistics.
7. System Monitoring During Benchmarks
It’s important to monitor system stats in real-time during benchmarks to ensure accurate context.
Tool: htop
sudo apt install htop
htop
Gives a live overview of CPU, memory, and process usage.
Tool: iotop
(for disk I/O)
sudo apt install iotop
sudo iotop
Shows real-time disk I/O per process.
Tool: nmon
nmon
provides a comprehensive live dashboard of CPU, memory, disk, and network usage.
sudo apt install nmon
nmon
8. GPU Benchmarking (Optional)
If you’re running a system with GPU support and drivers installed (e.g., NVIDIA), you can use:
Tool: glmark2
sudo apt install glmark2
glmark2
Runs a series of OpenGL-based tests and outputs a performance score.
Tool: unigine
(Proprietary)
For high-end benchmarking, Unigine offers Linux-compatible tools like Heaven and Superposition. These are not in Debian repos but available from the official site.
9. Web Server Benchmarking
Tool: Apache Benchmark (ab)
If you want to test the performance of your web server (e.g., Apache, Nginx):
sudo apt install apache2-utils
ab -n 1000 -c 10 http://localhost/
-n 1000
: Total number of requests.-c 10
: Number of concurrent requests.
Outputs:
- Requests per second
- Connection times
- Failed requests
Tool: wrk
(Advanced)
wrk
is a modern HTTP benchmarking tool.
sudo apt install wrk
wrk -t4 -c100 -d30s http://localhost/
10. Comparing Results and Repeating Tests
For accuracy:
- Run tests multiple times.
- Ensure no other heavy processes are running.
- Use consistent configurations.
Create spreadsheets or use tools like gnuplot
to visualize results over time or across different systems.
11. Automating Benchmarks
You can write shell scripts to automate benchmarking and output logs. Example:
#!/bin/bash
echo "Running CPU benchmark..."
sysbench cpu --cpu-max-prime=20000 run >> benchmark_log.txt
echo "Running Memory benchmark..."
sysbench memory --memory-block-size=1M --memory-total-size=1G run >> benchmark_log.txt
echo "Running Disk benchmark..."
fio --name=randrw --ioengine=libaio --rw=randrw --bs=4k --direct=1 \
--size=512M --numjobs=2 --runtime=30 --group_reporting >> benchmark_log.txt
Conclusion
Benchmarking a Debian 12 Bookworm system is both straightforward and essential for understanding your hardware’s capabilities and system behavior under stress. Tools like sysbench
, fio
, iperf3
, and htop
provide detailed insight into various subsystems.
Whether you’re a system administrator validating hardware, a developer optimizing workloads, or just curious about your system’s performance, regular benchmarking helps keep things running smoothly and efficiently.
Remember that benchmarks are just indicators—real-world performance depends on many variables including workloads, tuning, and hardware quality. Use benchmarking as a guide, not a gospel.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.