From 3b5869178bd52ca9092f3195d10f5e388cbcb7d6 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 22 Sep 2010 13:52:28 -0700 Subject: [PATCH] Starting work on scripts to automate benchmarking. --- microbench/microbench.py | 46 +++++++++++++++++++++++++++++++++++++++ microbench/setup/build-fs | 10 +++++++++ 2 files changed, 56 insertions(+) create mode 100755 microbench/microbench.py create mode 100755 microbench/setup/build-fs diff --git a/microbench/microbench.py b/microbench/microbench.py new file mode 100755 index 0000000..3e0cd4d --- /dev/null +++ b/microbench/microbench.py @@ -0,0 +1,46 @@ +#!/usr/bin/python + +import os, subprocess, sys, time + +MNTDIR = '/mnt/bluesky' +SERVER = 'c09-45.sysnet.ucsd.edu' + +class TestClient: + def setup_client(self, export): + subprocess.check_call(['mount', '-t', 'nfs', + '-o', 'vers=3,tcp,rw,soft,intr', + export, MNTDIR]) + + def cleanup_client(self): + subprocess.check_call(['umount', '-f', MNTDIR]) + + def run(self, export): + self.setup_client(export) + try: + results = self.run_test() + finally: + self.cleanup_client() + return results + +class BlueSkyServer: + def setup_server(self): + subprocess.call(['ssh', SERVER, '']) + +class SerialStat(TestClient): + """Call stat() on a set of files sequentially and measure the response time + for each call.""" + + def run_test(self): + files = [MNTDIR + "/file-%d" % (i,) for i in range(8)] + + times = [] + for f in files: + start = time.time() + os.stat(f) + times.append(time.time() - start) + + return times + +if __name__ == '__main__': + test = SerialStat() + print test.run('niniel.sysnet.ucsd.edu:/export') diff --git a/microbench/setup/build-fs b/microbench/setup/build-fs new file mode 100755 index 0000000..b171211 --- /dev/null +++ b/microbench/setup/build-fs @@ -0,0 +1,10 @@ +#!/bin/bash + +# Create a directory with a number of small files. Space out the creation of +# each file by several seconds so that for BlueSky, without running the +# cleaner, the inodes should end up in separate log files in the cloud. +mkdir small +for i in {0..15}; do + sleep 5 + dd if=/dev/urandom bs=4k count=1 of=small/file-$i +done -- 2.20.1