forked from zio/zio-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark-zio-http.sh
executable file
·47 lines (43 loc) · 2.65 KB
/
benchmark-zio-http.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
COMMIT_SHA=$(git rev-parse --short HEAD)
ZIO_HTTP="zio/zio-http.git#$COMMIT_SHA"
if [ -z "$1" ]; then
SERVER=PlainTextBenchmarkServer
else
SERVER=$1
fi
if [ ! -e "/var/run/docker.sock" ]; then
echo "'/var/run/docker.sock' does not exist. Are you sure Docker is running?"
exit 1
fi
if [ ! -d "../FrameworkBenchMarks" ]; then
git clone https://github.com/zio/FrameworkBenchmarks.git ../FrameworkBenchMarks
git checkout master
fi
mkdir -p ../FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala
rm ../FrameworkBenchMarks/frameworks/Scala/zio-http/build.sbt
rm ../FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala
cp ../FrameworkBenchMarks/frameworks/Scala/zio-http/base.build.sbt ../FrameworkBenchMarks/frameworks/Scala/zio-http/build.sbt
cp ./zio-http-example/src/main/scala/example/$SERVER.scala ../FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala
cd ../FrameworkBenchMarks
if [ "$OS" = 'Darwin' ]; then
sed -i '' "s|---COMMIT_SHA---|${ZIO_HTTP}|g" frameworks/Scala/zio-http/build.sbt
else
sed -i "s|---COMMIT_SHA---|${ZIO_HTTP}|g" frameworks/Scala/zio-http/build.sbt
fi
./tfb --test zio-http | tee result
RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "concurrency: [0-9]+")
echo ::set-output name=request_result::$(echo $RESULT_REQUEST)
echo ::set-output name=concurrency_result::$(echo $RESULT_CONCURRENCY)
RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 1024 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 1024 for plaintext" result) | grep -oiE "concurrency: [0-9]+")
echo ::set-output name=request_result::$(echo $RESULT_REQUEST)
echo ::set-output name=concurrency_result::$(echo $RESULT_CONCURRENCY)
RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 4096 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 4096 for plaintext" result) | grep -oiE "concurrency: [0-9]+")
echo ::set-output name=request_result::$(echo $RESULT_REQUEST)
echo ::set-output name=concurrency_result::$(echo $RESULT_CONCURRENCY)
RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 16384 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 16384 for plaintext" result) | grep -oiE "concurrency: [0-9]+")
echo ::set-output name=request_result::$(echo $RESULT_REQUEST)
echo ::set-output name=concurrency_result::$(echo $RESULT_CONCURRENCY)