-
Notifications
You must be signed in to change notification settings - Fork 5
/
run_throughput.sh
executable file
·85 lines (60 loc) · 2.13 KB
/
run_throughput.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
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
if [[ $# -le 4 || $# -ge 7 ]]; then
echo "Usage: $0 <num-executors> <executor-cores> <executor-memory> <db_name> <timeout> -o|-n|-no"
exit
fi
${WORKDIR?"Need to set WORKDIR env"} 2>/dev/null
RUNCONF=${WORKDIR}/tpcds-setup/conf/run.config
if [ ! -f ${RUNCONF} ]; then
echo "File : ${RUNCONF} not found!"
fi
. ${RUNCONF}
num_executors=$1
executor_cores=$2
executor_memory=$3
databaseName=$4
timeout=$5
enableOperf=$6
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HOST=`hostname`
USER=`whoami`
PASSWD="passw0rd"
PREFIX=throughput_${ARCH}_${num_executors}e_${executor_cores}c_${executor_memory}
SEQ=0
CNT=`ls -lrt ${LOG_DIR}/${PREFIX}_nmon_logs 2>/dev/null | wc | awk '{print \$1}'`
SEQ=$CNT
CUR_NMON_DIR=${LOG_DIR}/${PREFIX}_${SEQ}_nmon_logs
cat ${HADOOP_HOME}/etc/hadoop/slaves | grep -v ^# | xargs -i ssh {} "sync && echo 3 | sudo tee /proc/sys/vm/drop_caches"
if [[ ! -f ${JMETER_BIN} ]]; then
echo "Jmeter binary is not found"
exit 22
fi
if [[ $enableOperf == *"n"* ]]; then
echo "Starting nmon and logs will be placed under ${CUR_NMON_DIR}"
startnmon.sh $CUR_NMON_DIR
fi
if [[ $enableOperf == *"o"* ]]; then
type operf >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "operf is not installed. Exiting."
exit 255
fi
export OPERFLIB=${WORKDIR}/oprofile/oprofile_install/lib
if [ ! -d ${OPERFLIB} ]; then
echo "OPERFLIB is not set properly"
echo "check OPERFLIB value in this script and continue."
exit 255
fi
oprofile_start.sh
fi
JMX=${WORKDIR}/tpcds-setup/conf/baidu-tpcds-yarn-throughput-allcores.jmx
JMX_IN_USE=${WORKDIR}/tpcds-setup/conf/baidu-tpcds-yarn-throughput-allcores.jmx.$$
sed "s~SRCPATH~${DIR}~g; s~HOST~${HOST}~g; s~USER~${USER}~g; s~PASSWD~${PASSWD}~g; s~DBNAME~${databaseName}~g; s~TIMEOUT~${timeout}~g; s~EXEC~${num_executors}~g; s~CORES~${executor_cores}~g; s~MEMORY~${executor_memory}~g; s~EXTRA~${enableOperf}~g; " $JMX > $JMX_IN_USE
/usr/bin/time ${JMETER_BIN} -n -t ${JMX_IN_USE} -l ${LOG_DIR}/run1.jtl -j ${LOG_DIR}/run1.log
rm $JMX_IN_USE
if [[ $enableOperf == *"n"* ]]; then
stopnmon.sh $CUR_NMON_DIR
fi
if [[ $enableOperf == *"o"* ]]; then
oprofile_stop.sh
fi