Merge "Change PTL informatin in INFO"
[bottlenecks.git] / testsuites / rubbos / rubbos_scripts / 1-1-1 / scripts / CONTROL_rubbos_exec.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -x
12
13 cd /bottlenecks/rubbos/rubbos_scripts/1-1-1
14 source set_bottlenecks_rubbos_env.sh
15 export scp_options='-o StrictHostKeyChecking=no -o BatchMode=yes'
16
17 scp $WORK_HOME/monitors_files/oprofile_start.sh $MYSQL1_HOST:/tmp/
18
19 echo "Starting RUBBoS"
20
21 ssh $RUBBOS_RESULTS_HOST "
22   mkdir -p $RUBBOS_RESULTS_DIR_BASE
23 "
24 ssh $BENCHMARK_HOST "
25   mkdir -p $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME
26 "
27
28 # run test rubbos.properties from 200 to 3200
29 for i in {2..32..5}
30 do
31   echo "Start Browsing Only with rubbos.properties_$((100*i)) $(date)"
32
33   ssh $BENCHMARK_HOST "
34     source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
35     rm -f $RUBBOS_HOME/Client/rubbos.properties
36   "
37
38   sed -e "s/REPLACE_HTTPD_HOST/$HTTPD_HOST/g" \
39       -e "s/REPLACE_TOMCAT1_HOST/$TOMCAT1_HOST/g" \
40       -e "s/REPLACE_MYSQL1_HOST/$MYSQL1_HOST/g" \
41       -e "s#REPLACE_CLIENT1_HOST#$CLIENT1_HOST#g" \
42       -e "s#REPLACE_CLIENT2_HOST#$CLIENT2_HOST#g" \
43       -e "s#REPLACE_CLIENT3_HOST#$CLIENT3_HOST#g" \
44       -e "s#REPLACE_CLIENT4_HOST#$CLIENT4_HOST#g" \
45       -e "s/REPLACE_NUMBER_OF_CLIENTS_PER_NODE/$((20*i))/g" \
46       $OUTPUT_HOME/rubbos_conf/rubbos.properties_template \
47       > $OUTPUT_HOME/rubbos_conf/rubbos.properties
48   scp $OUTPUT_HOME/rubbos_conf/rubbos.properties $BENCHMARK_HOST:$RUBBOS_HOME/Client/rubbos.properties
49   rm -rf $OUTPUT_HOME/rubbos_conf/rubbos.properties
50
51   echo "Resetting all data"
52   $OUTPUT_HOME/scripts/reset_all.sh
53
54   # Browsing Only
55   echo "Start Browsing Only with rubbos.properties_$((100*i))"
56   echo "Removing previous logs..."
57   ssh $HTTPD_HOST "rm -f $HTTPD_HOME/logs/*log"
58   ssh $TOMCAT1_HOST "rm -f $CATALINA_HOME/logs/*"
59   ssh $MYSQL1_HOST "rm -f $MYSQL_HOME/run/*.log $RUBBOS_APP/mysql_mon-*"
60
61   $OUTPUT_HOME/scripts/start_all.sh
62   sleep 15
63
64   for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
65               $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
66   do
67     ssh $host "rm -f $RUBBOS_APP/sar-* $RUBBOS_APP/ps-* $RUBBOS_APP/iostat-*"
68   done
69   ssh $MYSQL1_HOST "rm -f /tmp/*.log"
70   ssh $MYSQL1_HOST chmod 777 /tmp/oprofile_start.sh
71   #ssh $MYSQL1_HOST "
72   #  cd /tmp
73   #  ./oprofile_start.sh
74   #" &
75
76   ssh $BENCHMARK_HOST "
77     set -x
78     source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
79
80     cd $RUBBOS_HOME/bench
81     \rm -r 20*
82
83     # Execute benchmark
84     echo "execute benchmark"
85     ./rubbos-servletsBO.sh
86
87     # Collect results
88     echo "The benchmark has finished. Now, collecting results..."
89     cd 20*
90     for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
91                 $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
92     do
93       for f in 'sar-*' 'ps-*' 'iostat-*' 'mysql_mon-*' 'postgres_lock-*'
94       do
95         scp $scp_options \$host:$RUBBOS_APP/\$f ./
96       done
97     done
98     cd ..
99     find -type f
100     find -type f | grep stat_client | xargs grep throughput
101     mv 20* $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME/
102   "
103
104   $OUTPUT_HOME/scripts/stop_all.sh
105   $OUTPUT_HOME/scripts/kill_all.sh
106   sleep 15
107
108   echo "End Browsing Only with rubbos.properties_$((100*i)) $(date)"
109 done
110
111 echo "Processing the results..."
112 ssh $BENCHMARK_HOST "
113   cd $TMP_RESULTS_DIR_BASE
114   #cd $RUBBOS_RESULTS_DIR_NAME
115   #scp $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/calc-sarSummary.prl ../
116   #../calc-sarSummary.prl
117
118   #rm -f 20*/*.bin
119
120   #cd ../
121   tar zcf $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_DIR_NAME
122   scp $scp_options $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/
123 "
124
125 echo "Push the results to DB..."
126 cd $RUBBOS_RESULTS_DIR_BASE
127
128 ls $RUBBOS_RESULTS_DIR_NAME.tgz
129 tar zxf $RUBBOS_RESULTS_DIR_NAME.tgz
130 ls $RUBBOS_RESULTS_DIR_NAME
131
132 echo "Fetch POD env parameters"
133 source /tmp/vm_dev_setup/hosts.conf
134 sed -i -e "s/REPLACE_NODE_NAME/$NODE_NAME/g" \
135        -e "s/REPLACE_INSTALLER_TYPE/$INSTALLER_TYPE/g" \
136        -e "s/REPLACE_VERSION/$BOTTLENECKS_VERSION/g" \
137        -e "s#REPLACE_BOTTLENECKS_DB_TARGET#$BOTTLENECKS_DB_TARGET#g" \
138           $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml
139
140 cat $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml
141
142 python $BOTTLENECKS_TOP/utils/dashboard/process_data.py \
143            $RUBBOS_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME \
144            $BOTTLENECKS_TOP/utils/dashboard/dashboard.yaml
145 cd -
146
147 echo "Finish RUBBoS"
148 touch /tmp/rubbos_finished
149
150 set +x
151