Skip to content
39 changes: 39 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: benchmarks
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
bench:
runs-on: blacksmith-32vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install CI deps
run: bash integration/ci/install-deps.sh
- uses: Swatinem/rust-cache@v2
with:
prefix-key: build-v1
- name: Build base
run: |
git fetch --depth=1 origin ${{ github.event.pull_request.base.sha || 'main' }}
git checkout FETCH_HEAD
cargo build --release --bin pgdog
cp target/release/pgdog ${{ runner.temp }}/pgdog-base
git checkout ${{ github.sha }}
- name: Build head
run: |
cargo build --release --bin pgdog
cp target/release/pgdog ${{ runner.temp }}/pgdog-head
- name: Setup PostgreSQL
run: bash integration/ci/setup.sh
- name: Run benchmarks
shell: bash
run: |
for name in pooler lb sharding; do
for rev in base head; do
PGDOG_BIN=${{ runner.temp }}/pgdog-$rev bash benches/perf/run.sh $name | tee ${{ runner.temp }}/$name-$rev.txt
done
done
- name: TPS
run: grep '^tps' ${{ runner.temp }}/{pooler,lb,sharding}-{base,head}.txt
2 changes: 1 addition & 1 deletion benches/perf/lb/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export PGHOST=127.0.0.1
export PGPORT=6432

pgbench -i
pgbench -c 10 -j 2 -t 10000000 -f ${SCRIPT_DIR}/../select_1.sql -P 1
pgbench -c 10 -j 2 -T 30 -f ${SCRIPT_DIR}/../select_1.sql -P 1
2 changes: 1 addition & 1 deletion benches/perf/pooler/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export PGHOST=127.0.0.1
export PGPORT=6432

pgbench -i
pgbench -c 10 -j 2 -t 10000000 -f ${SCRIPT_DIR}/../select_1.sql -P 1
pgbench -c 10 -j 2 -T 30 -f ${SCRIPT_DIR}/../select_1.sql -P 1
11 changes: 11 additions & 0 deletions benches/perf/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/../../integration/common.sh

run_pgdog benches/perf/$1
wait_for_pgdog

bash ${SCRIPT_DIR}/$1/run.sh

stop_pgdog
2 changes: 1 addition & 1 deletion benches/perf/sharding/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export PGPORT=6432

psql -f ${SCRIPT_DIR}/setup.sql
pgbench -i
pgbench -c 10 -j 2 -t 10000000 -f ${SCRIPT_DIR}/script.sql -P 1 --protocol extended
pgbench -c 10 -j 2 -T 30 -f ${SCRIPT_DIR}/script.sql -P 1 --protocol extended