The most widely shared benchmarks copy a file using dd and report “1 GB/s.” That number says very little about how your database or game server will perform. With fio and sysbench, you measure what really matters and can repeat the test under the same conditions.
What Should Be Measured
- IOPS with random 4K blocks: This is the standard for databases and many games when saving the game world, and it is the factor that most distinguishes one storage solution from another.
- 99th percentile latency: the time taken by the slowest operation out of every hundred. A good average with a high p99 is perceived as stuttering.
- Sequential bandwidth: matters when transferring backups or large files, but not much in everyday use.
- Single-threaded and multi-threaded CPU performance: Many game servers rely almost exclusively on the former.
Install the tools
sudo apt updatesudo apt install -y fio sysbenchBoth are available in the Debian and Ubuntu repositories (in Ubuntu, at universe). Always work on a test file and never on a device such as /dev/sda or /dev/vda: fio would overwrite your data.
Test 1: Random 4K with mixed reads and writes
fio --name=rand4k --filename=/root/fio-test.bin --size=2G --rw=randrw --rwmixread=70 --bs=4k --ioengine=libaio --iodepth=32 --direct=1 --runtime=60 --time_based --group_reporting--direct=1 bypasses the system's page cache; without that option, you would be measuring RAM. The ratio of 70% reads to 30% writes is similar to that of a database-driven web application.
Test 2: Sequential Reading with Large Blocks
fio --name=seq1m --filename=/root/fio-test.bin --size=2G --rw=read --bs=1M --ioengine=libaio --iodepth=8 --direct=1 --runtime=30 --time_basedTest 3: CPU
sysbench cpu --threads=1 --time=30 runsysbench cpu --threads=$(nproc) --time=30 runCompare the value events per second from the two runs. It's normal for it not to scale perfectly with the number of vCPUs, because these are usually SMT threads; a very large difference indicates that another process is competing for the CPU.
How to Read the fio Report
IOPS=in linesreadandwrite: add them together to get the total for the mixed test.clat percentiles: Look for row99.00th. It usually appears in microseconds (usec); if it takes several milliseconds with 4K blocks, the storage is overloaded.bw=: bandwidth, which is the key data point in Test 2.
For the result to be of any use
- Repeat each test three times and use the median.
- Run them outside of your services' peak hours: they compete with each other, and both end up losing out.
- When you're finished, delete the test file containing
rm /root/fio-test.bin. - Save the results along with the date. This is useful for comparing them after a change in plan, file system, or configuration.
ext step
If the numbers fall short of the load you expect, compare the Cloud VPS plans and repeat these same tests on the new server.