Benchmarking Kubernetes Persistent Volumes with fio: IOPS, Bandwidth, and Latency
This guide shows how to deploy the Dbench Job on a Kubernetes cluster, run nine 15‑second fio tests against a 1000Gi SSD storage class, and interpret the resulting IOPS, bandwidth, and latency metrics for both random and sequential workloads.
Tool
DbenchGitHub repository: https://github.com/leeliu/dbench
Usage
Edit the dbench.yaml file to set the storageClassName that matches your own Storage Class. kubectl get storageclasses Deploy the job: kubectl apply -f dbench.yaml After deployment, the Dbench Job will:
Use storageClassName: ssd (default) to provision a 1000Gi persistent volume (default).
Run a series of fio tests on the newly provisioned disk.
Execute 9 tests, each lasting 15 seconds, for a total runtime of about 2.5 minutes.
Track benchmark progress with: kubectl logs -f job/dbench An empty output means the job has not been created yet or the storageClassName is invalid; see the troubleshooting section.
When all tests finish, a summary similar to the following appears:
==================
= Dbench Summary =
==================
Random Read/Write IOPS: 75.7k/59.7k. BW: 523MiB/s / 500MiB/s
Average Latency (usec) Read/Write: 183.07/76.91
Sequential Read/Write: 536MiB/s / 512MiB/s
Mixed Random Read/Write IOPS: 43.1k/14.4kThe summary reports Random Read/Write IOPS, bandwidth (BW), average latency, sequential throughput, and mixed random IOPS.
Clean up after testing:
kubectl delete -f dbench.yamlNotes / Troubleshooting
If a Persistent Volume Claim stays Pending, you likely did not specify a valid Storage Class. Verify with kubectl get storageclasses and ensure the requested size is 1000Gi (default).
Binding the volume may take time; the Kubernetes Dashboard UI may show the Dbench Job in red until the volume is ready.
Testing different disk sizes is useful because many cloud providers price IOPS per GB. A 4000Gi volume may deliver higher performance than a 1000Gi volume. To retest, edit the YAML, delete the job, wait for deprovisioning, then re‑apply.
All fio test definitions reside in docker-entrypoint.sh, which runs the following steps:
Testing Read IOPS...
Testing Write IOPS...
Testing Read Bandwidth...
Testing Write Bandwidth...
Testing Read Latency...
Testing Write Latency...
Testing Read Sequential Speed...
Testing Write Sequential Speed...
Testing Read/Write Mixed...
Tencent Cloud K8S Cluster Production Practice
List storage classes:
kubectl get storageclassEdit dbench.yaml :
vi dbench.yamlApply the job: kubectl apply -f dbench.yaml Watch logs:
kubectl logs -f job/dbenchDelete the job when finished:
kubectl delete -f dbench.yamlSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
