fstests: add fio perf results support
PATCH v2 1/2 fstests: add fio perf results support
From: Josef Bacik <[email protected]>
This patch does the nuts and bolts of grabbing fio results and storing them in a database in order to check against for future runs. This works by storing the results in resuts/fio-results.db as a sqlite database. The src/perf directory has all the supporting python code for parsing the fio json results, storing it in the database, and loading previous results from the database to compare with the current results.
This also adds a PERF_CONFIGNAME option that must be set for this to work. Since we all have various ways we run fstests it doesn't make sense to compare different configurations with each other (unless specifically desired). The PERF_CONFIGNAME will allow us to separate out results for different test run configurations to make sure we're comparing results correctly.
Currently we only check against the last perf result. In the future I will flesh this out to compare against the average of N number of runs to be a little more complete, and hopefully that will allow us to also watch latencies as well.
---
v1-v2:
- moved helpers into common/perf
- changed the python stuff to specifically use python2 since that's the lowest common demoninator
.gitignore | 1 + common/config | 2 + common/perf | 41 ++++++++++++++ src/perf/FioCompare.py | 106 +++++++++++++++++++++++++++++++++++++ src/perf/FioResultDecoder.py | 58 ++++++++++++++++++++ src/perf/ResultData.py | 43 +++++++++++++++ src/perf/fio-insert-and-compare.py | 32 +++++++++++ src/perf/fio-results.sql | 93 ++++++++++++++++++++++++++++++++ src/perf/generate-schema.py | 49 +++++++++++++++++ 9 files changed, 425 insertions(+) create mode 100644 common/perf create mode 100644 src/perf/FioCompare.py create mode 100644 src/perf/FioResultDecoder.py create mode 100644 src/perf/ResultData.py create mode 100644 src/perf/fio-insert-and-compare.py create mode 100644 src/perf/fio-results.sql create mode 100644 src/perf/generate-schema.py
.gitignore +1 -0
@@ -156,6 +156,7 @@ /src/aio-dio-regress/aiocp /src/aio-dio-regress/aiodio_sparse2 /src/log-writes/replay-log +/src/perf/*.pyc # dmapi/ binaries /dmapi/src/common/cmd/read_invis
common/config +2 -0
@@ -195,6 +195,8 @@ export MAN_PROG="`set_prog_path man`" export NFS4_SETFACL_PROG="`set_prog_path nfs4_setfacl`" export NFS4_GETFACL_PROG="`set_prog_path nfs4_getfacl`" export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`" +export PYTHON2_PROG="`set_prog_path python2`" +export SQLITE3_PROG="`set_prog_path sqlite3`" # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled. # newer systems have udevadm command but older systems like RHEL5 don't.
common/perf new file +41 -0
41 lines not on this page · raw message
src/perf/FioCompare.py new file +106 -0
106 lines not on this page · raw message
src/perf/FioResultDecoder.py new file +58 -0
58 lines not on this page · raw message
src/perf/ResultData.py new file +43 -0
43 lines not on this page · raw message
src/perf/fio-insert-and-compare.py new file +32 -0
@@ -0,0 +1,32 @@ +import FioResultDecoder +import ResultData +import FioCompare +import json +import argparse +import sys +import platform + +parser = argparse.ArgumentParser() +parser.add_argument('-c', '--configname', type=str, + help="The config name to save the results under.", + required=True) +parser.add_argument('-d', '--db', type=str, + help="The db that is being used", required=True) +parser.add_argument('-n', '--testname', type=str, + help="The testname for the result", required=True) +parser.add_argument('result', type=str, + help="The result file to compare and insert") +args = parser.parse_args() + +result_data = ResultData.ResultData(args.db) + +json_data = open(args.result) +data = json.load(json_data, cls=FioResultDecoder.FioResultDecoder) +data['global']['name'] = args.testname +data['global']['config'] = args.configname +data['global']['kernel'] = platform.release() +result_data.insert_result(data) + +compare = result_data.load_last(args.testname, args.configname) +if FioCompare.compare_fiodata(compare, data, False): + sys.exit(1)
src/perf/fio-results.sql new file +93 -0
93 lines not on this page · raw message
src/perf/generate-schema.py new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 2/2 perf/001: a random write buffered fio perf test
From: Josef Bacik <[email protected]>
This uses the new fio results perf helpers to run a rand write buffered workload on the scratch device.
---v1->v2:
- updated to use the new _require_fio_results helper and moved the _fio_results_init call to after teh _require_fio check
tests/perf/001 | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/perf/001.out | 2 ++ 2 files changed, 76 insertions(+) create mode 100644 tests/perf/001 create mode 100644 tests/perf/001.out
tests/perf/001 new file +74 -0
@@ -0,0 +1,74 @@ +#! /bin/bash +# perf/001 Test +# +# Buffered random write performance test. +# +#----------------------------------------------------------------------- +# (c) 2017 Josef Bacik +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +fio_config=$tmp.fio +fio_results=$tmp.json +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/perf + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_block_device $SCRATCH_DEV +_require_fio_results + +rm -f $seqres.full + +_size=(16 * $LOAD_FACTOR) +cat >$fio_config <<EOF +[t1] +directory=${SCRATCH_MNT} +allrandrepeat=1 +readwrite=randwrite +size=${_size}G +ioengine=psync +end_fsync=1 +fallocate=none +EOF + +_require_fio $fio_config + +_fio_results_init +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +cat $fio_config >> $seqres.full +run_check $FIO_PROG --output-format=json --output=$fio_results $fio_config + +_scratch_unmount +_fio_results_compare $seq $fio_results +echo "Silence is golden" +status=0; exit
tests/perf/001.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 001 +Silence is golden
Signature · 1 line
2.7.4
Re: [PATCH 2/2][v2] perf/001: a random write buffered fio perf test
Hi Josef,
Quoted 10 lines · Josef Bacik
From: Josef Bacik <[email protected]>
This uses the new fio results perf helpers to run a rand write buffered workload on the scratch device.
Signed-off-by Josef Bacik <[email protected]>---
v1->v2:
- updated to use the new_require_fio_resultshelper and moved the_fio_results_initcall to after teh_require_fiocheck
I tried this v2 a bit, but met some problems, I haven't looked into the code closely though, just wanted to get a first impression of this perf test frame work.
- missing perf/group file, so test won't be run by check
- this test writes 16G files to SCRATCH_DEV by default, and my device has only 15G, so fio failed with ENOSPC, I think we need a require rule on the test device
- after working around the group file and device size issue, test still failed like
perf/001.full:
....
# /usr/local/bin/fio --output-format=json --output=/tmp/30750.json /tmp/30750.fio
# /usr/bin/python2 /root/xfstests/src/perf/fio-insert-and-compare.py -c default -d /root/xfstests/results//fio-results.db -n 001 /tmp/30750.json
Traceback (most recent call last):
File "/root/xfstests/src/perf/fio-insert-and-compare.py", line 28, in <module>
result_data.insert_result(data)
File "/root/xfstests/src/perf/ResultData.py", line 43, in insert_result
self._insert_obj('fio_jobs', job)
File "/root/xfstests/src/perf/ResultData.py", line 35, in _insert_obj
cur.execute(cmd, tuple(values))
sqlite3.IntegrityError: fio_jobs.trim_lat_ns_mean may not be NULL
failed: '/usr/bin/python2 /root/xfstests/src/perf/fio-insert-and-compare.py -c default -d /root/xfstests/results//fio-results.db -n 001 /tmp/30750.json'Am I missing something? BTW, I was using fio-2.6-2.el7.x86_64.
Thanks,
Eryu
Re: [PATCH 2/2][v2] perf/001: a random write buffered fio perf test
Quoted 14 lines · Eryu Guan
Hi Josef,
Quoted 10 lines · Josef Bacik
From: Josef Bacik <[email protected]>
This uses the new fio results perf helpers to run a rand write buffered workload on the scratch device.
Signed-off-by Josef Bacik <[email protected]>---
v1->v2:
- updated to use the new_require_fio_resultshelper and moved the_fio_results_initcall to after teh_require_fiocheck
Quoted 5 lines
I tried this v2 a bit, but met some problems, I haven't looked into the code closely though, just wanted to get a first impression of this perf test frame work.
- missing perf/group file, so test won't be run by check
Sigh shit, I knew that was going to happen. Forgot to add it to the commit, I'll add it in there.
Quoted 3 lines
- this test writes 16G files to
SCRATCH_DEVby default, and my device has only 15G, so fio failed with ENOSPC, I think we need a require rule on the test device
Oops yup I'll fix that.
Quoted 17 lines
- after working around the group file and device size issue, test still failed like
perf/001.full:
....# /usr/local/bin/fio --output-format=json --output=/tmp/30750.json /tmp/30750.fio # /usr/bin/python2 /root/xfstests/src/perf/fio-insert-and-compare.py -c default -d /root/xfstests/results//fio-results.db -n 001 /tmp/30750.json Traceback (most recent call last): File "/root/xfstests/src/perf/fio-insert-and-compare.py", line 28, in <module> result_data.insert_result(data) File "/root/xfstests/src/perf/ResultData.py", line 43, in insert_result self._insert_obj('fio_jobs', job) File "/root/xfstests/src/perf/ResultData.py", line 35, in _insert_obj cur.execute(cmd, tuple(values)) sqlite3.IntegrityError: fio_jobs.trim_lat_ns_mean may not be NULL failed: '/usr/bin/python2 /root/xfstests/src/perf/fio-insert-and-compare.py -c default -d /root/xfstests/results//fio-results.db -n 001 /tmp/30750.json'
Quoted 1 line
Am I missing something? BTW, I was using fio-2.6-2.el7.x86_64.
Nope again I forgot to commit local changes, sorry about that. I'll fix this up and try again. Thanks,
Josef