-
Notifications
You must be signed in to change notification settings - Fork 73
/
limited_webreport
255 lines (219 loc) · 11.1 KB
/
limited_webreport
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#!/bin/bash
#
# limited_webreport.sh connects to the Results database and generates a web page
# as limited_index.htm that includes links to the results in the database like so :
# ./limited_webreport 1,6,7
# TODO gnuplot badly handles default font selection on many platforms.
# Despite specifying "medium" as the font, it still looks for Arial
# which often is only there if you've installed Microsoft Core Fonts.
# That results in this (harmless) warning constantly appearing:
# Could not find/open font when opening font "arial", using internal non-scalable font
# On RHEL6 it's possible to switch to fonts other than Arial like this:
# export GDFONTPATH=/usr/share/fonts/liberation
# export GNUPLOT_DEFAULT_GDFONT="LiberationMono-Regular"
# It's not clear if it's worth detecting that font is available and
# switching to it though. Tests so far suggest it's slightly worse
# than the internal font, and LiberationSans looks terrible.
source ./config
INSETS=$1
OUTFILE="results/limited_index.htm"
RESULTPSQL="psql -h $RESULTHOST -U $RESULTUSER -p $RESULTPORT -d $RESULTDB"
# Emulate 'sed -i' behavior from GNU sed with standard sed instead.
# Needed on platforms like Solaris.
function sed-i {
replace=$1
filename=$2
sed "$replace" ${filename} > ${filename}.new
mv ${filename}.new ${filename}
}
if [ -z $GNUPLOT ] || [ ! -x $GNUPLOT ]; then
echo "gnuplot not found, skipping webreport charts generation"
else
# Produce combined report, averaged across all test sets
$RESULTPSQL -At -F" " -c "select scale,round(avg(dbsize) / (1024 * 1024)) as dbsize,round(avg(tps)) as tps from tests group by scale order by scale" > scaling.txt
gnuplot plots/scaling.plot 2>&1 | grep -v "Warning: empty"
mv scaling.png results/
rm scaling.txt
$RESULTPSQL -At -F" " -c "select clients,round(avg(tps)) as tps from tests group by clients order by clients" > clients.txt
gnuplot plots/clients.plot 2>&1 | grep -v "Warning: empty"
mv clients.png results/
rm clients.txt
$RESULTPSQL -At -F" " -c "select scale,clients,round(avg(tps)) as tps from tests group by scale,clients order by scale,clients" > 3d.txt
gnuplot plots/3d.plot 2>&1 | grep -v "Warning: empty"
mv 3d.png results/
rm 3d.txt
fi
# Copy the header HTML template to our outfile
if [ "$TABBED" -eq "1" ]; then
cp templates/header-tabbed.html $OUTFILE
else
cp templates/header.html $OUTFILE
fi
echo "<body style="font-family:'Arial'">" >>$OUTFILE
echo "<body style="font-size:'8px'">" >>$OUTFILE
echo "<h3>Averages across all test sets:</h3>" >> $OUTFILE
echo "<img src=\"scaling.png\"><p>" >> $OUTFILE
echo "<img src=\"clients.png\"><p>" >> $OUTFILE
echo "<img src=\"3d.png\"><p>" >> $OUTFILE
echo "<h3>Test sets comparison:</h3>" >> $OUTFILE
echo "<img src=\"scaling-sets.png\"><p>" >> $OUTFILE
echo "<img src=\"clients-sets.png\"><p>" >> $OUTFILE
echo "<img src=\"scaling-latency-sets.png\"><p>" >> $OUTFILE
echo "<img src=\"clients-latency-sets.png\"><p>" >> $OUTFILE
# Loop over all the active test sets
SETS=`$RESULTPSQL -A -t -c "select set from tests where set IN ($INSETS) group by set order by set"`
# Build table of contents
echo '<ul>' >> $OUTFILE
for SET in $SETS ; do
DESCR=`$RESULTPSQL -A -t -c "select info from testset where set='$SET'"`
echo "<li><a href='#set-$SET'>Test Set $SET - $DESCR</a></li>" >> $OUTFILE
done
echo '</ul>' >> $OUTFILE
for SET in $SETS ; do
DESCR=`$RESULTPSQL -A -t -c "select info from testset where set='$SET'"`
echo "<div id='set-$SET'>" >> $OUTFILE
echo "<hr><h3>Set" $SET : $DESCR"</h3>" >> $OUTFILE
# We'll need to know the last set plot for the multi-plot below
LASTSET="$SET"
if [ ! -z $GNUPLOT ] && [ -x $GNUPLOT ]; then
# Generate graphs for just this test set
$RESULTPSQL -At -F" " -c "select scale,round(avg(dbsize) / (1024 * 1024)) as dbsize,round(avg(tps)) as tps from tests where set='$SET' group by scale order by scale" > scaling.txt
gnuplot plots/scaling.plot 2>&1 | grep -v "Warning: empty"
mv scaling.png results/scaling-$SET.png
mv scaling.txt scaling-$SET.txt
$RESULTPSQL -At -F" " -c "select clients,round(avg(tps)) as tps from tests where set='$SET' group by clients order by clients" > clients.txt
gnuplot plots/clients.plot 2>&1 | grep -v "Warning: empty"
mv clients.png results/clients-$SET.png
mv clients.txt clients-$SET.txt
$RESULTPSQL -At -F" " -c "select scale,round(avg(dbsize) / (1024 * 1024)) as dbsize,round(1000*avg(percentile_90_latency))/1000 as \"90%<\" from tests where set='$SET' group by scale order by scale" > scaling-latency.txt
gnuplot plots/scaling-latency.plot 2>&1 | grep -v "Warning: empty"
mv scaling-latency.png results/scaling-latency-$SET.png
mv scaling-latency.txt scaling-latency-$SET.txt
$RESULTPSQL -At -F" " -c "select clients,round(1000*avg(percentile_90_latency))/1000 as \"90%<\" from tests where set='$SET' group by clients order by clients" > clients-latency.txt
gnuplot plots/clients-latency.plot 2>&1 | grep -v "Warning: empty"
mv clients-latency.png results/clients-latency-$SET.png
mv clients-latency.txt clients-latency-$SET.txt
## a supprimer
$RESULTPSQL -At -F" " -c "select scale,clients,round(avg(tps)) as tps from tests where set='$SET' group by scale,clients order by scale,clients" > 3d.txt
gnuplot plots/3d.plot 2>&1 | grep -v "Warning: empty"
mv 3d.png results/3d-$SET.png
rm 3d.txt
fi
echo "<img src=\"scaling-$SET.png\"><p>" >> $OUTFILE
echo "<img src=\"clients-$SET.png\"><p>" >> $OUTFILE
echo "<img src=\"scaling-latency-$SET.png\"><p>" >> $OUTFILE
# The 3D results set isn't that useful, don't want to repeat it for
# every single set, too
# echo "<img src=\"3d-$SET.png\"><p>" >> $OUTFILE
# Summarize the test set
echo Averages for test set $SET by scale: >> $OUTFILE
$RESULTPSQL -H -c "select set,scale,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,scale order by set,scale;" >> $OUTFILE
echo Averages for test set $SET by clients: >> $OUTFILE
$RESULTPSQL -H -c "select set,clients,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,clients order by set,clients;" >> $OUTFILE
echo Averages for test set $SET by scale, client, and rate limit: >> $OUTFILE
$RESULTPSQL -H -c "select set,scale,clients,rate_limit,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,scale,clients,rate_limit order by set,scale,clients,rate_limit;" >> $OUTFILE
echo Detail for test set $SET: >> $OUTFILE
# Create a line showing the results for every test as an HTML table
$RESULTPSQL -H -c "select set,'<a href=\"' || tests.test || '/index.html\">' || tests.test || '</a>' as test,scale,clients,rate_limit,round(tps) as tps,max_latency, checkpoints_timed+checkpoints_req as chkpts,buffers_checkpoint as buf_check,buffers_clean as buf_clean,buffers_backend as buf_backend,buffers_alloc as buf_alloc, maxwritten_clean as max_clean, buffers_backend_fsync as backend_sync, max_dirty, wal_written,cleanup from test_bgwriter right join tests on tests.test=test_bgwriter.test where tests.set='$SET' order by set,scale,clients,rate_limit,tests.test;" > temp.txt
# Now we need to fix lines like this
# <td align="left"><a href="results/201/">201</a></td>
# where PSQL has quoted things we wanted literally
sed-i "s/</</g" temp.txt
sed-i "s/>/>/g" temp.txt
sed-i "s/"/\"/g" temp.txt
cat temp.txt >> $OUTFILE
# Remove row counts
cp $OUTFILE temp.txt
cat temp.txt | grep -v " rows)" > $OUTFILE
echo "</div>" >> $OUTFILE
done
# Plot set comparison of tps
cat > multi-client.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set output "clients-sets.png"
set title "pgbench transactions/sec (clients)"
set grid xtics ytics
set xlabel "Clients"
set ylabel "TPS"
plot \
ENDING
cat > multi-scale.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set output "scaling-sets.png"
set title "pgbench transactions/sec (scale)"
set grid xtics ytics
set xlabel "Scaling factor"
set ylabel "TPS"
plot \
ENDING
# addon of latency over time
cat > multi-scale-latency.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set output "scaling-latency-sets.png"
set title "pgbench scale latency"
set grid xtics ytics
set xlabel "Scaling factor"
set ylabel "Latency (ms)"
#set xdata time
#set timefmt "%s"
plot \
ENDING
cat > multi-client-latency.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set output "clients-latency-sets.png"
set title "pgbench clients latency"
set grid xtics ytics
set xlabel "Clients"
set ylabel "Latency (ms)"
#set xdata time
#set timefmt "%s"
plot \
ENDING
for SET in $SETS ; do
# Trimmed down descriptions needed to fit into the graph key
DESCR=`$RESULTPSQL -A -t -c "select substring(info from 1 for 35) from testset where set='$SET'"`
if [ "$SET" -eq "$LASTSET" ] ; then
DELIM=""
else
DELIM=",\\"
fi
echo "'scaling-$SET.txt' using 1:3 axis x1y1 title '$DESCR' with linespoints linestyle 1 $DELIM" >> multi-scale.plot
echo "'clients-$SET.txt' using 1:2 axis x1y1 title '$DESCR' with linespoints linestyle 1 $DELIM" >> multi-client.plot
echo "'scaling-latency-$SET.txt' using 1:3 axis x1y1 title '$DESCR' with linespoints linestyle 1 $DELIM" >> multi-scale-latency.plot ## addon latency
echo "'clients-latency-$SET.txt' using 1:2 axis x1y1 title '$DESCR' with linespoints linestyle 1 $DELIM" >> multi-client-latency.plot ## addon latency
done
if [ ! -z $GNUPLOT ] && [ -x $GNUPLOT ]; then
gnuplot multi-scale.plot 2>&1 | grep -v "Warning: empty"
gnuplot multi-client.plot 2>&1 | grep -v "Warning: empty"
gnuplot multi-scale-latency.plot 2>&1 | grep -v "Warning: empty" ## addon latency
gnuplot multi-client-latency.plot 2>&1 | grep -v "Warning: empty" ## addon latency
mv clients-sets.png results/
mv scaling-sets.png results/
mv scaling-latency-sets.png results/ ## addon latency
mv clients-latency-sets.png results/ ## addon latency
rm multi-scale.plot
rm multi-client.plot
rm multi-scale-latency.plot ## addon latency
rm multi-client-latency.plot ## addon latency
fi
for SET in $SETS ; do
rm -f scaling-$SET.txt clients-$SET.txt latency-$SET.txt clients-latency-$SET.txt scaling-latency-$SET.txt ## addon latency
done
rm temp.txt
cat templates/footer.html >> $OUTFILE