Skip to content

Commit

Permalink
Merge pull request #4105 from qingwangrh/2611_performance_test_iothread
Browse files Browse the repository at this point in the history
Add performance test cases
  • Loading branch information
XueqiangWei authored Jul 31, 2024
2 parents f9d4600 + cdcc20a commit 0bd8f01
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 28 deletions.
54 changes: 38 additions & 16 deletions qemu/tests/block_performance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def preprcess_fio_filename(img):
logger.debug(dev)
if fio_raw_device == "yes":
return dev
mount = "/home/%s" % (dev.replace("/dev/", ""))
cmd = "mkfs.xfs {0} && mkdir -p {1} && mount{0} {1}".format(dev,
mount)
mount_dir = "/home/%s" % (dev.replace("/dev/", ""))
cmd = "mkfs.xfs {0} && mkdir -p {1} && mount {0} {1}".format(dev,
mount_dir)
session.cmd_output(cmd)
fio_filename = "%s/test.img" % mount
fio_filename = "%s/test.img" % mount_dir

if not fio_filename:
test.fail("Can not get output file path in guest.")
Expand Down Expand Up @@ -127,6 +127,7 @@ def preprocess_fio_data(results):
},
"results":[]
"cmd": "",
"cmds":[],
"location": "",
"disk_name":""
}
Expand All @@ -138,7 +139,8 @@ def preprocess_fio_data(results):
opts = preprocess_fio_opts(results)
for img in results["images"]:
results[img] = {"filename": "", "global_options": {}, "jobs": {},
"cmd": "", "location": "", "results": []}
"cmd": "", "cmds": [], "location": "",
"results": []}
results[img]["location"] = params.get("fio_cmd_location_%s" % img,
"vm")
# guest fio
Expand All @@ -152,6 +154,11 @@ def preprocess_fio_data(results):

filename = preprcess_fio_filename(img)
results[img]["cmd"] = "%s %s" % (fio_bin, opts % filename)
cmds = results[img]["cmd"].split("--stonewall")
if len(cmds) > 2 and fio_run_mode == "separate":
for i in range(1, len(cmds)):
results[img]["cmds"].append(cmds[0] + cmds[i])

logger.debug(results)

def run_fio_test(results):
Expand All @@ -165,19 +172,32 @@ def run_fio_test(results):

for img in results["images"]:
if results[img]["location"] == "vm":
img_output = session.cmd_output(results[img]["cmd"],
timeout=cmd_timeout)
runner = session.cmd_output
else:
runner = process.getoutput

if fio_iteration_cmd:
logger.debug(fio_iteration_cmd)
runner(fio_iteration_cmd)

if results[img]["cmds"]:
cmd_num = len(results[img]["cmds"])
for idx, cmd in enumerate(results[img]["cmds"]):
logger.debug(f"Run sub-cmd {idx}/{cmd_num}:{cmd}")
img_output = runner(cmd, cmd_timeout)
if i > 0:
# discard first result
parse_fio_result(img_output, img, results, record)
else:
logger.debug(results[img]["cmd"])
img_output = process.getoutput(results[img]["cmd"],
timeout=cmd_timeout)
logger.debug("Run full-cmd: %s", results[img]["cmd"])
img_output = runner(results[img]["cmd"], cmd_timeout)
if i > 0:
# discard first result
parse_fio_result(img_output, img, results, record)

if fio_interval:
time.sleep(fio_interval)

if i > 0:
# discard first result
parse_fio_result(img_output, img, results, record)

def parse_fio_result(cmd_output, img, results, record=False):
# if record:
# logger.debug(cmd_output)
Expand Down Expand Up @@ -375,7 +395,7 @@ def process_selected_disk(disk):
else:
execute_operation("host", "mkfs.xfs -f %s " % disk)

execute_operation("host", "mount %s %s" % (disk, fio_dir))
execute_operation("host", "mount %s %s && mount" % (disk, fio_dir))
umount_cmd = "umount -fl %s;" % fio_dir
params["post_command"] = umount_cmd + params.get("post_command", "")

Expand Down Expand Up @@ -490,8 +510,10 @@ def execute_operation(where, cmd):
os_type = params["os_type"]
login_timeout = params.get_numeric("login_timeout", 360)
guest_operation = params.get("guest_operation")
fio_iteration_cmd = params.get("fio_iteration_cmd")
fio_run_mode = params.get("fio_run_mode", "separate")
fio_interval = params.get_numeric("fio_interval")
cmd_timeout = params.get_numeric("cmd_timeout", 1800)
cmd_timeout = params.get_numeric("fio_cmd_timeout", 1800)
run_times = params.get_numeric("run_times", 1)
fio_dir = params["fio_dir"]
test_results = {}
Expand Down
67 changes: 55 additions & 12 deletions qemu/tests/cfg/block_performance_test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
drive_cache_stg2 = none
drive_cache_stg3 = none

image_size_stg0 = 4224M
image_size_stg1 = 4352M
image_size_stg2 = 4480M
image_size_stg3 = 4608M
image_size_stg0 = 8320M
image_size_stg1 = 8448M
image_size_stg2 = 8576M
image_size_stg3 = 8704M

preallocation = falloc
preallocated_stg0 = falloc
preallocated_stg1 = falloc
preallocated_stg2 = falloc
preallocated_stg3 = falloc
preallocation = full
preallocated_stg0 = full
preallocated_stg1 = full
preallocated_stg2 = full
preallocated_stg3 = full

blk_extra_params_stg0 = "serial=stg0"
blk_extra_params_stg1 = "serial=stg1"
Expand Down Expand Up @@ -76,30 +76,33 @@
pre_command = "if ! which fio;then yum install fio -y;fi &&"
pre_command += " mkdir -p ${fio_dir};"

fio_cmd = " --runtime=20 --ramp_time=3 --size=4G --time_based=1 --direct=1 "
fio_cmd = " --runtime=20 --ramp_time=5 --size=8G --time_based=1 --direct=1 "
fio_cmd += " --numjobs=8 --group_reporting --filename=%s "
fio_cmd += " --randrepeat=1 --output-format=json "

host_init_operation = lsblk
host_deinit_operation = host_func_demo
# Merge and separate(default)
fio_run_mode = separate
Linux:
fio_cmd += " --ioengine=libaio "
guest_init_operation = lsblk -n
guest_deinit_operation = guest_func_demo
#fio_iteration_cmd = "echo 3 > /proc/sys/vm/drop_caches"
Windows:
vm_arch_name = i686
fio_cmd += " --thread "
guest_init_operation = wmic diskdrive get Index,Name,Size

fio_rw = read write randrw
fio_rw = read write randread randwrite
fio_iodepth = 64
fio_bs = 4k
run_times = 6
variants:
- with_queue_size:
no i440fx
fio_stonewall_cmd +=" --stonewall --name=rw-512k-64 --rw=rw --bs=512k --iodepth=64 "
images += ${compare_images}
fio_iodepth = 1
virtio_blk:
blk_extra_params_stg0 += ",queue-size=128"
blk_extra_params_stg1 += ",queue-size=1024"
Expand All @@ -124,3 +127,43 @@
drive_bus_stg1 = 2
bus_extra_params_stg0 = "num_queues=1"
bus_extra_params_stg1 = "num_queues=${vcpu_maxcpus}"

- with_io_uring:
required_qemu = [8.1.0, )
compare_images = " stg0 stg1 "
images += ${compare_images}
kparams = kernel.io_uring_disabled
kfile = /tmp/io_uring_disabled
pre_command += sysctl -n ${kparams} > ${kfile} && sysctl -w ${kparams}=0
post_command += sysctl -n ${kparams} && sysctl -w ${kparams}=`cat ${kfile}`;
image_aio_stg0 = native
image_aio_stg1 = io_uring

- with_iothread:
compare_images = " stg0 stg1 "
images += ${compare_images}
iothread_scheme ?=
image_iothread =
iothreads = t1
image_iothread_stg0 =
image_iothread_stg1 = t1
check_host_iops_req = 50000

- with_iothread_vq:
vcpu = 8
vcpu_maxcpus = 8
mem = 8192
check_host_iops_req = 50000
required_qemu = [8.2.0, )
compare_images = " stg0 stg1 stg2 stg3 "
images += ${compare_images}
iothread_scheme ?=
image_iothread =
iothreads = t1 t2 t3 t4
image_iothread_vq_mapping_stg1 = t1
image_iothread_vq_mapping_stg2 = t1 t2
image_iothread_vq_mapping_stg3 = t1 t2 t3 t4
image_aio_stg0 = native
image_aio_stg1 = native
image_aio_stg2 = native
image_aio_stg3 = native

0 comments on commit 0bd8f01

Please sign in to comment.