test/bdevperf: add the QoS testing

Add a required check that the reasonable IOPS limit is quarter
of the measured actual IOPS without QoS. As I/O size is set
to 4K, so that bandwidth limit is also able to meet once the
IOPS limit is achieved.

Change-Id: Id9a401ce59f97245c505ebe0d1f4c18049177132
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447758
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
GangCao 2019-03-12 18:49:36 -04:00 committed by Tomasz Zawadzki
parent 809a6f82de
commit a31ae23f38

View File

@ -51,6 +51,77 @@ function nbd_function_test() {
return 0
}
QOS_DEV="Null_0"
QOS_RUN_TIME=5
function get_io_result() {
local limit_type=$1
io_result=$($rpc_py bdev_get_iostat -b $QOS_DEV)
if [ $limit_type = IOPS ]; then
io_result_before=$(echo $io_result | jq -r '.bdevs[0].num_read_ops')
else
io_result_before=$(echo $io_result | jq -r '.bdevs[0].bytes_read')
fi
sleep $QOS_RUN_TIME
io_result=$($rpc_py bdev_get_iostat -b $QOS_DEV)
if [ $limit_type = IOPS ]; then
io_result_after=$(echo $io_result | jq -r '.bdevs[0].num_read_ops')
else
io_result_after=$(echo $io_result | jq -r '.bdevs[0].bytes_read')
fi
echo $(((io_result_after-io_result_before)/QOS_RUN_TIME))
}
function run_qos_test() {
local qos_limit=$1
local qos_result=0
qos_result=$(get_io_result $2)
if [ $2 = BANDWIDTH ]; then
qos_limit=$((qos_limit*1024*1024))
fi
lower_limit=$(echo "$qos_limit 0.9" | awk '{printf("%i",$1*$2)}')
upper_limit=$(echo "$qos_limit 1.1" | awk '{printf("%i",$1*$2)}')
# QoS realization is related with bytes transfered. It currently has some variation.
if [ $qos_result -lt $lower_limit ] || [ $qos_result -gt $upper_limit ]; then
echo "Failed to limit the io read rate of NULL bdev by qos"
$rpc_py bdev_null_delete $QOS_DEV
killprocess $QOS_PID
exit 1
fi
}
function qos_function_test() {
local qos_lower_iops_limit=1000
local io_result=0
io_result=$(get_io_result IOPS)
# Set the IOPS limit as one quarter of the measured performance without QoS
local iops_limit=$(((io_result/4)/qos_lower_iops_limit*qos_lower_iops_limit))
if [ $iops_limit -gt $qos_lower_iops_limit ]; then
# Run bdevperf with IOPS rate limit
$rpc_py bdev_set_qos_limit --rw_ios_per_sec $iops_limit $QOS_DEV
run_qos_test $iops_limit IOPS
# Run bdevperf with IOPS and bandwidth rate limits
# Test bandwidth limit with 4K I/O size as we get enough IOPS without QoS
$rpc_py bdev_set_qos_limit --rw_mbytes_per_sec 4 $QOS_DEV
run_qos_test 4 BANDWIDTH
# Run bdevperf with additional read only bandwidth rate limit
$rpc_py bdev_set_qos_limit --r_mbytes_per_sec 2 $QOS_DEV
run_qos_test 2 BANDWIDTH
else
echo "Actual IOPS without limiting is too low - exit testing"
fi
}
timing_enter bdev
# Create a file to be used as an AIO backend
@ -176,6 +247,26 @@ if [ $RUN_NIGHTLY -eq 1 ]; then
report_test_completion "nightly_bdev_reset"
fi
timing_enter qos
# Run bdevperf with QoS disabled first
$testdir/bdevperf/bdevperf -z -m 0x2 -q 256 -o 4096 -w randread -t 60 &
QOS_PID=$!
echo "Process qos testing pid: $QOS_PID"
trap 'killprocess $QOS_PID; exit 1' SIGINT SIGTERM EXIT
waitforlisten $QOS_PID
$rpc_py bdev_null_create $QOS_DEV 128 512
waitforbdev $QOS_DEV
$rootdir/test/bdev/bdevperf/bdevperf.py perform_tests &
qos_function_test
$rpc_py bdev_null_delete $QOS_DEV
killprocess $QOS_PID
trap - SIGINT SIGTERM EXIT
timing_exit qos
if grep -q Nvme0 $testdir/bdev.conf; then
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir reset