/me sending since Onkar client has an issue.
Begin forwarded message: Date: Tue, 26 Jul 2011 20:48:30 +0530 From: onkar mahajan <[email protected]> To: [email protected], [email protected] Cc: [email protected] Subject: [PATCH] Flexible File System Benchmark (FFSB) support in Autotest This patch adds to the Autotest framework capability to run the Flexible File System Benchmark. >From db21a1144073fa5f56b7dd501c4e7438f45bdf60 Mon Sep 17 00:00:00 2001 From: Onkar N Mahajan <[email protected]> Date: Tue, 26 Jul 2011 20:02:24 +0530 Subject: [PATCH] Flexible File System Benchmark (FFSB) support in Autotest Signed-off-by: Onkar N Mahajan <[email protected]> --- client/tests/ffsb/README | 43 ++++++ client/tests/ffsb/control | 18 +++ client/tests/ffsb/ffsb.py | 177 ++++++++++++++++++++++++ client/tests/ffsb/profile.cfg.sample | 25 ++++ client/tests/kvm/autotest_control/ffsb.control | 18 +++ client/tests/kvm/tests_base.cfg.sample | 2 + 6 files changed, 283 insertions(+), 0 deletions(-) create mode 100644 client/tests/ffsb/README create mode 100644 client/tests/ffsb/control create mode 100644 client/tests/ffsb/ffsb.py create mode 100644 client/tests/ffsb/profile.cfg.sample create mode 100644 client/tests/kvm/autotest_control/ffsb.control diff --git a/client/tests/ffsb/README b/client/tests/ffsb/README new file mode 100644 index 0000000..d15c311 --- /dev/null +++ b/client/tests/ffsb/README @@ -0,0 +1,43 @@ +INTRODUCTION: +============= +This patch integrates the Flexible Filesystem Benchmark (FFSB) with +the autotest. This integration enables the high-performace I/O load testing in the +KVM Virtual machine environment. +FFSB is a filesystem performance measurement tool. It is a multi-threaded +application (using pthreads), written entirely in C with cross-platform +portability in mind. It differs from other filesystem benchmarks in that +the user may supply a profile to create custom workloads, while most other +filesystem benchmarks use a fixed set of randomly generated workloads. + +More information about the FFSB can be got from reading the README in the +FFSB source directory which can be accessed from this link: +[http://sourceforge.net/projects/ffsb/] + +With this integration ,it is now possible to test variety of filesystems on +the KVM guest for : + +(1) directed I/O with sequential/random read/write. +(2) buffered I/O with sequential/random read/write. +(3) use varying block alignment boundries to measure filesystem behaviour. +(4) use multithreaded workloads to stress the filesystem. +(5) Exert weighted combination of I/O workloads to analyze the I/O performace + for a specific scenario. +(6) Age filesystem according to a specified workload upto a specified limit. + + Since the only interface used for the integration is a FFSB configuration file; +Autotest will be able to run variety of I/O tests on guest as FFSB improves, +with no or minimal code change in Autotest itself. + +USE: +==== + To use the FFSB for Filesystem testing, two configuration files +need to be modified - +(1) Usual - tests.cfg file to activate the ffsb tests through KVM. +(2) profile.cfg - where the workloads are specified. + +TODO: +==== +* Add validations for max. number of threads according to number of + vcpus exported by QEMU-KVM +* Test Autotest/ffsb +* Test FFSB itself. diff --git a/client/tests/ffsb/control b/client/tests/ffsb/control new file mode 100644 index 0000000..0164898 --- /dev/null +++ b/client/tests/ffsb/control @@ -0,0 +1,18 @@ +AUTHOR = "Onkar N Mahajan <[email protected]>" +NAME = "Flexible Filesystem Benchmark (FFSB)" +TEST_CATEGORY = "Filesystem Benchmark" +TEST_CLASS = "General" +TEST_TYPE = "client" +TIME = 'MEDIUM' +DOC = """\ + +The Flexible Filesystem Benchmark (FFSB) is a cross-platform +filesystem performance measurement tool. It uses customizable +profiles to measure of different workloads, and it supports +multiple groups of threads across multiple filesystems. + +For more info, see http://sourceforge.net/projects/ffsb/ + +""" + +job.run_test('ffsb') diff --git a/client/tests/ffsb/ffsb.py b/client/tests/ffsb/ffsb.py new file mode 100644 index 0000000..c2f7aae --- /dev/null +++ b/client/tests/ffsb/ffsb.py @@ -0,0 +1,177 @@ +import os, stat, string, logging, re, random, shutil +from autotest_lib.client.bin import test, os_dep, utils +from autotest_lib.client.common_lib import error + +class ffsb(test.test): + + version=1 + params = {} + tempdirs = [] + bytes = { 'K' : 1024 , 'k' : 1024 , + 'M' : 1048576 , 'm' : 1048576 , + 'G' : 1073741824 , 'g':1073741824, + 'T' : 1099511627776 , 't':1099511627776 + } + + + def initialize(self): + self.job.require_gcc() + self.results = [] + self.nfail=0 + + def find_mnt_pt(self,path): + pth = os.path.abspath(path) + while not os.path.ismount(pth): + pth = os.path.dirname(pth) + return pth + + def set_ffsb_params(self,usrfl) : + """ + This function checks for the user supplied FFSB profile file + and validates it against the availble resources on the + guest - currently only disk space validation is supported + but adjusting the number of threads according to the vcpus + exported by the qemu-kvm also needs to be added. + + @author Onkar N Mahajan ([email protected]) + """ + d = {} + fr = open(usrfl,'r') + for line in fr.read().split('\n'): + p = re.compile(r'\s*\t*\[{1}filesystem(\d+)\]{1}') + m = p.match(line) + if m: + fsno=int(line[m.start(1):m.end(1)]) + d[fsno] = [] + p = re.compile(r'(\s*\t*location)\=(.*)') + m = p.match(line) + if m: + path = line[m.start(2):m.end(2)] + mntpt=self.find_mnt_pt(path) + f=os.statvfs(mntpt) + avl_dsk_spc=f.f_bfree*f.f_bsize + avl_dsk_spc*=0.95 + d[fsno].append(mntpt) + d[fsno].append(int(avl_dsk_spc)) + p = re.compile(r'(\s*\t*num_files)\=(\d+)') + + m = p.match(line) + if m: + usrnumfl = int(line[m.start(2):m.end(2)]) + d[fsno].append(usrnumfl) + p = re.compile(r'(\s*\t*max_filesize)\=(\d+[kKMmGgTt]?)') + m = p.match(line) + if m: + usrmaxflsz=line[m.start(2):m.end(2)] + usrmaxflsz = int(usrmaxflsz[0:-1]) * self.bytes[usrmaxflsz[-1]] + d[fsno].append(usrmaxflsz) + for k in d.keys(): + while d[k][2]*d[k][3] >= d[k][1]: + d[k][2]-=1 + if d[k][2] == 0: + d[k][2]=1 + d[k][3]=d[k][1] + """ + If the ffsb mount point is on the same file system + then use the available disk space after the previous + tests + """ + for k1 in d.keys(): + if d[k1][0] == d[k][0]: + d[k1][1] -= (d[k][2]*d[k][3]) + fr.close() + return d + + def dup_ffsb_profilefl(self) : + """ + This generates a profile file which is a validated file + that is actually used by the FFSB on the guest + """ + self.usrfl = '%s/%s' % (os.path.split(self.srcdir)[0],'profile.cfg') + self.sysfl = '%s/%s' % (self.srcdir,'profile.cfg') + + """ + Validate the path from the FFSB configuration file, the + disk space available for the test ,warn the user and + change the file sizes and/or number of files to be used for + generating the workload according to the available disk space + on the guest. + """ + params=self.set_ffsb_params(self.usrfl) + + fsno=0 + fr = open(self.usrfl,'r') + fw = open(self.sysfl,'w') + for line in fr.read().split('\n'): + p = re.compile(r'\s*\t*\[{1}filesystem(\d+)\]{1}') + m = p.match(line) + if m: + fsno=int(line[m.start(1):m.end(1)]) + p = re.compile(r'(\s*\t*location)\=(.*)') + m = p.match(line) + if m: + while True: + dirnm = ''.join(random.choice(string.letters) for i in xrange(9)) + if line[m.end(2)-1] == '/': + newline='%s%s' % (line[0:m.end(2)],dirnm) + ffsbdir='%s%s' % (line[m.start(2):m.end(2)],dirnm) + else: + newline='%s/%s' % (line[0:m.end(2)],dirnm) + ffsbdir='%s/%s' % (line[m.start(2):m.end(2)],dirnm) + self.tempdirs.append(ffsbdir) + if os.path.exists(ffsbdir): + continue + else: + os.makedirs(ffsbdir) + break + fw.write(newline+'\n') + continue + p = re.compile(r'(\s*\t*num_files)\=(.*)') + m = p.match(line) + if m: + newline = '%s=%s' % (line[0:m.end(1)],str(params[fsno][2])) + fw.write(newline+'\n') + continue + p = re.compile(r'(\s*\t*max_filesize)\=(\d+[kKMmGgTt]?)') + m = p.match(line) + if m: + newline = '%s%s' % (line[0:m.start(2)],str(params[fsno][3])) + fw.write(newline+'\n') + continue + fw.write(line+'\n') + fr.close() + fw.close() + + + def setup(self, tarball = 'ffsb-6.0-rc2.tar.bz2'): + tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) + utils.extract_tarball_to_dir(tarball, self.srcdir) + os.chdir(self.srcdir) + os_dep.command('gcc') + utils.configure() + utils.make() + + + def run_once(self, dir=None, extra_args='', user='root'): + self.dup_ffsb_profilefl() + # Run FFSB using abspath + cmd = '%s/ffsb %s/profile.cfg' % (self.srcdir,self.srcdir) + logging.info("Executing : %s",(cmd)) + try: + self.results = utils.system_output(cmd, retain_output=True) + except error.CmdError, e: + self.nfail += 1 + logging.error('Failed to execute FFSB : %s', e) + + logging.info(self.results) + + + def postprocess(self): + if self.nfail != 0: + raise error.TestError('FFSB test failed.') + else: + logging.info('FFSB test passed') + logging.info('Cleaning up test data...') + for l in self.tempdirs: + shutil.rmtree(l) + diff --git a/client/tests/ffsb/profile.cfg.sample b/client/tests/ffsb/profile.cfg.sample new file mode 100644 index 0000000..e68fead --- /dev/null +++ b/client/tests/ffsb/profile.cfg.sample @@ -0,0 +1,25 @@ +# Large file random writes. +# 1024 files, 100MB per file. + +time=300 # 5 min +alignio=1 + +[filesystem0] +# For KVM Autotest , this will by-default +# be / , unless and until the user is absolutely +# sure what is is upto. + location=/ + num_files=2 + min_filesize=1G + max_filesize=2G +[end0] + +[threadgroup0] + num_threads=4 + + read_random=1 + read_weight=1 + + read_size=5242880 # 5 MB + read_blocksize=4096 +[end0] diff --git a/client/tests/kvm/autotest_control/ffsb.control b/client/tests/kvm/autotest_control/ffsb.control new file mode 100644 index 0000000..0164898 --- /dev/null +++ b/client/tests/kvm/autotest_control/ffsb.control @@ -0,0 +1,18 @@ +AUTHOR = "Onkar N Mahajan <[email protected]>" +NAME = "Flexible Filesystem Benchmark (FFSB)" +TEST_CATEGORY = "Filesystem Benchmark" +TEST_CLASS = "General" +TEST_TYPE = "client" +TIME = 'MEDIUM' +DOC = """\ + +The Flexible Filesystem Benchmark (FFSB) is a cross-platform +filesystem performance measurement tool. It uses customizable +profiles to measure of different workloads, and it supports +multiple groups of threads across multiple filesystems. + +For more info, see http://sourceforge.net/projects/ffsb/ + +""" + +job.run_test('ffsb') diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index b7342bd..346bfbf 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -302,6 +302,8 @@ variants: test_control_file = bonnie.control - ebizzy: test_control_file = ebizzy.control + - ffsb: + test_control_file = ffsb.control - stress: test_control_file = stress.control - disktest: -- 1.7.3.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
