-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathrates_webreport
319 lines (275 loc) · 16.1 KB
/
rates_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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#!/bin/bash
#
# rates_webreport.sh connects to the Results database and generates a web page
# as rates_index.htm that includes links to all the results selected in the database like so
# ./rates_webreport 2,8,9
#
# 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 "<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
echo "<img src=\"rates-latency-sets.png\"><p>" >> $OUTFILE
echo "<img src=\"scaling-latency-sets-rates.png\"><p>" >> $OUTFILE
echo "<img src=\"clients-latency-sets-rates.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
$RESULTPSQL -At -F" " -c "select rate_limit,round(avg(dbsize) / (1024 * 1024)) as dbsize,round(1000*avg(percentile_90_latency))/1000 as \"90%<\" from tests where set='$SET' group by rate_limit order by rate_limit" > rates-latency.txt
gnuplot plots/rates-latency.plot 2>&1 | grep -v "Warning: empty"
mv rates-latency.png results/rates-latency-$SET.png
mv rates-latency.txt rates-latency-$SET.txt
$RESULTPSQL -At -F" " -c "SELECT a.rate_limit, array_length( rates,1) as arrlength, array_to_string(rates,' ','*'), array_to_string(lat_scale,' ','*') FROM ( SELECT s.rate_limit, array_agg(s.scale) as rates, array_agg(s.avgpc90lat_scale) as lat_scale FROM ( SELECT DISTINCT rate_limit, scale, avg(percentile_90_latency) OVER (PARTITION BY rate_limit order by scale ) as avgpc90lat_scale from tests t where set='$SET' order by rate_limit ) s group by s.rate_limit ) a " > rates-scaling-latency.txt
gnuplot plots/rates-scaling-latency.plot 2>&1 | grep -v "Warning: empty"
mv rates-scaling-latency.png results/rates-scaling-latency-$SET.png
mv rates-scaling-latency.txt rates-scaling-latency-$SET.txt
$RESULTPSQL -At -F" " -c "SELECT a.rate_limit, array_length( clients,1) as arrlength, array_to_string(clients,' ','*'), array_to_string(lat_clients,' ','*') FROM ( SELECT s.rate_limit, array_agg(s.clients) as clients, array_agg(s.avgpc90lat_clients) as lat_clients FROM ( SELECT DISTINCT rate_limit, clients, avg(percentile_90_latency) OVER (PARTITION BY rate_limit order by clients ) as avgpc90lat_clients from tests t where set='$SET' order by rate_limit ) s group by s.rate_limit ) a " > rates-clients-latency.txt
gnuplot plots/rates-clients-latency.plot 2>&1 | grep -v "Warning: empty"
mv rates-clients-latency.png results/rates-clients-latency-$SET.png
mv rates-clients-latency.txt rates-clients-latency-$SET.txt
$RESULTPSQL -At -F" " -c "select rate_limit, scale , round(1000*avg(percentile_90_latency))/1000 as \"90%<\" from tests where set='$SET' group by scale,rate_limit order by scale,rate_limit" > 3d_lat.txt
gnuplot plots/3d_lat.plot 2>&1 | grep -v "Warning: empty"
mv 3d_lat.png results/3d_lat-$SET.png
rm 3d_lat.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
echo "<img src=\"rates-latency-$SET.png\"><p>" >> $OUTFILE
echo "<img src=\"rates-scaling-latency-$SET.png\"><p>" >> $OUTFILE
echo "<img src=\"rates-clients-latency-$SET.png\"><p>" >> $OUTFILE
echo "<img src=\"3d_lat-$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 and rates: >> $OUTFILE
$RESULTPSQL -H -c "select set,scale,rate_limit as rate,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,rate_limit order by set,scale,rate_limit;" >> $OUTFILE
echo Averages for test set $SET by clients and rates: >> $OUTFILE
$RESULTPSQL -H -c "select set,clients,rate_limit as rate, 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,rate_limit order by set,clients,rate_limit;" >> $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,client_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 png medium size 640,480
#set output "clients-sets.png"
#set title "pgbench transactions/sec"
#set grid xtics ytics
#set xlabel "Clients"
#set ylabel "TPS"
#plot \
#ENDING
#cat > multi-scale.plot << "ENDING"
#set terminal png medium size 640,480
#set output "scaling-sets.png"
#set title "pgbench transactions/sec"
#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 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 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
# addon of rates over latency
cat > multi-rates-latency.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set output "rates-latency-sets.png"
set title "pgbench rates latency"
set grid xtics ytics
set xlabel "rates"
set ylabel "Latency (ms)"
#set xdata time
#set timefmt "%s"
plot \
ENDING
# addon rates
cat > multi-scale-latency-rates.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set output "scaling-latency-sets-rates.png"
set title "pgbench scales latency"
set grid xtics ytics
set xlabel "rates "
set ylabel "Latency (ms)"
#set xdata time
#set timefmt "%s"
plot \
ENDING
# addon rates
cat > multi-clients-latency-rates.plot << "ENDING"
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set output "clients-latency-sets-rates.png"
set title "pgbench clients latency"
set grid xtics ytics
set xlabel "rates "
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 $DELIM" >> multi-scale.plot
# echo "'clients-$SET.txt' using 1:2 axis x1y1 title '$DESCR' with linespoints $DELIM" >> multi-client.plot
echo "'scaling-latency-$SET.txt' using 1:3 axis x1y1 title '$DESCR' with linespoints $DELIM" >> multi-scale-latency.plot ## addon latency
echo "'clients-latency-$SET.txt' using 1:2 axis x1y1 title '$DESCR' with linespoints $DELIM" >> multi-client-latency.plot ## addon latency
echo "'rates-latency-$SET.txt' using 1:3 axis x1y1 title '$DESCR' with linespoints $DELIM" >> multi-rates-latency.plot ## addon rates
echo "'rates-scaling-latency-$SET.txt' using 1:7 axis x1y1 title '1-$DESCR' with linespoints , 'rates-scaling-latency-$SET.txt' using 1:8 axis x1y1 title '10-$DESCR' with linespoints , 'rates-scaling-latency-$SET.txt' using 1:9 axis x1y1 title '100-$DESCR' with linespoints, 'rates-scaling-latency-$SET.txt' using 1:10 axis x1y1 title '1000-$DESCR' with linespoints $DELIM" >> multi-scale-latency-rates.plot ## addon rates
echo "'rates-clients-latency-$SET.txt' using 1:9 axis x1y1 title '1-$DESCR' with linespoints, 'rates-clients-latency-$SET.txt' using 1:10 axis x1y1 title '2-$DESCR' with linespoints , 'rates-clients-latency-$SET.txt' using 1:11 axis x1y1 title '4-$DESCR' with linespoints , 'rates-clients-latency-$SET.txt' using 1:12 axis x1y1 title '8-$DESCR' with linespoints , 'rates-clients-latency-$SET.txt' using 1:13 axis x1y1 title '16-$DESCR' with linespoints , 'rates-clients-latency-$SET.txt' using 1:14 axis x1y1 title '32-$DESCR' with linespoints $DELIM" >> multi-clients-latency-rates.plot ## addon rates
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
gnuplot multi-rates-latency.plot 2>&1 | grep -v "Warning: empty" ## addon rates
gnuplot multi-scale-latency-rates.plot 2>&1 | grep -v "Warning: empty" ## addon rates
gnuplot multi-clients-latency-rates.plot 2>&1 | grep -v "Warning: empty" ## addon rates
#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
mv rates-latency-sets.png results/ ## addon rates
mv scaling-latency-sets-rates.png results/ ## addon rates
mv clients-latency-sets-rates.png results/ ## addon rates
#rm multi-scale.plot
#rm multi-client.plot
rm multi-scale-latency.plot ## addon latency
rm multi-client-latency.plot ## addon latency
rm multi-rates-latency.plot ## addon rates
rm multi-scale-latency-rates.plot ## addon rates
rm multi-clients-latency-rates.plot ## addon rates
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 rates-latency-$SET.txt ## addon latency ## addon rates
rm -f caling-$SET.txt clients-$SET.txt latency-$SET.txt clients-latency-$SET.txt scaling-latency-$SET.txt rates-latency-$SET.txt rates-scaling-latency-$SET.txt rates-clients-latency-$SET.txt ## addon latency ## addon rates
done
rm temp.txt
cat templates/footer.html >> $OUTFILE