Benchmark pg_search #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# workflows/benchmark-pg_search.yml | |
# | |
# Benchmark pg_search | |
# Benchmark pg_search performance on a nightly basis. This workflow can also be triggered | |
# manually to benchmark other systems on one-off basis, to compare against pg_search. | |
name: Benchmark pg_search | |
on: | |
schedule: | |
- cron: "1 0 * * 1,2,3,4,5" # Run once per day on weekdays (days of the week 1-5) at 00:01 UTC | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- dev | |
- main | |
paths: | |
- ".github/workflows/benchmark-pg_search.yml" | |
- "cargo-paradedb/**" | |
- "docker/Dockerfile" | |
- "pg_search/**" | |
- "!pg_search/README.md" | |
- "shared/Cargo.toml" | |
- "tokenizers/Cargo.toml" | |
workflow_dispatch: | |
concurrency: | |
group: benchmark-pg_search-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
benchmark-pg_search: | |
name: Benchmark pg_search | |
runs-on: depot-ubuntu-latest-8 | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
pg_version: [16] | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install & Configure Supported PostgreSQL Version | |
run: | | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
sudo apt-get update && sudo apt-get install -y postgresql-${{ matrix.pg_version }} postgresql-server-dev-${{ matrix.pg_version }} | |
sudo chown -R $(whoami) /usr/share/postgresql/${{ matrix.pg_version }}/ /usr/lib/postgresql/${{ matrix.pg_version }}/ /var/lib/postgresql/${{ matrix.pg_version }}/ | |
echo "/usr/lib/postgresql/${{ matrix.pg_version }}/bin" >> $GITHUB_PATH | |
- name: Extract pgrx version | |
working-directory: pg_search/ | |
run: echo "PGRX_VERSION=$(cargo tree --depth 1 -i pgrx -p pg_search | head -n 1 | cut -f2 -dv)" >> $GITHUB_ENV | |
- name: Install pgrx & pg_search | |
working-directory: pg_search/ | |
run: | | |
cargo install -j $(nproc) --locked cargo-pgrx --version ${{ env.PGRX_VERSION }} | |
cargo pgrx init --pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config | |
cargo pgrx install --pg-config="/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" --release | |
- name: Add pg_search to shared_preload_libraries | |
working-directory: /home/runner/.pgrx/data-${{ matrix.pg_version }}/ | |
run: sed -i "s/^#shared_preload_libraries = .*/shared_preload_libraries = 'pg_search'/" postgresql.conf | |
- name: Install the ParadeDB Benchmarking Tool | |
working-directory: cargo-paradedb/ | |
run: cargo run install | |
- name: Run pg_search Benchmarks | |
working-directory: pg_search/ | |
run: | | |
cargo pgrx start pg${{ matrix.pg_version }} | |
cargo paradedb bench eslogs generate --events 5000000 --url postgresql://localhost:288${{ matrix.pg_version }}/postgres | |
cargo paradedb bench eslogs build-search-index --url postgresql://localhost:288${{ matrix.pg_version }}/postgres | |
cargo paradedb bench eslogs query-search-index --url postgresql://localhost:288${{ matrix.pg_version }}/postgres | |
- name: Notify Slack on Failure | |
if: failure() && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Benchmark pg_search Workflow failed in `paradedb/paradedb` -- investigate immediately!"}' ${{ secrets.SLACK_WEBHOOK_URL }} |