Spread test files for mixedbench across multiple subdirectories.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 14 Feb 2011 05:12:52 +0000 (21:12 -0800)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 14 Feb 2011 05:12:52 +0000 (21:12 -0800)
microbench/mixedbench.c
microbench/run2.sh
microbench/setup/prepare-benchmark
microbench/setup/run-benchmark

index 1093a96..07584e1 100644 (file)
@@ -10,6 +10,7 @@
  *   Benchmark duration (seconds)
  *   Target operations per second (aggregate across all threads)
  *   Interval count (how many times to report results during the run)
+ *   Directory size (number of files per numbered subdirectory)
  */
 
 #include <errno.h>
@@ -25,7 +26,7 @@
 #include <unistd.h>
 #include <math.h>
 
-int opt_filesize, opt_filecount, opt_threads, opt_duration, opt_intervals;
+int opt_filesize, opt_filecount, opt_threads, opt_duration, opt_intervals, opt_dirsize;
 double opt_writeratio, opt_ops;
 
 struct thread_state {
@@ -89,8 +90,10 @@ void benchmark_op(struct thread_state *ts)
 
     start = now_hires();
 
-    char filename[64];
-    sprintf(filename, "t%d/%d", ts->thread_num, get_random(opt_filecount));
+    char filename[256];
+    int n = get_random(opt_filecount);
+    int n1 = n / opt_dirsize, n2 = n % opt_dirsize;
+    sprintf(filename, "t%d/%d/%d", ts->thread_num, n1, n2);
 
     double r = get_random(1000000) / 1e6;
 
@@ -210,7 +213,7 @@ void reset_stats(int print, double duration)
 
 int main(int argc, char *argv[])
 {
-    if (argc != 8) {
+    if (argc != 9) {
         fprintf(stderr, "Usage: TODO\n");
         return 1;
     }
@@ -222,6 +225,7 @@ int main(int argc, char *argv[])
     opt_duration = atoi(argv[5]);
     opt_ops = atof(argv[6]);
     opt_intervals = atoi(argv[7]);
+    opt_dirsize = atoi(argv[7]);
 
     srandom(time(NULL));
 
index 24f4348..a5297ac 100755 (executable)
@@ -1,10 +1,12 @@
 #!/bin/bash
 
-PARAMS="BLUESKY_CACHE_SIZE BLUESKY_TARGET BENCH_DURATION BENCH_FILESIZE BENCH_FILECOUNT BENCH_WRITERATIO BENCH_THREADS BENCH_OPS BENCH_INTERVALS"
+PARAMS="BLUESKY_CACHE_SIZE BLUESKY_TARGET BENCH_DURATION BENCH_FILESIZE BENCH_FILECOUNT BENCH_WRITERATIO BENCH_THREADS BENCH_OPS BENCH_INTERVALS BENCH_DIRSIZE"
 
 BENCHER=c09-44.sysnet.ucsd.edu
 PROXY=c09-45.sysnet.ucsd.edu
 
+SSH_ARGS=""
+
 get_params() {
     for p in $PARAMS; do
         if [ -n "${!p}" ]; then
@@ -17,27 +19,46 @@ run_cmd() {
     host="$1"; shift
     cmd="$1"; shift
     echo "EXECUTE($host):" "$cmd" "$@" 1>&2
-    ssh -l root $host /scratch/bluesky.git/microbench/setup/$cmd "$@" $(get_params)
+    ssh $SSH_ARGS -l root $host /scratch/bluesky.git/microbench/setup/$cmd "$@" $(get_params)
 }
 
-for size in 512; do
-    BENCH_DURATION=20
-    BENCH_WRITERATIO=0.0
-    BLUESKY_TARGET=s3
-    BLUESKY_CACHE_SIZE=$(($size * 1024))
-
-    PREFIX=$BLUESKY_TARGET-$BENCH_WRITERATIO
-
-    echo "SETTINGS:" $(get_params)
-    get_params >$PREFIX.settings
-
-    run_cmd $PROXY cleanup-proxy
-    run_cmd $PROXY run-proxy >$PREFIX.proxy 2>&1 &
-    proxy_pid=$!
-    sleep 10
-    run_cmd $BENCHER prepare-benchmark
-    run_cmd $BENCHER run-benchmark | tee $PREFIX.results
-    run_cmd $PROXY stop-proxy
-    echo "Waiting for proxy to stop..."
-    wait $proxy_pid
+BLUESKY_TARGET=s3
+BLUESKY_CACHE_SIZE=$((512 * 1024))
+BENCH_FILESIZE=$((1 << 20))
+BENCH_FILECOUNT=$((62))
+BENCH_WRITERATIO=0.0
+BENCH_THREADS=4
+BENCH_DURATION=120
+BENCH_INTERVALS=10
+BENCH_DIRSIZE=256
+
+#for size in 128 256 512 768 1024 1536 2048; do
+#    for filesize in 4 32 256 2048; do
+for size in 128 256 512 768 1024 1536 2048; do
+    for filesize in 4 1024; do
+        BENCH_FILESIZE=$(($filesize * 1024))
+        BENCH_FILECOUNT=$(($size * 1024 / $filesize / $BENCH_THREADS))
+        PREFIX=$BLUESKY_TARGET-$BENCH_WRITERATIO-${size}M-${filesize}k
+
+        $HOME/bin/s3-cleanup.py
+        SSH_ARGS="-t"
+        run_cmd $PROXY cleanup-proxy
+        SSH_ARGS=""
+        run_cmd $PROXY run-proxy >$PREFIX.proxy 2>&1 &
+        proxy_pid=$!
+        sleep 10
+        run_cmd $BENCHER prepare-benchmark
+
+        #for BENCH_OPS in 2000 1500 1000 800 600 400 200 100 80 40 20 10; do
+        for BENCH_OPS in 2000 1000 500 200 100 50 20 10; do
+            sleep 10
+            echo "SETTINGS:" $(get_params)
+            get_params >$PREFIX-$BENCH_OPS.settings
+            run_cmd $BENCHER run-benchmark | tee $PREFIX-$BENCH_OPS.results
+        done
+
+        run_cmd $PROXY stop-proxy
+        echo "Waiting for proxy to stop..."
+        wait $proxy_pid
+    done
 done
index 0102705..bb6907e 100755 (executable)
@@ -15,6 +15,7 @@ BENCH_THREADS=8
 BENCH_DURATION=120
 BENCH_OPS=100
 BENCH_INTERVALS=4
+BENCH_DIRSIZE=256
 
 # Export any environment variables specified on the command line
 for e in "$@"; do
@@ -33,10 +34,15 @@ pushd $MNTDIR >/dev/null
 for t in $(seq 0 $(($BENCH_THREADS - 1))); do
     mkdir t$t
     for i in $(seq 0 $(($BENCH_FILECOUNT - 1))); do
-        dd if=/dev/zero of=t$t/$i bs=$BENCH_FILESIZE count=1
+        n1=$(($i / $BENCH_DIRSIZE))
+        n2=$(($i % $BENCH_DIRSIZE))
+        mkdir t$t/$n1
+        dd if=/dev/zero of=t$t/$n1/$n2 bs=$BENCH_FILESIZE count=1
     done
 done
 
+find -type f -exec sha1sum '{}' \;
+
 popd >/dev/null
 
 umount -f $MNTDIR
index 422ae05..ae2728f 100755 (executable)
@@ -50,7 +50,8 @@ pushd $MNTDIR >/dev/null
     $BENCH_THREADS \
     $BENCH_DURATION \
     $BENCH_OPS \
-    $BENCH_INTERVALS
+    $BENCH_INTERVALS \
+    $BENCH_DIRSIZE
 
 pkill -TERM lockmem