summaryrefslogtreecommitdiffstats
path: root/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh
blob: 77da6459dcd5a3fd4209398a8b48c7ededd95e2a (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
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
#!/bin/bash
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

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
"

# run test rubbos.properties from 200 to 3200
for i in {2..32..5}
do
  echo "Start Browsing Only with rubbos.properties_$((100*i)) $(date)"

  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 "
    set -x
    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 ..
    find -type f
    find -type f | grep stat_client | xargs grep throughput
    mv 20* $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME/
  "

  $OUTPUT_HOME/scripts/stop_all.sh
  $OUTPUT_HOME/scripts/kill_all.sh
  sleep 15

  echo "End Browsing Only with rubbos.properties_$((100*i)) $(date)"
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 zcf $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_DIR_NAME
  scp $scp_options $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/
"

echo "Push the results to DB..."
cd $RUBBOS_RESULTS_DIR_BASE

ls $RUBBOS_RESULTS_DIR_NAME.tgz
tar zxf $RUBBOS_RESULTS_DIR_NAME.tgz
ls $RUBBOS_RESULTS_DIR_NAME

echo "Fetch POD env parameters"
source /tmp/vm_dev_setup/hosts.conf
sed -i -e "s/REPLACE_NODE_NAME/$NODE_NAME/g" \
       -e "s/REPLACE_INSTALLER_TYPE/$INSTALLER_TYPE/g" \
       -e "s/REPLACE_VERSION/$BOTTLENECKS_VERSION/g" \
       -e "s#REPLACE_BOTTLENECKS_DB_TARGET#$BOTTLENECKS_DB_TARGET#g" \
          $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml

cat $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml

python $BOTTLENECKS_TOP/utils/dashboard/process_data.py \
           $RUBBOS_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME \
           $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml
cd -

echo "Finish RUBBoS"
touch /tmp/rubbos_finished

set +x