aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-09-16 11:19:15 +0000
committerhoujingwen <houjingwen@huawei.com>2015-09-24 11:24:44 +0800
commit735af0fc05d73cbc7bd97b52a230d966cbfec6c3 (patch)
tree0bd872895a6ee0fa9088dd5c4512536f2edd85b5 /yardstick/benchmark/scenarios
parent8650a0a22182987e70f34653d8521ea2072ee5c8 (diff)
Fix bug in fio scenario
1) when duration>3600s in fio.yaml, ssh time out 2) sometimes the latency value in test result is null 3) update plot.py, fit for code update in fio.py 4) small bug in file.py (result output dump) Add --output-format=json in default args, so fio command can return json format data. JIRA: YARDSTICK-143 Change-Id: Ie02977b8c9f11986a1eed66896b84d18db3d2211 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'yardstick/benchmark/scenarios')
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py39
-rw-r--r--yardstick/benchmark/scenarios/storage/fio_benchmark.bash43
2 files changed, 29 insertions, 53 deletions
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py
index d3695165f..42f159164 100644
--- a/yardstick/benchmark/scenarios/storage/fio.py
+++ b/yardstick/benchmark/scenarios/storage/fio.py
@@ -17,7 +17,7 @@ LOG = logging.getLogger(__name__)
class Fio(base.Scenario):
- """Execute fio benchmark on host
+ """Execute fio benchmark in a host
Parameters
filename - file name for fio workload
@@ -73,8 +73,9 @@ class Fio(base.Scenario):
def run(self, args):
"""execute the benchmark"""
- default_args = "-ioengine=libaio -direct=1 " \
- "-group_reporting -numjobs=1 -time_based"
+ default_args = "-ioengine=libaio -direct=1 -group_reporting " \
+ "-numjobs=1 -time_based --output-format=json"
+ result = {}
if not self.setup_done:
self.setup()
@@ -97,21 +98,32 @@ class Fio(base.Scenario):
else:
runtime = 30
- args = "-filename=%s -bs=%s -iodepth=%s -rw=%s -ramp_time=%s " \
- "-runtime=%s -name=%s" \
- % (filename, bs, iodepth, rw, ramp_time, runtime, name)
- cmd = "sudo bash fio.sh %s %s %s" \
- % (filename, args, default_args)
+ cmd_args = "-filename=%s -bs=%s -iodepth=%s -rw=%s -ramp_time=%s " \
+ "-runtime=%s -name=%s %s" \
+ % (filename, bs, iodepth, rw, ramp_time, runtime, name,
+ default_args)
+ cmd = "sudo bash fio.sh %s %s" % (filename, cmd_args)
LOG.debug("Executing command: %s", cmd)
- status, stdout, stderr = self.client.execute(cmd)
+ # Set timeout, so that the cmd execution does not exit incorrectly
+ # when the test run time is last long
+ timeout = int(ramp_time) + int(runtime) + 600
+ status, stdout, stderr = self.client.execute(cmd, timeout=timeout)
if status:
raise RuntimeError(stderr)
- data = json.loads(stdout)
+ raw_data = json.loads(stdout)
+
+ # The bandwidth unit is KB/s, and latency unit is us
+ result["read_bw"] = raw_data["jobs"][0]["read"]["bw"]
+ result["read_iops"] = raw_data["jobs"][0]["read"]["iops"]
+ result["read_lat"] = raw_data["jobs"][0]["read"]["lat"]["mean"]
+ result["write_bw"] = raw_data["jobs"][0]["write"]["bw"]
+ result["write_iops"] = raw_data["jobs"][0]["write"]["iops"]
+ result["write_lat"] = raw_data["jobs"][0]["write"]["lat"]["mean"]
# TODO: add sla check
- return data
+ return result
def _test():
@@ -133,8 +145,9 @@ def _test():
"filename": "/home/ec2-user/data.raw",
"bs": "4k",
"iodepth": "1",
- "rw": "write",
- "ramp_time": 10,
+ "rw": "rw",
+ "ramp_time": 1,
+ "duration": 10
}
args = {"options": options}
diff --git a/yardstick/benchmark/scenarios/storage/fio_benchmark.bash b/yardstick/benchmark/scenarios/storage/fio_benchmark.bash
index 0fa319dd4..2ef7f4949 100644
--- a/yardstick/benchmark/scenarios/storage/fio_benchmark.bash
+++ b/yardstick/benchmark/scenarios/storage/fio_benchmark.bash
@@ -15,7 +15,6 @@ set -e
FIO_FILENAME=$1
shift
OPTIONS="$@"
-OUTPUT_FILE="yardstick-fio.log"
# setup data file for fio
setup()
@@ -25,43 +24,10 @@ setup()
fi
}
-# run fio test
+# run fio test and write json format result to stdout
run_test()
{
- fio $OPTIONS --output=$OUTPUT_FILE
-}
-
-# write the result to stdout in json format
-output_json()
-{
- read_bw=$(grep "READ.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $9}')
- write_bw=$(grep "WRITE.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $8}')
- eval $(grep -e '\ lat.*stdev' -e "read.*iops" -e "write.*iops" -e "trim.*iops" $OUTPUT_FILE | sed 'N;s/\n/ /g' | grep read | awk -F [=\ ,\(\)] '{printf("read_iops=%s; read_lat_unit=%s; read_lat=%s", $12, $24, $33)}')
- eval $(grep -e '\ lat.*stdev' -e "read.*iops" -e "write.*iops" -e "trim.*iops" $OUTPUT_FILE | sed 'N;s/\n/ /g' | grep write | awk -F [=\ ,\(\)] '{printf("write_iops=%s; write_lat_unit=%s; write_lat=%s", $11, $23, $32)}')
-
- read_bw=${read_bw:-N/A}
- write_bw=${write_bw:-N/A}
- read_iops=${read_iops:-N/A}
- write_iops=${write_iops:-N/A}
- if [ "x$read_lat" = "x" ]; then
- read_lat="N/A"
- else
- read_lat=$read_lat$read_lat_unit
- fi
- if [ "x$write_lat" = "x" ]; then
- write_lat="N/A"
- else
- write_lat=$write_lat$write_lat_unit
- fi
-
- echo -e "{ \
- \"read_bw\":\"$read_bw\", \
- \"write_bw\":\"$write_bw\", \
- \"read_iops\":\"$read_iops\", \
- \"write_iops\":\"$write_iops\", \
- \"read_lat\":\"$read_lat\", \
- \"write_lat\":\"$write_lat\" \
- }"
+ fio $OPTIONS
}
# main entry
@@ -71,10 +37,7 @@ main()
setup
# run the test
- run_test >/dev/null
-
- # output result
- output_json
+ run_test
}
main