-
Notifications
You must be signed in to change notification settings - Fork 0
/
measure.sh
executable file
·51 lines (42 loc) · 1.19 KB
/
measure.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
#! /usr/bin/env bash
THREADS=10
# our work laptop runs into socket/fd issues with more than ~1000 connections
CONNECTIONS=100
DURATION_SECONDS=10
SCRIPT=./post-script.lua
SUBJECT=$1
if [ "$SUBJECT" = "" ] ; then
echo "usage: $0 subject # subject: zig or go"
exit 1
fi
if [ "$SUBJECT" = "zig" ] ; then
zig build -Drelease-fast > /dev/null
# for debugging:
# zig build > /dev/null
./zig-out/bin/zap-endpoint-tests > zig.out 2> zig.err &
PID=$!
echo "THE PID IS $PID"
URL=http://127.0.0.1:3000/users
fi
# if [ "$SUBJECT" = "go" ] ; then
# cd wrk/go && go build main.go
# ./main &
# PID=$!
# URL=http://127.0.0.1:8090/hello
# fi
if [ "$SUBJECT" = "python" ] ; then
cd python
python main.py > /dev/null 2>&1 &
PID=$!
echo "THE PID IS $PID"
URL=http://127.0.0.1:3000/users
SCRIPT=../$SCRIPT
fi
sleep 1
echo "========================================================================"
echo " $SUBJECT"
echo "========================================================================"
wrk -c $CONNECTIONS -t $THREADS -d $DURATION_SECONDS -s $SCRIPT --latency $URL
echo FINISHED, SLEEPING 10s
sleep 10
kill $PID