name: VantaDB Performance Benchmarks
on:
push:
branches: [ "main" ]
paths:
- 'src/**'
- 'vantadb-python/**'
- 'benchmarks/**'
- 'Cargo.toml'
- 'Cargo.lock'
pull_request:
branches: [ "main" ]
paths:
- 'src/**'
- 'vantadb-python/**'
- 'benchmarks/**'
workflow_dispatch:
inputs:
size:
description: 'Number of vectors to ingest'
required: true
default: '10000'
queries:
description: 'Number of queries to run'
required: true
default: '1000'
dim:
description: 'Dimensionality of vectors'
required: true
default: '128'
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
permissions:
contents: write
jobs:
benchmark:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Free Disk Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-bin: "false"
- name: Install system dependencies (RocksDB + Clang)
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev clang librocksdb-dev
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
- name: Build & install Python wheel
run: |
python -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install maturin
.venv/bin/maturin build --manifest-path vantadb-python/Cargo.toml --release --out vantadb-python/dist
.venv/bin/pip install $(ls -t vantadb-python/dist/vantadb_py-*.whl | head -n 1) --force-reinstall
.venv/bin/python -c "import vantadb_py; print('Import OK:', vantadb_py.__version__)"
- name: Run Standard Ingestion & Search Benchmark
run: |
# Use inputs if triggered manually, otherwise fall back to a lightweight 1K size for automated push runs
SIZE="${{ github.event.inputs && github.event.inputs.size || '1000' }}"
QUERIES="${{ github.event.inputs && github.event.inputs.queries || '100' }}"
DIM="${{ github.event.inputs && github.event.inputs.dim || '128' }}"
.venv/bin/python benchmarks/vantadb_local_bench.py --size $SIZE --dim $DIM --queries $QUERIES --output benchmark_results.json
- name: Update BENCHMARKS.md dynamically
run: |
.venv/bin/python benchmarks/update_markdown.py
- name: Commit and Push Benchmark Metrics
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git"
git add docs/operations/BENCHMARKS.md
if ! git diff-index --quiet HEAD; then
git commit -m "docs: update dynamic performance metrics [skip ci]"
git push origin HEAD:main || echo "::warning::Unable to push benchmark metrics (branch protection may be enabled); benchmark artifacts were still uploaded."
fi
- name: Upload Benchmark Results Artifact
uses: actions/upload-artifact@v4
with:
name: vanta-benchmark-results
path: benchmark_results.json
retention-days: 14