-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbench.sh
executable file
·34 lines (26 loc) · 976 Bytes
/
bench.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
#!/bin/bash
WRK="wrk -t8 -c400 -d30s"
HELLO_URL="http://localhost:8080/echo/hello-world"
PARAM_URL="http://localhost:8080/echo/plain/hello"
REGEX_URL="http://localhost:8080/echo/regex/42"
CHECK_HELLO=$(wget -qO- $HELLO_URL)
CHECK_PARAM=$(wget -qO- $PARAM_URL)
CHECK_NUM=$(wget -qO- $REGEX_URL)
if [[ "$CHECK_HELLO" != "Hello World" ]]; then
echo "Invalid $HELLO_URL response! Expected 'hello' got '$CHECK_HELLO' (Is the server running?)"
exit 1
fi
if [[ "$CHECK_PARAM" != "hello" ]]; then
echo "Invalid $PARAM_URL response! Expected 'hello' got '$CHECK_PARAM' (Is the server running?)"
exit 1
fi
if [[ "$CHECK_NUM" != "42" ]]; then
echo "Invalid $REGEX_URL response! Expected '42' got '$CHECK_NUM' (Is the server running?)"
exit 1
fi
echo "Benchmarking $HELLO_URL (no regex, no captures)"
$WRK $HELLO_URL
echo "Benchmarking $PARAM_URL (simple captures, no regex)"
$WRK $PARAM_URL
echo "Benchmarking $REGEX_URL (regex captures)"
$WRK $REGEX_URL