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 : while :
do 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}'` for dev in `lsscsi | grep scsi_debug | awk '{print $6}'`
do do
inject=$[RANDOM%3] fio_cnt=$(ps aux | grep fio | grep $dev -c)
if [ $inject -eq 0 ] || [ $inject -eq 1 ] ; then if [ $fio_cnt -gt 20 ]; then
disk=$(basename $dev) echo "$fio_cnt larger than 20, do not add"
threads=$[RANDOM%31+1] continue
echo "add $threads fio for $disk" fi
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 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 done
sleep 10 sleep 10