Created
January 15, 2018 15:26
-
-
Save hervenivon/f5acb52b57d7aba4d949c59a5047f729 to your computer and use it in GitHub Desktop.
Quick performance read/write comparison based on linux `dd`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BUFFERSIZE=1048576 | |
WHERE="/dev/shm/test /mnt/data/test" | |
RESULTS="/tmp/benchmark_results.csv" | |
echo "WHERE;TYPE;SIZE;DURATION;SPEED;SPEEDUNIT" > $RESULTS | |
for i in `seq 1 10`; | |
do | |
size=$(($i * 1024)) | |
echo "Testing $size MB files" | |
for w in $WHERE; | |
do | |
echo "- Writing on $w" | |
printf "$w;write;$size;" >> $RESULTS | |
dd if=/dev/urandom of=$w bs=$BUFFERSIZE count=$size 2>&1 | awk '$2 == "bytes" {print $6";"$8";"$9 }' >> $RESULTS | |
echo "- Reading $w" | |
printf "$w;read;$size;" >> $RESULTS | |
dd if=$w of=/dev/zero bs=$BUFFERSIZE 2>&1 | awk '$2 == "bytes" {print $6";"$8";"$9 }' >> $RESULTS | |
echo "- Deleting $w" | |
rm -f $w | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment