From d01c4ca73843bb1bc78c421531aa14250ad10ae6 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sun, 13 Feb 2011 21:12:52 -0800 Subject: [PATCH] Spread test files for mixedbench across multiple subdirectories. --- microbench/mixedbench.c | 12 ++++-- microbench/run2.sh | 65 ++++++++++++++++++++---------- microbench/setup/prepare-benchmark | 8 +++- microbench/setup/run-benchmark | 3 +- 4 files changed, 60 insertions(+), 28 deletions(-) diff --git a/microbench/mixedbench.c b/microbench/mixedbench.c index 1093a96..07584e1 100644 --- a/microbench/mixedbench.c +++ b/microbench/mixedbench.c @@ -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 @@ -25,7 +26,7 @@ #include #include -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)); diff --git a/microbench/run2.sh b/microbench/run2.sh index 24f4348..a5297ac 100755 --- a/microbench/run2.sh +++ b/microbench/run2.sh @@ -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 diff --git a/microbench/setup/prepare-benchmark b/microbench/setup/prepare-benchmark index 0102705..bb6907e 100755 --- a/microbench/setup/prepare-benchmark +++ b/microbench/setup/prepare-benchmark @@ -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 diff --git a/microbench/setup/run-benchmark b/microbench/setup/run-benchmark index 422ae05..ae2728f 100755 --- a/microbench/setup/run-benchmark +++ b/microbench/setup/run-benchmark @@ -50,7 +50,8 @@ pushd $MNTDIR >/dev/null $BENCH_THREADS \ $BENCH_DURATION \ $BENCH_OPS \ - $BENCH_INTERVALS + $BENCH_INTERVALS \ + $BENCH_DIRSIZE pkill -TERM lockmem -- 2.20.1