From 75015790469b4b89994003349a5effce7b657ecf Mon Sep 17 00:00:00 2001 From: Wenchao Hao <8159277+wenchao-hao@user.noreply.gitee.com> Date: Thu, 21 Sep 2023 07:17:39 +0000 Subject: [PATCH] update loop.sh. update add fio policy Signed-off-by: Wenchao Hao <8159277+wenchao-hao@user.noreply.gitee.com> --- loop.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/loop.sh b/loop.sh index 56738dc..0f7492f 100644 --- a/loop.sh +++ b/loop.sh @@ -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