-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscale.sh
executable file
·150 lines (127 loc) · 3.86 KB
/
scale.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env bash
# Extra DaisyNFS/GoJournal commit combinations can be tried by passing extra
# arguments after the first. For example,
#
# > ./scale.sh 1 abc123,xyz456 def123,master
#
# Will, in addition to the standard battery of tests, also run DaisyNFS with
# commit abc123 using GoJournal from go-nfsd with commit xyz456 and
# DaisyNFS with commit def123 and go-nfsd master.
set -eu
blue=$(tput setaf 4 || echo)
reset=$(tput sgr0 || echo)
info() {
echo -e "${blue}$1${reset}" 1>&2
}
if [ ! -d "$DAISY_NFSD_PATH" ]; then
echo "DAISY_NFSD_PATH is unset" 1>&2
exit 1
fi
if [ ! -d "$GO_NFSD_PATH" ]; then
echo "GO_NFSD_PATH is unset" 1>&2
exit 1
fi
if [ ! -d "$GO_JRNL_PATH" ]; then
echo "GO_JRNL_PATH is unset" 1>&2
exit 1
fi
usage() {
echo "Usage: $0 [-disk DISK_FILE] [-o | --output OUT_FILE] [threads]" 1>&2
echo 1>&2
echo "threads defaults to 10" 1>&2
echo "DISK_FILE defaults to ~/disk.img" 1>&2
}
# the path to store the disk file in (use this to run the benchmarks on a real
# drive)
disk_file="$HOME/disk.img"
output_file="$DAISY_NFSD_PATH/eval/data/scale-raw.txt"
while true; do
case "$1" in
-disk)
shift
disk_file="$1"
shift
;;
-o | --output)
shift
output_file="$1"
shift
;;
-help | --help)
usage
exit 0
;;
-*)
error "unexpected flag $1"
usage
exit 1
;;
*)
break
;;
esac
done
output_file=$(realpath "$output_file")
threads=10
if [[ $# -gt 0 ]]; then
threads="$1"
fi
shift
cd "$GO_NFSD_PATH"
go build ./cmd/fs-smallfile
go build ./cmd/fs-largefile
do_eval() {
if [[ $# -gt 0 ]]; then
for var in "$@"; do
echo 1>&2
IFS="," read -r dnfsver goosever <<<"$var"
info "DaisyNFS-$dnfsver-$goosever smallfile scalability"
info "Assuming DaisyNFS is using $GO_JRNL_PATH for GoJournal"
cd "$GO_JRNL_PATH"
git checkout "$goosever" --quiet
cd "$DAISY_NFSD_PATH"
git checkout "$dnfsver" --quiet
go mod edit -replace github.com/mit-pdos/go-journal="$GO_JRNL_PATH"
echo "fs=dfns-$dnfsver-$goosever"
./bench/run-daisy-nfsd.sh -disk "$disk_file" "$GO_NFSD_PATH"/fs-smallfile -threads="$threads"
done
cd "$DAISY_NFSD_PATH"
go mod edit -dropreplace github.com/mit-pdos/go-journal
git checkout main --quiet
cd "$GO_JRNL_PATH"
git checkout master --quiet
fi
cd "$DAISY_NFSD_PATH"
echo 1>&2
info "DaisyNFS smallfile scalability"
echo "fs=dnfs"
./bench/run-daisy-nfsd.sh -disk "$disk_file" "$GO_NFSD_PATH"/fs-smallfile -threads="$threads"
cd "$GO_NFSD_PATH"
echo 1>&2
info "Linux smallfile scalability"
echo "fs=linux"
./bench/run-linux.sh -disk "$disk_file" "$GO_NFSD_PATH"/fs-smallfile -threads="$threads"
echo 1>&2
info "Serial DaisyNFS (holding locks)"
# we change the local checkout of go-journal
cd "$GO_JRNL_PATH"
git apply "$GO_NFSD_PATH/eval/serial.patch"
cd "$DAISY_NFSD_PATH"
# ... and then also point go-nfsd to the local version
go mod edit -replace github.com/mit-pdos/go-journal="$GO_JOURNAL_PATH"
echo "fs=serial-dnfs"
./bench/run-daisy-nfsd.sh -disk "$disk_file" "$GO_NFSD_PATH"/fs-smallfile -threads="$threads"
go mod edit -dropreplace github.com/mit-pdos/go-journal
cd "$GO_JRNL_PATH"
git restore wal/installer.go wal/logger.go wal/wal.go
cd "$GO_NFSD_PATH"
echo 1>&2
info "GoNFS smallfile scalability"
echo "fs=gonfs"
./bench/run-go-nfsd.sh -disk "$disk_file" "$GO_NFSD_PATH"/fs-smallfile -threads="$threads"
}
if [ "$output_file" = "-" ]; then
do_eval "$@"
else
do_eval "$@" | tee "$output_file"
fi