-
Notifications
You must be signed in to change notification settings - Fork 13
/
run-load-test.sh
executable file
·39 lines (35 loc) · 1.32 KB
/
run-load-test.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
#!/usr/bin/env bash
#
set -e
#
URL=http://localhost:8080/api
#timeout in sec
REQ_TIMEOUT=600
NUM_REQUEST=100000000
CONCURRENCY=128
#
echo " " >> result.log 2>&1
echo "========================================================== " >> result.log 2>&1
echo " " >> result.log 2>&1
echo "====================WARM-UP======================== " >> result.log 2>&1
echo "============`date` Warming up the API with ${NUM_REQUEST} requests" >> result.log 2>&1
echo " " >> result.log 2>&1
ab -k -n $NUM_REQUEST -c 1 -d -q -s $REQ_TIMEOUT $URL >> result.log 2>&1
echo " " >> result.log 2>&1
echo "============`date` API warmed up. " >> result.log 2>&1
echo " " >> result.log 2>&1
echo "====================END WARM-UP======================== " >> result.log 2>&1
echo "=== Sleeping for 2s" >> result.log 2>&1
sleep 2
echo "====================BENCHMARK======================== " >> result.log 2>&1
echo "============`date` Running load test ..." >> result.log 2>&1
#The benchmark
ab -k -n $NUM_REQUEST -c $CONCURRENCY -s $REQ_TIMEOUT $URL >> result.log 2>&1
echo " " >> result.log 2>&1
echo "============`date` Done ..." >> result.log 2>&1
echo " " >> result.log 2>&1
echo "====================END BENCHMARK======================== " >> result.log 2>&1
echo " " >> result.log 2>&1
echo " " >> result.log 2>&1
echo " " >> result.log 2>&1
echo " " >> result.log 2>&1