fstests: add fio perf results support
PATCH v5 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.
---v4->v5:
- add sqlite to the packages list in README
v3->v4:
- added docs to the README and requirements doc.
- fixed FioCompare.py to only print messages on regressions.
- removed the run_check for fio-insert-and-compare so regressions get dumped into the .out file.
v2->v3:
- fixed FioResultDecoder.py so it would translate from older versions of fio properly
- fixed FioCompare.py to be a bit more verbose so we know things are working or what goes wrong when it isn't.
- fixed fio-insert-and-compare.py so it grabbed the last resulte _before_ we insert a new result.
- fixed generate-schema.py to generate an updated schema, including not using NOT NULL for all of the fields in case we have some missing fields from older versions of fio that we don't care about.
- updated fio-results.sql with the new schema.
v1->v2:
- moved helpers into common/perf
- changed the python stuff to specifically use python2 since that's the lowest common demoninator
.gitignore | 1 + README | 11 +++- common/config | 2 + common/perf | 41 ++++++++++++++ doc/requirement-checking.txt | 9 +++ src/perf/FioCompare.py | 113 +++++++++++++++++++++++++++++++++++++ src/perf/FioResultDecoder.py | 62 ++++++++++++++++++++ src/perf/ResultData.py | 43 ++++++++++++++ src/perf/fio-insert-and-compare.py | 35 ++++++++++++ src/perf/fio-results.sql | 94 ++++++++++++++++++++++++++++++ src/perf/generate-schema.py | 55 ++++++++++++++++++ 11 files changed, 463 insertions(+), 3 deletions(-) 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
README +8 -3
@@ -8,13 +8,13 @@ _______________________ sudo apt-get install xfslibs-dev uuid-dev libtool-bin \ e2fsprogs automake gcc libuuid1 quota attr libattr1-dev make \ libacl1-dev libaio-dev xfsprogs libgdbm-dev gawk fio dbench \ - uuid-runtime + uuid-runtime python sqlite3 For Fedora, RHEL, or CentOS: yum install acl attr automake bc dbench dump e2fsprogs fio \ gawk gcc indent libtool lvm2 make psmisc quota sed \ xfsdump xfsprogs \ libacl-devel libattr-devel libaio-devel libuuid-devel \ - xfsprogs-devel btrfs-progs-devel + xfsprogs-devel btrfs-progs-devel python sqlite (Older distributions may require xfsprogs-qa-devel as well.) (Note that for RHEL and CentOS, you may need the EPEL repo.) - run make
@@ -93,7 +93,12 @@ Preparing system for tests: unmounting to run the offline check. - setenv LOGWRITES_DEV to a block device to use for power fail testing. - + - setenv PERF_CONFIGNAME to a arbitrary string to be used for + identifying the test setup for running perf tests. This should + be different for each type of performance test you wish to run so + that relevant results are compared. For example 'spinningrust' + for configurations that use spinning disks and 'nvme' for tests + using nvme drives. - or add a case to the switch in common/config assigning these variables based on the hostname of your test machine
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
doc/requirement-checking.txt +9 -0
@@ -122,3 +122,12 @@ _require_log_writes The test requires the use of the device mapper target log-writes. The test also requires the test program log-writes/replay-log is built and will be skipped if either isn't available. + +====================== +PERF TEST REQUIREMENTS +====================== + +_require_fio_results + + This test requires the supporting tools for saving and comparing fio based + perf test results.
src/perf/FioCompare.py new file +113 -0
113 lines not on this page · raw message
src/perf/FioResultDecoder.py new file +62 -0
62 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 +35 -0
@@ -0,0 +1,35 @@ +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) +compare = result_data.load_last(args.testname, args.configname) + +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) + +if compare is None: + sys.exit(0) + +if FioCompare.compare_fiodata(compare, data, False): + sys.exit(1)
src/perf/fio-results.sql new file +94 -0
94 lines not on this page · raw message
src/perf/generate-schema.py new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.7.5
PATCH v5 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.
---v4->v5:
- no change
v3->v4:
- use _require_fs_space instead of _scratch_mkfs_sized.
- remove run_check from running fio.
v2->v3:
- use _scratch_mkfs_sized so we skip if our scratch device is too small.
- dump the fio results into teh seqres.full file for debugging.
- fixed the _size math, it was all wrong.
v1->v2:
- no change
tests/perf/001 | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/perf/001.out | 2 ++ tests/perf/group | 1 + 3 files changed, 83 insertions(+) create mode 100644 tests/perf/001 create mode 100644 tests/perf/001.out create mode 100644 tests/perf/group
tests/perf/001 new file +80 -0
@@ -0,0 +1,80 @@ +#! /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 + +# We are going to write at least 16gib, make sure our scratch fs is large enough +# to fit and not deal with any enospc overhead. +_size=$(($_size * 4 * 1024 * 1024)) +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount +_require_fs_space $SCRATCH_MNT $_size + +cat $fio_config >> $seqres.full +$FIO_PROG --output-format=json --output=$fio_results $fio_config + +_scratch_unmount +cat $fio_results >> $seqres.full +_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
tests/perf/group new file +1 -0
@@ -0,0 +1 @@ +001 auto
Signature · 1 line
2.7.5