-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster_test.sh
72 lines (55 loc) · 1.64 KB
/
cluster_test.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
#!/bin/bash -xe
TEBIS_PATH="/home1/public/orchiot/tebis"
CLIENT_HOSTS=""
SERVER_HOST=""
SERVER_PORT=25565
printf "bash arguments = %d\n" $#
while [ $# -gt 0 ]; do
case "$1" in
--server)
if [[ -z $2 ]]; then
printf "no server host provided\n"
exit 1
fi
SERVER_HOST="$2"
shift 2
;;
--clients)
if [[ -z $2 ]]; then
printf "no client host(s) provided\n"
exit 1
fi
CLIENT_HOSTS="$2"
shift 2
;;
--help)
printf "Usage: $(basename $0) [--server shost] [--clients chosts]\n"
shift
;;
*)
printf "Usage: $(basename $0) [--server shost] [--clients chosts]\n"
exit 1
;;
esac
done
### Launching Server ###
# ./tcp-server --bind 192.168.2.122 --port 25565 --threads 16 --file /tmp/nvme/orestis.dat
ssh ${SERVER_HOST} -- "(cd ${TEBIS_PATH}/build/tcp_server/ && ${TEBIS_PATH}/build/tcp_server/tcp-server --bind 192.168.2.12${SERVER_HOST//[!0-9]/} --port ${SERVER_PORT} --threads 16 --file /tmp/nvme/orestis.dat) &"
#SERVER_PID=$!
#
printf "\033[1;31mserver is running...\033[0m\n"
### Launching Clients ###
YCSB_CLIENT_COMMAND=$TEBIS_PATH"/build/YCSB-CXX/ycsb-tcp -threads 16 -w l -e execution_plan.txt"
YCSB_CLIENT_RESULT_PATH=$TEBIS_PATH"/build/YCSB-CXX/RESULTS/"
CLIENT_PID_ARRAY=()
for client in ${CLIENT_HOSTS}; do
ssh ${client} -- "(${YCSB_CLIENT_COMMAND} -outFile ${host}_ops.txt && scp ${host}:${YCSB_CLIENT_RESULT_PATH}/${host}_ops.txt ./total_results)" &
CLIENT_PID_ARRAY+=($!)
#CLIENT_PID_ARRAY[${CLIENT_PID_ARRAY[@]}]=...
done
for pid in "${CLIENT_PID_ARRAY[@]}"; do
wait $pid
done
### Terminating Server ###
kill ${SERVER_PID}
### Now, all results from clients are stored to total_results/ (load_a, run_a etc)