|
九月份偷了下懒,补上一篇
注释:shell脚本,需要fio工具,实时监控磁盘的读写性能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
| #!/bin/bash
DATE=$(date +%m-%d)
IOSTATLOG=/var/log/iostat${DATE}.log
FIOLOG=/var/log/fio${DATE}.log
/bin/ps -ef |grep "iostat -dk 5" | grep -v grep > /dev/null
if [ $? == 0 ]
then
echo "Disk monitor already running"
exit 1
else
/usr/bin/iostat -dk 5 >>$IOSTATLOG &
pid=$!
fi
while true
do
echo "-------------`date`--------">>$FIOLOG
echo "--------------fio test---------------------">>$FIOLOG
######随机读:
echo "-------------随机读s----------------">>$FIOLOG
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=4096M -numjobs=10 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=128k -size=4096M -numjobs=10 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=1M -size=4096M -numjobs=10 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
#####顺序读:
echo "-------------顺序读----------------">>$FIOLOG
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=4k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=128k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=1M -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
#####随机写:
echo "-------------随机写----------------">>$FIOLOG
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=4k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=128k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=1M -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
#####顺序写:
echo "-------------顺序写----------------">>$FIOLOG
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=128k -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=1M -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest >>$FIOLOG 2>&1
#####混合随机读写:
echo "-------------混合随机读写----------------">>$FIOLOG
#######4k
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=4k -size=4096M -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop >>$FIOLOG 2>&1
#######128k
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=128k -size=4096M -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop >>$FIOLOG 2>&1
#######1M
fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=1M -size=4096M -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop >>$FIOLOG 2>&1
sleep 60
done
|
|
|
|
|
|
|
|