Skip to content

Commit 4a13c1d

Browse files
authored
ci: sync Benchmarks workflow with the Postgres-step fix (#8)
1 parent 7069c3e commit 4a13c1d

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@ jobs:
1313
name: Run benchmark suite
1414
runs-on: ubuntu-latest
1515

16+
# Postgres is started as a step (below), not a service: the connection-budget
17+
# and churn tiers deliberately push past 50 tenant connections, so the stock
18+
# service cap of 100 throws "too many clients". Service containers can't set
19+
# the postgres command or mount a post-checkout config, so we run it manually
20+
# with benchmarks/postgres.bench.conf (max_connections=300), mirroring local.
1621
services:
17-
postgres:
18-
image: postgres:16-alpine
19-
env:
20-
POSTGRES_USER: postgres
21-
POSTGRES_PASSWORD: postgres
22-
POSTGRES_DB: lasagna_bench
23-
ports:
24-
- 5432:5432
25-
options: >-
26-
--health-cmd "pg_isready -U postgres -d lasagna_bench"
27-
--health-interval 5s
28-
--health-timeout 5s
29-
--health-retries 10
30-
3122
redis:
3223
image: redis:7-alpine
3324
ports:
@@ -65,6 +56,26 @@ jobs:
6556
steps:
6657
- uses: actions/checkout@v4
6758

59+
# Raised max_connections (300) so the cap=100 churn sweep × tenant poolMax
60+
# plus central/backoffice connections stays under the limit. Mounts the same
61+
# benchmarks/postgres.bench.conf the local docker-compose uses.
62+
- name: Start Postgres (bench tuning, max_connections=300)
63+
run: |
64+
docker run -d --name bench-postgres \
65+
-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=lasagna_bench \
66+
-p 5432:5432 \
67+
-v "$GITHUB_WORKSPACE/benchmarks/postgres.bench.conf:/etc/postgresql/postgresql.conf:ro" \
68+
postgres:16-alpine -c config_file=/etc/postgresql/postgresql.conf
69+
echo "Waiting for Postgres to accept connections…"
70+
for i in $(seq 1 30); do
71+
if docker exec bench-postgres pg_isready -U postgres -d lasagna_bench >/dev/null 2>&1; then
72+
echo "Postgres ready (max_connections=$(docker exec bench-postgres psql -U postgres -tAc 'show max_connections'))"
73+
exit 0
74+
fi
75+
sleep 2
76+
done
77+
echo "Postgres did not become ready in time"; docker logs bench-postgres; exit 1
78+
6879
- name: Setup Node.js
6980
uses: actions/setup-node@v4
7081
with:

0 commit comments

Comments
 (0)