Skip to contentSkip to conversation

fstests: add fio perf results support

PATCH Superseded Josef Bacik 2 participants 4 messages Oct 18, 2017 – Oct 26, 2017

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
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 +
 common/config                      |   2 +
 common/perf                        |  41 ++++++++++++++
 src/perf/FioCompare.py             | 112 +++++++++++++++++++++++++++++++++++++
 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 ++++++++++++++++++
 9 files changed, 445 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
index ae7ef87ab384..986a6f7ff0ad 100644
@@ -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
index 71798f0adb1e..f6226d85bc10 100644
@@ -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 +112 -0

112 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
new file mode 100644
index 000000000000..064af6daaa40
@@ -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.4
#1 lore raw

PATCH v3 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.

---
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     | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/perf/001.out |  2 ++
 tests/perf/group   |  1 +
 3 files changed, 82 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 +79 -0
new file mode 100644
index 000000000000..73faef39e9af
@@ -0,0 +1,79 @@
+#! /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))
+_scratch_mkfs_sized $(($_size * 1024 * 1024 * 1024)) >> $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
+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
new file mode 100644
index 000000000000..88678b8ed5ad
@@ -0,0 +1,2 @@
+QA output created by 001
+Silence is golden
tests/perf/group new file +1 -0
new file mode 100644
index 000000000000..d3ed434926e7
@@ -0,0 +1 @@
+001 auto
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 2/2][v3] perf/001: a random write buffered fio perf test

Quoted 88 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.

---
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     | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/perf/001.out |  2 ++
 tests/perf/group   |  1 +
 3 files changed, 82 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 +59 -0
new file mode 100644
index 000000000000..73faef39e9af
@@ -0,0 +1,79 @@
+#! /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

tests/perf/001 line 69

Quoted 10 lines
tests/perf/001 new file +10 -0
+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))
+_scratch_mkfs_sized $(($_size * 1024 * 1024 * 1024)) >> $seqres.full 2>&1

I tend to mkfs & mount first and use _require_fs_space to check the available space, as _scratch_mkfs_sized creates exact 16G filesystem, and we're going to write 16G file to it and 100% fulfill the device.

tests/perf/001 line 73

Quoted 4 lines
tests/perf/001 new file +4 -0
+_scratch_mount
+
+cat $fio_config >> $seqres.full
+run_check $FIO_PROG --output-format=json --output=$fio_results $fio_config

Same here, avoid run_check if possible.

Quoted 20 lines
tests/perf/001 new file +6 -0
+
+_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
new file mode 100644
index 000000000000..88678b8ed5ad
@@ -0,0 +1,2 @@
+QA output created by 001
+Silence is golden
tests/perf/group new file +0 -0
new file mode 100644
index 000000000000..d3ed434926e7

tests/perf/group line 1

Quoted 1 line
tests/perf/group new file +1 -0
@@ -0,0 +1 @@
+001 auto

I think auto group is fine here, perf tests are not run by default in a '-g auto' run, even if perf/001 is in auto group. It only means it's a reliable & meaningful perf test, and we can run all 'auto' tests in perf dir with "./check -g perf/auto" anyway.

Thanks,
Eryu

#3 lore raw
In reply to Josef Bacik
Quoted 22 lines · Josef Bacik

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.

Quoted 12 lines

---
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.

v3 works fine now (after I deleted the old $RESULT_BASE/fio-result.db file), thanks!

Quoted 41 lines

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             | 112 +++++++++++++++++++++++++++++++++++++
 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 ++++++++++++++++++
 9 files changed, 445 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
index ae7ef87ab384..986a6f7ff0ad 100644
@@ -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 +0 -0
index 71798f0adb1e..f6226d85bc10 100644

common/config export MAN_PROG="`set_prog_path man`" · line 199

Quoted 5 lines
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`"

Can you please add a document file in doc dir to describe this new framework? And maybe update README file as well for the new prerequisite packages.

Quoted 38 lines
common/config +0 -0
 # 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 +29 -0
new file mode 100644
index 000000000000..b9b4f79c5edc
@@ -0,0 +1,41 @@
+#
+# Common perf specific functions
+#
+
+
+_require_fio_results()
+{
+	if [ -z "$PERF_CONFIGNAME" ]
+	then
+		_notrun "this test requires \$PERF_CONFIGNAME to be set"
+	fi
+	_require_command $PYTHON2_PROG python2
+
+	$PYTHON2_PROG -c "import sqlite3" >/dev/null 2>&1
+	[ $? -ne 0 ] && _notrun "this test requires python sqlite support"
+
+	$PYTHON2_PROG -c "import json" >/dev/null 2>&1
+	[ $? -ne 0 ] && _notrun "this test requires python json support"
+
+	_require_command $SQLITE3_PROG sqlite3
+}
+
+_fio_results_init()
+{
+	cat $here/src/perf/fio-results.sql | \
+		$SQLITE3_PROG $RESULT_BASE/fio-results.db
+	[ $? -ne 0 ] && _fail "failed to create results database"
+	[ ! -e $RESULT_BASE/fio-results.db ] && \
+		_fail "failed to create results database"

common/perf line 39

Quoted 10 lines
common/perf new file +10 -0
+}
+
+_fio_results_compare()
+{
+	_testname=$1
+	_resultfile=$2
+
+	run_check $PYTHON2_PROG $here/src/perf/fio-insert-and-compare.py \
+		-c $PERF_CONFIGNAME -d $RESULT_BASE/fio-results.db \
+		-n $_testname $_resultfile

Hmm, please avoid using run_check, it makes reviewing result harder

+failed: '/usr/bin/python2 /root/workspace/xfstests/src/perf/fio-insert-and-compare.py -c test -d /root/workspace/xfstests/results//fio-results.db -n 001 /tmp/7002.json' +(see /root/workspace/xfstests/results//xfs_4k_crc/perf/001.full for details)

then I need to open 001.full to see why test failed.

I'd prefer just dumping the fio-insert-and-compare.py output to stdout so that breaks golden image, and we can see the failure reason from the diff output directly.

+read_iops is a-ok 0.0 0.0
+ write_iops improved: old 25097.55864 new 30469.460103 21.4040797356%
+trim_iops is a-ok 0.0 0.0
+read_io_bytes is a-ok 0 0
+write_io_bytes is a-ok 2097152 2097152
+trim_io_bytes is a-ok 0 0
+read_bw is a-ok 0 0
+ write_bw improved: old 100390 new 121877 21.4035262476%
+trim_bw is a-ok 0 0
+ sys_cpu regressed: old 56.795443 new 65.384168 15.122207956%
+ elapsed improved: old 22 new 18 -18.1818181818%

So I know test failed because "sys_cpu regressed", if I want more details I can look at perf/001.full file.

(skipped the shining python code :)

Thanks,
Eryu