-
Notifications
You must be signed in to change notification settings - Fork 445
Expand file tree
/
Copy pathperf-test.sh
More file actions
executable file
·39 lines (28 loc) · 1.12 KB
/
perf-test.sh
File metadata and controls
executable file
·39 lines (28 loc) · 1.12 KB
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
#!/bin/bash
# install the dev.Dockerfile, build the app and run k6 tests
docker build -t frankenphp-dev -f dev.Dockerfile .
export "CADDY_HOSTNAME=http://host.docker.internal"
select filename in ./testdata/performance/*.js; do
read -r -p "How many worker threads? " workerThreads
read -r -p "How many max threads? " maxThreads
numThreads=$((workerThreads + 1))
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-p 8125:80 \
-v "$PWD:/go/src/app" \
--name load-test-container \
-e "MAX_THREADS=$maxThreads" \
-e "WORKER_THREADS=$workerThreads" \
-e "NUM_THREADS=$numThreads" \
-itd \
frankenphp-dev \
sh /go/src/app/testdata/performance/start-server.sh
docker exec -d load-test-container sh /go/src/app/testdata/performance/flamegraph.sh
sleep 10
docker run --entrypoint "" -it --rm -v .:/app -w /app \
--add-host "host.docker.internal:host-gateway" \
grafana/k6:latest \
k6 run -e "CADDY_HOSTNAME=$CADDY_HOSTNAME:8125" "./$filename"
docker exec load-test-container curl "http://localhost:2019/frankenphp/threads"
docker stop load-test-container
docker rm load-test-container
done