mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-26 10:18:29 +02:00
refactor(benchmark): restart bench server after each run
This commit is contained in:
4
Makefile
4
Makefile
@@ -125,9 +125,9 @@ dev-build: build
|
||||
|
||||
benchmark:
|
||||
@if [ -z "$(TARGET)" ]; then \
|
||||
docker compose -f dev.compose.yml up -d --force-recreate whoami godoxy traefik caddy nginx; \
|
||||
docker compose -f dev.compose.yml up -d --force-recreate godoxy traefik caddy nginx; \
|
||||
else \
|
||||
docker compose -f dev.compose.yml up -d --force-recreate whoami $(TARGET); \
|
||||
docker compose -f dev.compose.yml up -d --force-recreate $(TARGET); \
|
||||
fi
|
||||
sleep 1
|
||||
@./scripts/benchmark.sh
|
||||
|
||||
@@ -9,7 +9,7 @@ HOST="bench.domain.com"
|
||||
DURATION="${DURATION:-10s}"
|
||||
THREADS="${THREADS:-4}"
|
||||
CONNECTIONS="${CONNECTIONS:-100}"
|
||||
TARGET="${TARGET:-}"
|
||||
TARGET="${TARGET-}"
|
||||
|
||||
# Color functions for output
|
||||
red() { echo -e "\033[0;31m$*\033[0m"; }
|
||||
@@ -133,12 +133,22 @@ echo ""
|
||||
blue "========================================"
|
||||
echo ""
|
||||
|
||||
restart_bench() {
|
||||
local name=$1
|
||||
echo ""
|
||||
yellow "Restarting bench service before benchmarking $name HTTP/1.1..."
|
||||
docker compose -f dev.compose.yml up -d --force-recreate bench >/dev/null 2>&1
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# Function to run benchmark
|
||||
run_benchmark() {
|
||||
local name=$1
|
||||
local url=$2
|
||||
local h2_duration="${DURATION%s}"
|
||||
|
||||
restart_bench "$name"
|
||||
|
||||
yellow "Testing $name..."
|
||||
|
||||
echo "========================================"
|
||||
@@ -152,6 +162,8 @@ run_benchmark() {
|
||||
-H "Host: $HOST" \
|
||||
"$url"
|
||||
|
||||
restart_bench "$name"
|
||||
|
||||
echo ""
|
||||
echo "[HTTP/2] h2load"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user