forked from smallnest/go-web-framework-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-pipelining.sh
executable file
·71 lines (55 loc) · 1.89 KB
/
test-pipelining.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
#!/bin/bash
server_bin_name="gowebbenchmark"
. ./libs.sh
length=${#web_frameworks[@]}
test_result=()
cpu_cores=`cat /proc/cpuinfo|grep processor|wc -l`
if [ $cpu_cores -eq 0 ]
then
cpu_cores=1
fi
test_web_framework()
{
echo "testing web framework: $2"
./$server_bin_name $2 $3 &
sleep 2
throughput=`wrk -t$cpu_cores -c$4 -d30s http://127.0.0.1:8080/hello -s pipeline.lua --latency -- / 16| grep Requests/sec | awk '{print $2}'`
echo "throughput: $throughput requests/second"
test_result[$1]=$throughput
pkill -9 $server_bin_name
sleep 2
echo "finsihed testing $2"
echo
}
test_all()
{
echo "###################################"
echo " "
echo " ProcessingTime $1ms "
echo " Concurrency $2 "
echo " "
echo "###################################"
for ((i=0; i<$length; i++))
do
test_web_framework $i ${web_frameworks[$i]} $1 $2
done
}
pkill -9 $server_bin_name
echo ","$(IFS=$','; echo "${web_frameworks[*]}" ) > processtime-pipeline.csv
test_all 0 5000
echo "0 ms,"$(IFS=$','; echo "${test_result[*]}" ) >> processtime-pipeline.csv
test_all 10 5000
echo "10 ms,"$(IFS=$','; echo "${test_result[*]}" ) >> processtime-pipeline.csv
test_all 100 5000
echo "100 ms,"$(IFS=$','; echo "${test_result[*]}" ) >> processtime-pipeline.csv
test_all 500 5000
echo "500 ms,"$(IFS=$','; echo "${test_result[*]}" ) >> processtime-pipeline.csv
echo ","$(IFS=$','; echo "${web_frameworks[*]}" ) > concurrency-pipeline.csv
test_all 30 100
echo "100,"$(IFS=$','; echo "${test_result[*]}" ) >> concurrency-pipeline.csv
test_all 30 1000
echo "1000,"$(IFS=$','; echo "${test_result[*]}" ) >> concurrency-pipeline.csv
test_all 30 5000
echo "5000,"$(IFS=$','; echo "${test_result[*]}" ) >> concurrency-pipeline.csv
mv -f processtime-pipeline.csv ./testresults
mv -f concurrency-pipeline.csv ./testresults