perftest-daily.sh 8.1 KB
Newer Older
S
Shuduo Sang 已提交
1 2
#!/bin/bash

S
Shuduo Sang 已提交
3 4
WORK_DIR=/mnt/root

S
Shuduo Sang 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# Coloured Echoes                                                                                                       #
function red_echo      { echo -e "\033[31m$@\033[0m";   }                                                               #
function green_echo    { echo -e "\033[32m$@\033[0m";   }                                                               #
function yellow_echo   { echo -e "\033[33m$@\033[0m";   }                                                               #
function white_echo    { echo -e "\033[1;37m$@\033[0m"; }                                                               #
# Coloured Printfs                                                                                                      #
function red_printf    { printf "\033[31m$@\033[0m";    }                                                               #
function green_printf  { printf "\033[32m$@\033[0m";    }                                                               #
function yellow_printf { printf "\033[33m$@\033[0m";    }                                                               #
function white_printf  { printf "\033[1;37m$@\033[0m";  }                                                               #
# Debugging Outputs                                                                                                     #
function white_brackets { local args="$@"; white_printf "["; printf "${args}"; white_printf "]"; }                      #
function echoInfo   { local args="$@"; white_brackets $(green_printf "INFO") && echo " ${args}"; }                      #
function echoWarn   { local args="$@";  echo "$(white_brackets "$(yellow_printf "WARN")" && echo " ${args}";)" 1>&2; }  #
function echoError  { local args="$@"; echo "$(white_brackets "$(red_printf    "ERROR")" && echo " ${args}";)" 1>&2; }  #

S
Shuduo Sang 已提交
21 22 23 24 25 26 27 28 29 30 31
function setMaxTablesPerVnode {
	echo "/etc/taos/taos.cfg maxTablesPerVnode will be set to $1"

	hasText=`grep "maxTablesPerVnode" /etc/taos/taos.cfg`
	if [[ -z "$hasText" ]]; then
		echo "maxTablesPerVnode $1" >> /etc/taos/taos.cfg
	else
		sed -i 's/^maxTablesPerVnode.*$/maxTablesPerVnode '"$1"'/g' /etc/taos/taos.cfg
	fi
}

S
Shuduo Sang 已提交
32 33 34 35 36 37 38 39 40 41 42
function setMaxConnections {
	echo "/etc/taos/taos.cfg maxConnection will be set to $1"

	hasText=`grep "maxConnections" /etc/taos/taos.cfg`
	if [[ -z "$hasText" ]]; then
		echo "maxConnections $1" >> /etc/taos/taos.cfg
	else
		sed -i 's/^maxConnections.*$/maxConnections '"$1"'/g' /etc/taos/taos.cfg
	fi
}

S
Shuduo Sang 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
function setQDebugFlag {
	echo "/etc/taos/taos.cfg qDebugFlag will be set to $1"

	hasText=`grep -w "qDebugFlag" /etc/taos/taos.cfg`
	if [[ -z "$hasText" ]]; then
		echo "qDebugFlag $1" >> /etc/taos/taos.cfg
	else
		sed -i 's/^qDebugFlag.*$/qDebugFlag '"$1"'/g' /etc/taos/taos.cfg
	fi
}

function setDebugFlag {
	echo "/etc/taos/taos.cfg DebugFlag will be set to $1"

	hasText=`grep -w "DebugFlag" /etc/taos/taos.cfg`
	if [[ -z "$hasText" ]]; then
		echo "DebugFlag $1" >> /etc/taos/taos.cfg
	else
		sed -i 's/^DebugFlag.*$/DebugFlag '"$1"'/g' /etc/taos/taos.cfg
	fi
}

S
Shuduo Sang 已提交
65
function setWal {
S
Shuduo Sang 已提交
66
	echo "/etc/taos/taos.cfg walLevel will be set to $1"
S
Shuduo Sang 已提交
67 68 69 70 71 72 73

	hasText=`grep "walLevel" /etc/taos/taos.cfg`
	if [[ -z "$hasText" ]]; then
		echo "walLevel $1" >> /etc/taos/taos.cfg
	else
		sed -i 's/^walLevel.*$/walLevel '"$1"'/g' /etc/taos/taos.cfg
	fi
S
Shuduo Sang 已提交
74 75 76 77 78 79 80 81 82 83 84
}

function collectSysInfo {
	rm sysinfo.log
	grep model /proc/cpuinfo | tail -n1 | tee sysinfo.log
	grep cores /proc/cpuinfo | tail -n1 | tee -a sysinfo.log
	grep MemTotal /proc/meminfo | tee -a sysinfo.log
	grep "^[^#;]" /etc/taos/taos.cfg | tee taos.cfg
}

function buildTDengine {
S
Shuduo Sang 已提交
85 86
	echoInfo "Build TDengine"
	cd $WORK_DIR/TDengine
87

S
Shuduo Sang 已提交
88
	git remote update > /dev/null
89 90 91 92 93 94 95 96 97
	REMOTE_COMMIT=`git rev-parse --short remotes/origin/develop`
	LOCAL_COMMIT=`git rev-parse --short @`

	echo " LOCAL: $LOCAL_COMMIT"
	echo "REMOTE: $REMOTE_COMMIT"
	if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
		echo "repo up-to-date"
	else
		echo "repo need to pull"
S
Shuduo Sang 已提交
98
		git pull > /dev/null
99

S
Shuduo Sang 已提交
100
		LOCAL_COMMIT=`git rev-parse --short @`
101 102
		cd debug
		rm -rf *
S
Shuduo Sang 已提交
103
		cmake .. > /dev/null
104 105 106
		make > /dev/null
		make install
	fi
S
Shuduo Sang 已提交
107 108 109 110 111 112
}

function sendReport {
	receiver="sdsang@taosdata.com, sangshuduo@gmail.com"
	mimebody="MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n"

113
	echo -e "to: ${receiver}\nsubject: Perf test report ${today}, commit ID: ${LOCAL_COMMIT}\n" | \
S
Shuduo Sang 已提交
114 115 116 117 118 119
		(cat - && uuencode perftest-1d-wal1-$today.log perftest-1d-wal1-$today.log)| \
		(cat - && uuencode perftest-1d-wal1-report.csv perftest-1d-wal1-report-$today.csv) | \
		(cat - && uuencode perftest-1d-wal1-report.png perftest-1d-wal1-report-$today.png) | \
		(cat - && uuencode perftest-13d-wal1-$today.log perftest-13d-wal1-$today.log)| \
		(cat - && uuencode perftest-13d-wal1-report.csv perftest-13d-wal1-report-$today.csv) | \
		(cat - && uuencode perftest-13d-wal1-report.png perftest-13d-wal1-report-$today.png) | \
S
Shuduo Sang 已提交
120 121 122
		(cat - && uuencode perftest-var10k-int10s-wal1-$today.log perftest-var10k-int10s-wal1-$today.log)| \
		(cat - && uuencode perftest-var10k-int10s-wal1-report.csv perftest-var10k-int10s-wal1-report-$today.csv) | \
		(cat - && uuencode perftest-var10k-int10s-wal1-report.png perftest-var10k-int10s-wal1-report-$today.png) | \
S
Shuduo Sang 已提交
123 124 125
		(cat - && uuencode taosdemo-wal1-$today.log taosdemo-wal1-$today.log) | \
		(cat - && uuencode taosdemo-wal1-report.csv taosdemo-wal1-report-$today.csv) | \
		(cat - && uuencode taosdemo-wal1-report.png taosdemo-wal1-report-$today.png) | \
S
Shuduo Sang 已提交
126 127
		(cat - && uuencode taosdemo-rps-wal1-report.csv taosdemo-rps-wal1-report-$today.csv) | \
		(cat - && uuencode taosdemo-rps-wal1-report.png taosdemo-rps-wal1-report-$today.png) | \
S
Shuduo Sang 已提交
128 129 130 131 132 133
		(cat - && uuencode perftest-1d-wal2-$today.log perftest-1d-wal2-$today.log)| \
		(cat - && uuencode perftest-1d-wal2-report.csv perftest-1d-wal2-report-$today.csv) | \
		(cat - && uuencode perftest-1d-wal2-report.png perftest-1d-wal2-report-$today.png) | \
		(cat - && uuencode perftest-13d-wal2-$today.log perftest-13d-wal2-$today.log)| \
		(cat - && uuencode perftest-13d-wal2-report.csv perftest-13d-wal2-report-$today.csv) | \
		(cat - && uuencode perftest-13d-wal2-report.png perftest-13d-wal2-report-$today.png) | \
S
Shuduo Sang 已提交
134 135 136
		(cat - && uuencode perftest-var10k-int10s-wal2-$today.log perftest-var10k-int10s-wal2-$today.log)| \
		(cat - && uuencode perftest-var10k-int10s-wal2-report.csv perftest-var10k-int10s-wal2-report-$today.csv) | \
		(cat - && uuencode perftest-var10k-int10s-wal2-report.png perftest-var10k-int10s-wal2-report-$today.png) | \
S
Shuduo Sang 已提交
137 138
		(cat - && uuencode taosdemo-wal2-$today.log taosdemo-wal2-$today.log) | \
		(cat - && uuencode taosdemo-wal2-report.csv taosdemo-wal2-report-$today.csv) | \
S
Shuduo Sang 已提交
139
		(cat - && uuencode taosdemo-wal2-report.png taosdemo-wal2-report-$today.png) | \
S
Shuduo Sang 已提交
140
		(cat - && uuencode taosdemo-rps-wal2-report.csv taosdemo-rps-wal2-report-$today.csv) | \
S
Shuduo Sang 已提交
141
		(cat - && uuencode taosdemo-rps-wal2-report.png taosdemo-rps-wal2-report-$today.png) | \
S
Shuduo Sang 已提交
142 143 144 145 146 147
		(cat - && uuencode sysinfo.log sysinfo.txt) | \
		(cat - && uuencode taos.cfg taos-cfg-$today.txt) | \
		ssmtp "${receiver}"
}

today=`date +"%Y%m%d"`
S
Shuduo Sang 已提交
148 149
cd $WORK_DIR
echo -e "cron-ran-at-${today}" >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
150 151 152

buildTDengine

S
Shuduo Sang 已提交
153
############################
S
Shuduo Sang 已提交
154 155 156 157
setMaxConnections 1000
setMaxTablesPerVnode 6000
setDebugFlag 131
setQDebugFlag 131
S
Shuduo Sang 已提交
158 159 160 161

############################
setWal "2"

S
Shuduo Sang 已提交
162 163 164 165
cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-taosdemo.sh "wal2"
date >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
166

S
Shuduo Sang 已提交
167 168 169 170
cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-1d.sh
date >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
171

S
Shuduo Sang 已提交
172 173 174 175 176 177 178 179 180
cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-13d.sh
date >> $WORK_DIR/cron.log

cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-var10k-int10s.sh
date >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
181 182 183

#############################
setWal "1"
S
Shuduo Sang 已提交
184

S
Shuduo Sang 已提交
185 186
cd $WORK_DIR
date >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
187
./perftest-taosdemo.sh "wal1"
S
Shuduo Sang 已提交
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
date >> $WORK_DIR/cron.log

cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-1d.sh
date >> $WORK_DIR/cron.log

cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-13d.sh
date >> $WORK_DIR/cron.log

cd $WORK_DIR
date >> $WORK_DIR/cron.log
./perftest-tsdb-compare-var10k-int10s.sh
date >> $WORK_DIR/cron.log
S
Shuduo Sang 已提交
204

S
Shuduo Sang 已提交
205
#############################
S
Shuduo Sang 已提交
206 207 208 209 210
collectSysInfo

echoInfo "Send Report"
sendReport
echoInfo "End of Test"