Testing Disk I/O Performance in Linux
Notes for testing I/O on Linux after moving into a new VPS.
Testing write speed:
# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
bs=1G (Block Size - Sets the size of write test).
count=1 (Count - Number of blocks you want to write).
oflag=dsync (Synchronized I/O to prevent cached results).
Writing a single big block of data will challenge pure write performance.
Testing disk latency:
# dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync
if (input.file - Where to read data from).
of (output.file - Where to write data to).
bs=512 (Block Size - Sets the size of write test).
count=1000 (Count - Number of blocks you want to write).
oflag=dsync (Synchronized I/O to prevent cached results).
Writing small blocks 1000 times will challenge latency and reaction time.
Testing read speed(s):
# hdparm -Tt /dev/vda1
-T (Perform cache read timings).
-t (Perform device read timings).
Results (respectively):
Write:
1073741824 bytes (1.1 GB) copied(1 time), 0.954025 s, 1.1 GB/s
Latency:
512000 bytes (512 kB) copied(1000 times), 4.88921 s, 105 kB/s
Read:
Timing cached reads: 31032 MB in 2.00 seconds = 15535.43 MB/sec
Timing buffered disk reads: 1754 MB in 3.00 seconds = 584.23 MB/sec