-
Notifications
You must be signed in to change notification settings - Fork 5
/
vc.sh
executable file
·184 lines (154 loc) · 5.07 KB
/
vc.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash
set -x
# protocol to run: "copilot", "latentcopilot", "epaxos", "multipaxos" (default)
proto=$1
n=$2 # number of replicas
clients=$3 # number of client threads
cnodes=$4 # number of client machines
reqs=1000000
exec="true"
reply="true"
durable="false"
check="true"
cpus=16
#prefix="/proj/cops/$USER/slowdown"
prefix=$(pwd)
#outputDir=""
cpuprofile=""
verbose="true"
numkeys=100000
length="180" # experiment length
trim="0.25"
writes=100 # percentage of writes
#conflicts=$1 # <0: zipf ; >=0:uniform, conflict x%
#conflicts=0 # <0: zipf ; >=0:uniform, conflict x%
conflicts=25 # <0: zipf ; >=0:uniform, conflict x%
#conflicts=100 # <0: zipf ; >=0:uniform, conflict x%
proxyReplica=0 # for epaxos only
#thrifty="true" # YES thrifty
thrifty="false" # NO thrifty
once="false"
tput_interval_in_sec="0.5"
target_rps="2000"
doEpaxos="false"
doTwoLeaders="false"
doCopilot="false"
doLatentCopilot="false"
if [ "$proto" == "copilot" ]; then
echo "### Run Copilot protocol ###"
doTwoLeaders="true"
doCopilot="true"
elif [ "$proto" == "latentcopilot" ]; then
echo "### Run Latent Copilot protocol ###"
doTwoLeaders="true"
doLatentCopilot="true"
elif [ "$proto" == "epaxos" ]; then
echo "### Run EPaxos protocol ###"
doEpaxos="true"
else
echo "### Run Multi-Paxos protocol ###"
fi
# number of client threads on each client node
threads=$((clients / cnodes))
#echo $threads
masterAddr="node-1"
masterPort="7087"
serverPort="7070"
exp_uid=$(date +%s)
if [[ "$#" -gt 4 ]]
then
exp_uid="${exp_uid}_$5"
fi
exp_uid="${exp_uid}_${variable}"
outputDir="${prefix}/experiments/${exp_uid}/"
mkdir -p ${outputDir}
rm ${prefix}/experiments/latest
ln -s $outputDir ${prefix}/experiments/latest
echo -e "Running ${proto} at $(date)\t${exp_uid}\t${n}\t${clients}\t${cnodes}" >> ${prefix}/progress
# Cleanup
totalNodes=$((n + cnodes + 1))
for i in $(seq 1 $totalNodes); do
(ssh -t -t -o StrictHostKeyChecking=no node-$i "\
cd $prefix; ./killall.sh") &
pid=$!
pids="$pids $pid"
done
for pid in $pids; do
wait $pid
done
# Start Master
for i in $(seq 1 1); do
ssh node-$i -o StrictHostKeyChecking=no "\
cd $prefix; \
bin/master \
-N=$n \
-twoLeaders=$doTwoLeaders" \
2>&1 | awk '{ print "Master: "$0 }' &
done
# Start Servers
declare -a pids
for i in $(seq 2 $((n + 1))); do
ssh -o StrictHostKeyChecking=no node-$i "\
cd $prefix; bin/server -maddr=${masterAddr} -mport=${masterPort} -addr=node-$i -port=${serverPort} -e=$doEpaxos -copilot=$doCopilot -latentcopilot=$doLatentCopilot -exec=$exec -dreply=$reply -durable=$durable -p=$cpus -thrifty=$thrifty" \
2>&1 | awk '{ print "Server-'$i': "$0 }' &
sleep 2
done
sleep 5
unset pids
offset=$((n + 2))
leftover=$((clients%cnodes))
clientId=0
cnodes_per_server=$((cnodes/n))
for i in $(seq 0 $((cnodes - 1))); do
# actual node-x on emulab to ssh
nodeId=$((i + offset))
processes_per_node=${threads}
if [ "$i" -lt "$leftover" ]; then
processes_per_node=$((threads+1))
fi
for j in $(seq 0 $((processes_per_node - 1))); do
# specify proxy replica for epaxos client
if [ "$proto" == "epaxos" ] && [ "$proxyReplica" -ge 0 ]; then
#proxyReplica=$((clientId%n))
proxyReplica=$((i/cnodes_per_server))
fi
ssh node-${nodeId} -o StrictHostKeyChecking=no "\
cd $prefix;
bin/clientol -maddr=${masterAddr} -mport=${masterPort} -q=$reqs -check=true -e=$doEpaxos -twoLeaders=$doTwoLeaders -numKeys=${numkeys} -c=$conflicts -id=$clientId -cpuprofile=${cpuprofile} -prefix=$outputDir -runtime=$length -trim=${trim} -w=$writes -proxy=$proxyReplica -p=$cpus -tput_interval_in_sec=${tput_interval_in_sec} -target_rps=${target_rps}" \
2>&1 | awk '{ print "Client-'$clientId'(node-'$nodeId'): "$0 }' &
pid=$!
pids="$pids $pid"
clientId=$((clientId+1))
done
done
(sleep 90; echo -e "Kill Pilot-0 at $(date) $(date +%s)" >> progress; ssh -t -t -o StrictHostKeyChecking=no node-2 "\
cd $prefix; ./killall.sh") &
#(sleep 60; echo -e "Kill Pilot-0 at $(date)" >> progress; ssh -t -t -o StrictHostKeyChecking=no node-2 "\
# cd $prefix; ./killall.sh"; ssh -t -t -o StrictHostKeyChecking=no node-3 "\
# cd $prefix; ./killall.sh") &
#(sleep 90; echo -e "Kill Pilot-0 at $(date)" >> progress; \
#(ssh -t -t -o StrictHostKeyChecking=no node-2 "cd $prefix; ./killall.sh")& \
#(ssh -t -t -o StrictHostKeyChecking=no node-3 "cd $prefix; ./killall.sh")&)&
for pid in $pids; do
wait $pid
done
sleep 2
# Cleanup
for i in $(seq 1 $totalNodes); do
ssh -t -t -o StrictHostKeyChecking=no node-$i "\
cd $prefix; ./killall.sh"
done
####################
# put all throughput latency in one place for easy plotting
cd ${outputDir}
awkScriptPath="${prefix}/scripts/median.awk"
latencyScriptPath="${prefix}/scripts/latency.bash"
for i in $(seq 0 $((clients - 1))); do
cat client-$i.tputlat.txt >>clients.tputlat.txt
done
# sum throughput of all clients
awk -F"\t" '{sum+=$1;}END{print sum;}' clients.tputlat.txt >tput.txt
source ${latencyScriptPath}
echo -e "$(cat tput.txt)\t$(awk 'BEGIN { ORS = "\t" } { print $2 }' percentilesnew.txt)" | tee tputlat.txt
cd $prefix
python scritps/tput.py $clients ${tput_interval_in_sec} ${outputDir}