feat(benchmark): add k6 benchmarks for JSONB/encrypted query performance #848
This file contains hidden or 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
| name: Benchmark Proxy | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| # deployments permission to deploy GitHub pages website | |
| deployments: write | |
| # contents permission to update benchmark contents in gh-pages branch | |
| contents: write | |
| # pull-requests permission to comment on PRs with benchmark alerts | |
| pull-requests: write | |
| jobs: | |
| benchmark: | |
| name: Performance regression check | |
| runs-on: blacksmith-16vcpu-ubuntu-2204 | |
| env: | |
| CS_ZEROKMS_HOST: https://us-east-1.aws.zerokms.cipherstashmanaged.net | |
| CS_CTS_HOST: https://ap-southeast-2.aws.cts.cipherstashmanaged.net | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup-test | |
| - name: Decrypt secrets | |
| uses: cipherstash/secrets-action@main | |
| with: | |
| secrets-file: .github/secrets.env.encrypted | |
| env: | |
| CS_CLIENT_ID: ${{ secrets.CS_VAULT_CLIENT_ID }} | |
| CS_CLIENT_KEY: ${{ secrets.CS_VAULT_CLIENT_KEY }} | |
| CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_VAULT_CLIENT_ACCESS_KEY }} | |
| CS_WORKSPACE_CRN: ${{ secrets.CS_VAULT_WORKSPACE_CRN }} | |
| - run: | | |
| mise run postgres:up --extra-args "--detach --wait" | |
| - name: Run k6 benchmark | |
| working-directory: tests/benchmark | |
| env: | |
| RUST_BACKTRACE: "1" | |
| run: mise run k6:benchmark:continuous | |
| # Store k6 throughput benchmark (higher is better) | |
| - name: Store k6 throughput benchmark | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: 'k6 Throughput' | |
| tool: 'customBiggerIsBetter' | |
| output-file-path: tests/benchmark/results/k6-throughput.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| fail-on-alert: true | |
| comment-on-alert: true | |
| summary-always: true | |
| auto-push: true | |
| benchmark-data-dir-path: docs/k6/throughput | |
| # Store k6 latency benchmark (lower is better) | |
| - name: Store k6 latency benchmark | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: 'k6 Latency' | |
| tool: 'customSmallerIsBetter' | |
| output-file-path: tests/benchmark/results/k6-latency.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| fail-on-alert: true | |
| comment-on-alert: true | |
| summary-always: true | |
| auto-push: true | |
| benchmark-data-dir-path: docs/k6/latency | |
| - name: Run pgbench benchmark | |
| working-directory: tests/benchmark | |
| env: | |
| RUST_BACKTRACE: "1" | |
| run: mise run benchmark_service --target=proxy --transaction=encrypted --protocol=extended --port=6432 --time=30 --clients=10 | |
| # Download previous benchmark result from cache (if exists) | |
| - name: Download previous benchmark data | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./cache | |
| key: ${{ runner.os }}-benchmark | |
| # Run `github-action-benchmark` action | |
| - name: Store pgbench benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: 'pgbench' | |
| tool: 'customBiggerIsBetter' | |
| output-file-path: tests/benchmark/results/output.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| fail-on-alert: true | |
| comment-on-alert: true | |
| summary-always: true | |
| auto-push: true | |
| benchmark-data-dir-path: docs/pgbench | |
| - uses: ./.github/actions/send-slack-notification | |
| with: | |
| channel: engineering | |
| webhook_url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }} |