Benchmarking disk performance
Benchmarking disk performance
There are several tools available for benchmarking disk performance inside Docker
containers:
The mixed.fio file configures fio to perform random direct I/O with:
Block size: 4K
File size: 16GB (/ferrari/fio-test-file)
I/O engine: libaio (asynchronous I/O)
I/O depth: 32
Parallel jobs: 8
Workload mix: 70% read, 30% write
fio mixed.fio
To run the test in a Docker container, you need to prepare a Docker image with fio.
Dockerfile Explanation
FROM ubuntu
MAINTAINER [email protected]
RUN apt-get update
RUN apt-get -qq install -y fio
ADD mixed.fio /
VOLUME ["/ferrari"]
ENTRYPOINT ["fio"]
This runs fio with the predefined job settings and collects performance results.
If your system has SELinux enabled, you may get a Permission denied error when
mounting volumes.
7. Cleaning Up
After benchmarking, you can remove the test files to free up space:
rm -f /ferrari/fio-test-file
Conclusion
This method provides a consistent and reproducible way to benchmark disk performance
inside Docker while ensuring SELinux compatibility on RHEL-based systems. 🚀
Benchmarking network performance
This guide explains how to use nuttcp and netperf to measure network bandwidth and
request/response performance between two endpoints.
On Ubuntu/Debian
apt update && apt install -y nuttcp netperf
nuttcp -S
nuttcp -t <SERVER_IP>
Example:
nuttcp -t 192.168.1.10
This tests how fast data can be sent from the client to the server.
nuttcp -r <SERVER_IP>
This measures how fast data is received from the server to the client.
netperf helps test latency and responsiveness over TCP and UDP.
netserver
Example:
Conclusion
The easiest way to run cAdvisor is by using its official Docker image.
Explanation of Flags:
http://localhost:8080
You'll see CPU, memory, disk, and network usage graphs for the host machine.
If you prefer to run cAdvisor directly on the host (bare metal or VM), follow these steps:
Another option for monitoring Docker network performance is sFlow. Follow the setup guide
here:
👉 sFlow Docker Monitoring
Conclusion