-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathstart-multi-clients.sh
executable file
·60 lines (55 loc) · 1.25 KB
/
start-multi-clients.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
#!/bin/bash
# Arguments: num_clients num_servers num_threads txrate [-drop]
if [ $# -lt 4 ]; then
echo "Usage: $0 <num_clients> <num_servers> <num_threads> <txrate> [-drop]"
exit 1
fi
NCLIENTS=$1
NSERVERS=$2
NTHREADS=$3
TXRATE=$4
DROP=$5
cd `dirname ${BASH_SOURCE-$0}`
. env.sh
echo "Starting multi-clients ($NCLIENTS) ..."
let i=0
let K=$NCLIENTS/2
for client in `cat $CLIENTS`; do
if [[ $i -lt $K ]]; then
echo $client index $i
ssh -oStrictHostKeyChecking=no $client $HL_HOME/start-clients.sh $NTHREADS $i $NSERVERS $TXRATE
fi
let i=$i+1
done
if [[ "$DROP" == "-drop" ]]; then
let M=$NSERVERS*10+320
let SR=$M-250
sleep 250
let idx=$NSERVERS-4
let i=0
for server in `cat $HOSTS`; do
if [[ $i -ge $idx ]]; then
ssh -oStrictHostKeyChecking=no $server killall -KILL peer java
echo "Dropped "$server
fi
let i=$i+1
done
sleep $SR
let i=0
for client in `cat $CLIENTS`; do
if [[ $i -lt $K ]]; then
ssh -oStrictHostKeyChecking=no $client 'killall -KILL driver'
fi
let i=$i+1
done
else
let M=$NSERVERS*10+300
sleep $M
let i=0
for client in `cat $CLIENTS`; do
if [[ $i -lt $K ]]; then
ssh -oStrictHostKeyChecking=no $client 'killall -KILL driver'
fi
let i=$i+1
done
fi