run-profile.sh raw
1 #!/bin/bash
2
3 # Run benchmark with profiling on ORLY only
4
5 set -e
6
7 # Determine docker-compose command
8 if docker compose version &> /dev/null 2>&1; then
9 DOCKER_COMPOSE="docker compose"
10 else
11 DOCKER_COMPOSE="docker-compose"
12 fi
13
14 # Clean up old data and profiles (may need sudo for Docker-created files)
15 echo "Cleaning old data and profiles..."
16 if [ -d "data/next-orly" ]; then
17 if ! rm -rf data/next-orly/* 2>/dev/null; then
18 echo "Need elevated permissions to clean data directories..."
19 sudo rm -rf data/next-orly/*
20 fi
21 fi
22 rm -rf profiles/* 2>/dev/null || sudo rm -rf profiles/* 2>/dev/null || true
23 mkdir -p data/next-orly profiles
24 chmod 777 data/next-orly 2>/dev/null || true
25
26 echo "Starting profiled benchmark (ORLY only)..."
27 echo "- 50,000 events"
28 echo "- 24 workers"
29 echo "- 90 second warmup delay"
30 echo "- CPU profiling enabled"
31 echo "- pprof HTTP on port 6060"
32 echo ""
33
34 # Run docker compose with profile config
35 $DOCKER_COMPOSE -f docker-compose.profile.yml up \
36 --exit-code-from benchmark-runner \
37 --abort-on-container-exit
38
39 echo ""
40 echo "Benchmark complete. Profiles saved to ./profiles/"
41 echo "Results saved to ./reports/"
42