hatch-surf/scripts/load-test.sh
Riley Zhang 12775f836c Phase 4: Production readiness - graceful shutdown, health checks, load testing, pprof
- Graceful shutdown: SIGINT/SIGTERM handling with 5s timeout
- Readiness probe (/readyz): pings database before reporting ready
- Connection pool: documented MaxOpenConns(1) for SQLite single-writer constraint
- Load test tool: cmd/loadtest with configurable concurrency/total requests
- Shell script: scripts/load-test.sh for quick load testing
- pprof endpoints: /debug/pprof/* when HATCH_DEBUG env var is set

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-24 05:26:42 +02:00

24 lines
665 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Load test script for Hatch server.
# Assumes the server is already running at http://localhost:8080
# or at the URL specified by HATCH_URL.
HATCH_URL="${HATCH_URL:-http://localhost:8080}"
CONCURRENCY="${CONCURRENCY:-10}"
TOTAL="${TOTAL:-1000}"
echo "Running load test against $HATCH_URL"
echo "Concurrency: $CONCURRENCY, Total requests: $TOTAL"
# Build the load test binary if not present.
if [ ! -f ./loadtest ]; then
echo "Building load test binary..."
go build -o ./loadtest ./cmd/loadtest
fi
# Run the load test.
./loadtest -url "$HATCH_URL/healthz" -c "$CONCURRENCY" -n "$TOTAL"
echo "Load test completed."