main
1ENDPOINT="http://confection.herokuapp.com/"
2REQUEST_COUNT="1000"
3THREAD_COUNT="25"
4
5FILENAME="$REQUEST_COUNT.$THREAD_COUNT.$(date +%s)"
6
7mkdir -p data
8
9# run apache bench performance test
10# -k means keep connections alive
11echo "/usr/sbin/ab -n $REQUEST_COUNT -c $THREAD_COUNT -g "data/$FILENAME.dat" $ENDPOINT"
12/usr/sbin/ab -n $REQUEST_COUNT -c $THREAD_COUNT -g "data/$FILENAME.dat" $ENDPOINT
13
14# ctime: Connection Time
15# dtime: Processing Time
16# ttime: Total Time
17# wait: Waiting Time
18
19mkdir -p graphs
20
21# create graph
22gnuplot << EOF
23 # output as png image
24 set terminal jpeg
25 # save file to "results.png"
26 set output "graphs/$FILENAME.png"
27 # graph title
28 set title "$REQUEST_COUNT requests on $THREAD_COUNT thread(s)"
29 # nicer aspect ratio for image size
30 set size 1,0.7
31 # y-axis grid
32 set grid y
33 # x-axis label
34 set xlabel "Request"
35 # y-axis label
36 set ylabel "Total time (ms)"
37 #'unique', 'frequency', 'cumulative', 'cnormal', 'kdensity', 'acsplines', 'csplines', 'bezier' or 'sbezier'
38 plot "data/$FILENAME.dat" using 9 smooth frequency with lines title "frequency"
39EOF
40
41echo "\nResults are in $FILENAME.png\n"