-
Notifications
You must be signed in to change notification settings - Fork 5
/
benchmark.bash
41 lines (29 loc) · 881 Bytes
/
benchmark.bash
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
#!/usr/bin/env bash
set -ex
echo "-: benchmark.bash"
if [[ $RUNNER_OS != Linux ]]; then
exit 0
fi
echo "-: install nginx"
sudo apt-get install -y nginx curl
echo "-: start nginx"
sudo nginx -c "$(pwd)/ci/benchmark.nginx.conf"
echo "-: make test file"
sudo mkdir -p /data
# size: 10m
sudo dd if=/dev/zero of=file.txt count=10240 bs=1024
sudo mv file.txt /data/abc
echo "-: benchmark test begins"
echo "-: Request with one connection"
# 10240k / 100k/s = 102s = 1m42s
time curl http://localhost:9010/abc > abc
rm abc
echo "-: Request with 10 connections"
# 10240k / (10 * 100k/s) = 10s, each interval is 1m
time target/debug/ag http://localhost:9010/abc -s 10 -k 1m
rm abc
echo "-: Request with 100 connections"
# 10240k / (100 * 100k/s) = 1s, each interval is 102.4k
time target/debug/ag http://localhost:9010/abc -s 100 -k 103k
rm abc
echo "-: benchmark test ends"