forked from ibm-messaging/cphtestp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cphTest.sh
executable file
·204 lines (170 loc) · 7.57 KB
/
cphTest.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
#Functions
function runclients {
threads=$1
msgsize=$2
echo "threads=$threads" >> /home/mqperf/cph/results
echo "Starting test with $threads requesters" >> /home/mqperf/cph/output
rate=$(./cphreq.sh $threads $msgsize | tee -a /home/mqperf/cph/output | grep avgRate | awk -F ',' '{ print $3 }')
rate=$(echo $rate | awk -F '=' '{print $2}')
echo "avgRate=$rate" >> /home/mqperf/cph/results
cpu=$(awk '{print $12}' /tmp/mpstat | tail -6 | awk '{total+=$1} END{printf "%0.2f",(NR?100-(total/NR):-1)}')
echo "CPU=$cpu" >> /home/mqperf/cph/results
readMB=$(awk -F ',' '{print $6}' /tmp/dstat | tail -n +8 | tail -6 | awk '{total+=$1} END{printf "%0.2f",(NR?((total/NR)/(1024*1024)):-1)}')
echo "Read=$readMB" >> /home/mqperf/cph/results
writeMB=$(awk -F ',' '{print $7}' /tmp/dstat | tail -n +8 | tail -6 | awk '{total+=$1} END{printf "%0.2f",(NR?((total/NR)/(1024*1024)):-1)}')
echo "Write=$writeMB" >> /home/mqperf/cph/results
recvGbs=$(awk -F ',' '{print $8}' /tmp/dstat | tail -n +8 | tail -6 | awk '{total+=$1} END{printf "%0.2f",(NR?((total/NR)/(1024*1024*1024*0.125)):-1)}')
echo "Recv=$recvGbs" >> /home/mqperf/cph/results
sendGbs=$(awk -F ',' '{print $9}' /tmp/dstat | tail -n +8 | tail -6 | awk '{total+=$1} END{printf "%0.2f",(NR?((total/NR)/(1024*1024*1024*0.125)):-1)}')
echo "Send=$sendGbs" >> /home/mqperf/cph/results
qmcpu=$(tail -6 /tmp/systemerr | awk -F '=' '{print $2}' | awk '{total+=$1} END{printf "%0.2f",(NR?(total/NR):-1)}')
echo "QM_CPU=$qmcpu" >> /home/mqperf/cph/results
echo "" >> /home/mqperf/cph/results
if [ -n "${MQ_RESULTS_CSV}" ]; then
msgsize=${msgsize:-2048}
echo "$persistent,$msgsize,$threads,$rate,$cpu,$readMB,$writeMB,$recvGbs,$sendGbs,$qmcpu" >> /home/mqperf/cph/results.csv
fi
}
function getConcurrentClientsArray {
maximumClients=$1
maximumClients=`expr ${maximumClients} - 2`
for (( i=1; i<=$maximumClients; i=$i*2 ))
do
clientsArray+=($i)
done
clientsArray+=($maximumClients)
}
function setupTLS {
#Assuming that key.kdb is already present in the default location /opt/mqm/ssl/key.kdb
#Assuming currently that kdb is CMS - Not tested yet with PKCS12
#Override mqclient.ini with SSL Key repository location and reuse count
cp /opt/mqm/ssl/mqclient.ini /var/mqm/mqclient.ini
#Create local CCDT; alternatives are to copy it from Server or host it at http location
echo "DEFINE CHANNEL('$channel') CHLTYPE(CLNTCONN) CONNAME('$host($port)') SSLCIPH(${MQ_TLS_CIPHER}) QMNAME($qmname) REPLACE" | /opt/mqm/bin/runmqsc -n
}
echo "----------------------------------------"
echo "Initialising test environment-----------"
echo "----------------------------------------"
qmname="${MQ_QMGR_NAME:-PERF0}"
host="${MQ_QMGR_HOSTNAME:-localhost}"
port="${MQ_QMGR_PORT:-1420}"
channel="${MQ_QMGR_CHANNEL:-SYSTEM.DEF.SVRCONN}"
msgsize=${msgsize:-2048}
nonpersistent="${MQ_NON_PERSISTENT:-0}"
responders=${MQ_RESPONDER_THREADS:-200}"
if [ "${nonpersistent}" = "1" ]; then
persistent=0
else
persistent=1
fi
#Write results header
echo $(date)
echo $(date) > /home/mqperf/cph/results
if [ "${nonpersistent}" -eq 1 ]; then
echo "Running Non Persistent Messaging Tests"
echo "Running Non Persistent Messaging Tests" >> /home/mqperf/cph/results
else
echo "Running Persistent Messaging Tests"
echo "Running Persistent Messaging Tests" >> /home/mqperf/cph/results
fi
echo "----------------------------------------"
echo "Testing QM: $qmname on host: $host using port: $port and channel: $channel"
echo "Testing QM: $qmname on host: $host using port: $port and channel: $channel" >> /home/mqperf/cph/results
if [ -n "${MQ_CPH_EXTRA}" ]; then
echo "Extra CPH flags: ${MQ_CPH_EXTRA}"
echo "Extra CPH flags: ${MQ_CPH_EXTRA}" >> /home/mqperf/cph/results
fi
if [ -n "${MQ_TLS_CIPHER}" ]; then
echo "TLS Cipher: ${MQ_TLS_CIPHER}"
echo "TLS Cipher: ${MQ_TLS_CIPHER}" >> /home/mqperf/cph/results
# Need to complete TLS setup before we try to attach monitors
setupTLS
fi
#Clear queues
if [ -n "${MQ_TLS_CIPHER}" ]; then
#Dont configure MQSERVER envvar for TLS scenarios, will use CCDT
#We do need to specify the Key repository location as runmqsc doesnt use mqclient.ini
export MQSSLKEYR=/opt/mqm/ssl/key
else
#Configure MQSERVER envvar
export MQSERVER="$channel/TCP/$host($port)";
fi
if [ -n "${MQ_USERID}" ]; then
# Need to flow userid and password to runmqsc
echo "Using userid: ${MQ_USERID}"
echo "Using userid: ${MQ_USERID}" >> /home/mqperf/cph/results
echo ${MQ_PASSWORD} > /tmp/clearq.mqsc;
cat /home/mqperf/cph/clearq.mqsc >> /tmp/clearq.mqsc;
cat /tmp/clearq.mqsc | /opt/mqm/bin/runmqsc -c -u ${MQ_USERID} -w 60 $qmname > /home/mqperf/cph/output;
rm -f /tmp/clearq.mqsc;
else
cat /home/mqperf/cph/clearq.mqsc | /opt/mqm/bin/runmqsc -c $qmname > /home/mqperf/cph/output 2>&1;
fi
#Launch monitoring processes
mpstat 10 > /tmp/mpstat &
dstat --output /tmp/dstat 10 > /dev/null 2>&1 &
if [ -n "${MQ_USERID}" ]; then
./qmmonitor2 -m $qmname -p $port -s $channel -h $host -c CPU -t SystemSummary -u ${MQ_USERID} -v ${MQ_PASSWORD} -l ${MQ_TLS_CIPHER} >/tmp/system 2>/tmp/systemerr &
./qmmonitor2 -m $qmname -p $port -s $channel -h $host -c DISK -t Log -u ${MQ_USERID} -v ${MQ_PASSWORD} -l ${MQ_TLS_CIPHER} >/tmp/disklog 2>/tmp/disklogerr &
else
./qmmonitor2 -m $qmname -p $port -s $channel -h $host -c CPU -t SystemSummary -l ${MQ_TLS_CIPHER} >/tmp/system 2>/tmp/systemerr &
./qmmonitor2 -m $qmname -p $port -s $channel -h $host -c DISK -t Log -l ${MQ_TLS_CIPHER} >/tmp/disklog 2>/tmp/disklogerr &
fi
#Write CSV header if required
if [ -n "${MQ_RESULTS_CSV}" ]; then
msgsize=${msgsize:-2048}
echo "# CSV Results" > /home/mqperf/cph/results.csv
printf "# " >> /home/mqperf/cph/results.csv
echo $(date) >> /home/mqperf/cph/results.csv
echo "# Persistence, Msg Size, Threads, Rate (RT/s), Client CPU, IO Read (MB/s), IO Write (MB/s), Net Recv (Gb/s), Net Send (Gb/s), QM CPU" >> /home/mqperf/cph/results.csv
fi
echo "----------------------------------------"
echo "Starting cph tests----------------------"
echo "----------------------------------------"
./cphresp.sh ${responders} >> /home/mqperf/cph/output & disown
#Wait for responders to start
sleep 30
#Determine sequence of requester clients to use based of number of responder clients
getConcurrentClientsArray ${responders}
echo "Using the following progression of concurrent connections: ${clientsArray[@]}"
echo "Using the following progression of concurrent connections: ${clientsArray[@]}" >> /home/mqperf/cph/results
echo "CPH Test Results" >> /home/mqperf/cph/results
echo $(date) >> /home/mqperf/cph/results
echo "2K" >> /home/mqperf/cph/results
for concurrentConnections in ${clientsArray[@]}
do
runclients $concurrentConnections 2048
done
echo "----" >> /home/mqperf/cph/results
echo $(date) >> /home/mqperf/cph/results
echo "20K" >> /home/mqperf/cph/results
for concurrentConnections in ${clientsArray[@]}
do
runclients $concurrentConnections 20480
done
echo "----" >> /home/mqperf/cph/results
echo $(date) >> /home/mqperf/cph/results
echo "200K" >> /home/mqperf/cph/results
for concurrentConnections in ${clientsArray[@]}
do
runclients $concurrentConnections 204800
done
echo "" >> /home/mqperf/cph/results
if ! [ "${MQ_RESULTS}" = "FALSE" ]; then
cat /home/mqperf/cph/results
fi
if [ -n "${MQ_RESULTS_CSV}" ]; then
cat /home/mqperf/cph/results.csv
fi
if [ -n "${MQ_DATA}" ]; then
cat /tmp/system
cat /tmp/disklog
cat /home/mqperf/cph/output
fi
if [ -n "${MQ_ERRORS}" ]; then
cat /var/mqm/errors/AMQERR01.LOG
fi
echo "----------------------------------------"
echo "cph testing finished--------------------"
echo "----------------------------------------"