From b9150897d91eb7627f71db572c283042b4ba5aad Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 15 Jul 2020 10:46:34 +0200 Subject: [PATCH] test/nvme_perf: move fio config generation into one place Configuration file generation was split into multiple places/functions in scripts. Move it into a single function. "time_based" fio parameter has been moved to fio config template file as it is not configurable. There is still a lot of room for improvement here, because create_fio_config() function uses mixed local variables (as function arguments) and global variables. Change-Id: Ica3717d0d28692d24c861c2d32e729761c5c8647 Signed-off-by: Karol Latecki Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3345 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Paul Luse Reviewed-by: Tomasz Zawadzki --- test/nvme/perf/common.sh | 31 +++++++++++++++++++++++++++++++ test/nvme/perf/config.fio.tmp | 5 +++-- test/nvme/perf/run_perf.sh | 26 -------------------------- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index cc87f6928..c745f1624 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -211,6 +211,34 @@ function create_fio_config() { local disks_per_core=$((disk_no / no_cores)) local disks_per_core_mod=$((disk_no % no_cores)) + # SPDK fio plugin supports submitting/completing I/Os to multiple SSDs from a single thread. + # Therefore, the per thread queue depth is set to the desired IODEPTH/device X the number of devices per thread. + # TODO: Shouldn't this be applicable to running kernel fio tests as well? Because, what's the difference? + QD=$IODEPTH + if [[ "$PLUGIN" =~ "spdk-plugin" ]] && [[ "$NOIOSCALING" = false ]]; then + QD=$((IODEPTH * DISKNO)) + fi + + # Following part of this function still leverages global variables a lot. + # It's a mix of local variables passed as aruments to function with global variables. This is messy. + # TODO: Modify this to be consistent with how variables are used here. Aim for using only + # local variables to get rid of globals as much as possible. + desc="\"Test io_plugin=$PLUGIN Blocksize=${BLK_SIZE} Workload=$RW MIX=${MIX} qd=${IODEPTH}\"" + cp "$testdir/config.fio.tmp" "$testdir/config.fio" + cat <<- EOF >> $testdir/config.fio + description=$desc + + rw=$RW + rwmixread=$MIX + iodepth=$QD + bs=$BLK_SIZE + runtime=$RUNTIME + ramp_time=$RAMP_TIME + numjobs=$NUMJOBS + log_avg_msec=$SAMPLING_INT + + EOF + # For kernel dirver, each disk will be alligned with all cpus on the same NUMA node if [[ "$plugin" =~ "kernel" ]]; then for ((i = 0; i < disk_no; i++)); do @@ -271,6 +299,9 @@ function create_fio_config() { echo "" >> $testdir/config.fio done fi + + echo "INFO: Generated fio configuration file:" + cat $testdir/config.fio } function preconditioning() { diff --git a/test/nvme/perf/config.fio.tmp b/test/nvme/perf/config.fio.tmp index 66f29faad..dfaea5df5 100644 --- a/test/nvme/perf/config.fio.tmp +++ b/test/nvme/perf/config.fio.tmp @@ -1,5 +1,6 @@ [global] -thread=1 -group_reporting=1 direct=1 +thread=1 norandommap=1 +group_reporting=1 +time_based=1 diff --git a/test/nvme/perf/run_perf.sh b/test/nvme/perf/run_perf.sh index 60de4549c..d433d98cf 100755 --- a/test/nvme/perf/run_perf.sh +++ b/test/nvme/perf/run_perf.sh @@ -212,16 +212,6 @@ fi #Run each workolad $REPEAT_NO times for ((j = 0; j < REPEAT_NO; j++)); do - cp $testdir/config.fio.tmp $testdir/config.fio - echo "" >> $testdir/config.fio - #The SPDK fio plugin supports submitting/completing I/Os to multiple SSDs from a single thread. - #Therefore, the per thread queue depth is set to the desired IODEPTH/device X the number of devices per thread. - if [[ "$PLUGIN" =~ "spdk-plugin" ]] && [[ "$NOIOSCALING" = false ]]; then - qd=$((IODEPTH * DISKNO)) - else - qd=$IODEPTH - fi - if [ $PLUGIN = "spdk-perf-bdev" ]; then run_bdevperf > $TMP_RESULT_FILE iops_disks=$((iops_disks + $(get_bdevperf_results iops))) @@ -239,23 +229,7 @@ for ((j = 0; j < REPEAT_NO; j++)); do cp $TMP_RESULT_FILE $result_dir/perf_results_${MIX}_${PLUGIN}_${NO_CORES}cpus_${DATE}_${k}_disks_${j}.output else - desc="Running Test: Blocksize=${BLK_SIZE} Workload=$RW MIX=${MIX} qd=${IODEPTH} io_plugin/driver=$PLUGIN" - cat <<- EOF >> $testdir/config.fio - rw=$RW - rwmixread=$MIX - iodepth=$qd - bs=$BLK_SIZE - runtime=$RUNTIME - ramp_time=$RAMP_TIME - numjobs=$NUMJOBS - time_based=1 - description=$desc - log_avg_msec=$SAMPLING_INT - EOF - create_fio_config $DISKNO $PLUGIN "$DISK_NAMES" "$DISKS_NUMA" "$CORES" - echo "USING CONFIG:" - cat $testdir/config.fio if [[ "$PLUGIN" =~ "spdk-plugin" ]]; then run_spdk_nvme_fio $PLUGIN "--output=$TMP_RESULT_FILE" \