update loop.sh.

update add fio policy

Signed-off-by: Wenchao Hao <8159277+wenchao-hao@user.noreply.gitee.com>
This commit is contained in:
Wenchao Hao 2023-09-21 07:17:39 +00:00 committed by Gitee
parent ba54873b97
commit 7501579046
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 10 additions and 12 deletions

22
loop.sh
View File

@ -6,20 +6,18 @@ function add_fio()
{
while :
do
fio_cnt=$(ps aux | grep fio -c)
if [ $fio_cnt -gt 150 ]; then
echo "$fio_cnt larger than 150, do not add"
continue
fi
for dev in `lsscsi | grep scsi_debug | awk '{print $6}'`
do
inject=$[RANDOM%3]
if [ $inject -eq 0 ] || [ $inject -eq 1 ] ; then
disk=$(basename $dev)
threads=$[RANDOM%31+1]
echo "add $threads fio for $disk"
fio -filename=/dev/$disk -name=rand_write -rw=randrw -bs=4k -direct=1 -size=1G -numjobs=$threads -runtime=240 -group_reporting 2>&1 > /dev/null &
fi
fio_cnt=$(ps aux | grep fio | grep $dev -c)
if [ $fio_cnt -gt 20 ]; then
echo "$fio_cnt larger than 20, do not add"
continue
fi
threads=$[RANDOM%5+1]
echo "add $threads fio for $dev"
fio -filename=$dev -name=rand_write -rw=randrw -bs=4k -direct=1 -size=1G -numjobs=$threads -runtime=240 -group_reporting 2>&1 > /dev/null &
done
sleep 10