summaryrefslogtreecommitdiffstats
path: root/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh
blob: 41f90c8ec6f68f6bc615ed2b666b512f26924a45 (plain)
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
#!/bin/bash

set -x

cd /bottlenecks/rubbos/rubbos_scripts/1-1-1
source set_bottlenecks_rubbos_env.sh
export scp_options='-o StrictHostKeyChecking=no -o BatchMode=yes'

scp $WORK_HOME/monitors_files/oprofile_start.sh $MYSQL1_HOST:/tmp/

echo "Starting RUBBoS"

ssh $RUBBOS_RESULTS_HOST "
  mkdir -p $RUBBOS_RESULTS_DIR_BASE
"
ssh $BENCHMARK_HOST "
  mkdir -p $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME
"

#TODO use for loop to genrate rubbos.properties file 200 ~ 1700
for i in {2..2}
do

  ssh $BENCHMARK_HOST "
    source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
    rm -f $RUBBOS_HOME/Client/rubbos.properties
  "

  sed -e "s/REPLACE_HTTPD_HOST/$HTTPD_HOST/g" \
      -e "s/REPLACE_TOMCAT1_HOST/$TOMCAT1_HOST/g" \
      -e "s/REPLACE_MYSQL1_HOST/$MYSQL1_HOST/g" \
      -e "s#REPLACE_CLIENT1_HOST#$CLIENT1_HOST#g" \
      -e "s#REPLACE_CLIENT2_HOST#$CLIENT2_HOST#g" \
      -e "s#REPLACE_CLIENT3_HOST#$CLIENT3_HOST#g" \
      -e "s#REPLACE_CLIENT4_HOST#$CLIENT4_HOST#g" \
      -e "s/REPLACE_NUMBER_OF_CLIENTS_PER_NODE/$((20*i))/g" \
      $OUTPUT_HOME/rubbos_conf/rubbos.properties_template \
      > $OUTPUT_HOME/rubbos_conf/rubbos.properties
  scp $OUTPUT_HOME/rubbos_conf/rubbos.properties $BENCHMARK_HOST:$RUBBOS_HOME/Client/rubbos.properties
  rm -rf $OUTPUT_HOME/rubbos_conf/rubbos.properties

  #echo "Resetting all data"
  #$OUTPUT_HOME/scripts/reset_all.sh

  # Browsing Only
  echo "Start Browsing Only with rubbos.properties_$((100*i))"
  echo "Removing previous logs..."
  ssh $HTTPD_HOST "rm -f $HTTPD_HOME/logs/*log"
  ssh $TOMCAT1_HOST "rm -f $CATALINA_HOME/logs/*"
  ssh $MYSQL1_HOST "rm -f $MYSQL_HOME/run/*.log $RUBBOS_APP/mysql_mon-*"

  $OUTPUT_HOME/scripts/start_all.sh
  sleep 15

  for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
              $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
  do
    ssh $host "rm -f $RUBBOS_APP/sar-* $RUBBOS_APP/ps-* $RUBBOS_APP/iostat-*"
  done
  ssh $MYSQL1_HOST "rm -f /tmp/*.log"
  ssh $MYSQL1_HOST chmod 777 /tmp/oprofile_start.sh
  #ssh $MYSQL1_HOST "
  #  cd /tmp
  #  ./oprofile_start.sh
  #" &

  ssh $BENCHMARK_HOST "
    source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh

    cd $RUBBOS_HOME/bench
    \rm -r 20*

    # Execute benchmark
    echo "execute benchmark"
    ./rubbos-servletsBO.sh

    # Collect results
    echo "The benchmark has finished. Now, collecting results..."
    cd 20*
    for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
                $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
    do
      for f in sar-* ps-* iostat-* mysql_mon-* postgres_lock-*
      do
        scp $scp_options \$host:$RUBBOS_APP/\$f ./
      done
    done
    cd ..
    mv 20* $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME/
  "

  # TODO debug the rest of sciripts
  exit 0
  #$OUTPUT_HOME/scripts/stop_all.sh
  $OUTPUT_HOME/scripts/kill_all.sh
  sleep 15
  echo "End Browsing Only with rubbos.properties_$((100*i))"

  # Read/Write

done

echo "Processing the results..."
ssh $BENCHMARK_HOST "
  cd $TMP_RESULTS_DIR_BASE
  cd $RUBBOS_RESULTS_DIR_NAME
  scp $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/calc-sarSummary.prl ../
  ../calc-sarSummary.prl

  rm -f 20*/*.bin

  cd ../
  tar zcvf $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_DIR_NAME
  scp $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/
"

echo "Finish RUBBoS"

set +x