2019年1月17日 星期四

[Linux] 使用dd 來測試硬碟或是一些儲存裝置的讀寫速度(Read/Write), Throughput testing

我們寫了兩支script 來測試掛載在/mnt/public上的storage throughput(Read/Write)
Write 的部分,我們測試2G的檔案,每次作完dd,我們會去清除cache,sleep 10 秒後,再次執行,總共循環5次

=================== Using dd to test storage write throughput(RX) =================
#!/bin/sh
count="1"
while [ 1 ]
do
dd if=/dev/zero of=/mnt/public/2GGG bs=1M count=2048
sync
echo "sleep 10 sec"
sleep 10
echo 1 > /proc/sys/vm/drop_caches
sync
echo "sleep done"
if [ $count -eq "5" ]; then
 exit
fi
count=$(($count+1))
done
====================================================================


Read 的部分,我們測試2G的檔案,每次作完dd,sleep 5 秒後,再次執行,總共循環5次

=================== Using dd to test storage read throughput(TX) =================
#!/bin/sh
count="1"
while [ 1 ]
do
dd of=/dev/null if=/mnt/public/2GGG bs=1M count=2048
sync
echo "sleep 5 sec"
sleep 5
sync
echo "sleep done"
if [ $count -eq "5" ]; then
 exit
fi
count=$(($count+1))
done
==================================================================:

沒有留言:

張貼留言