From 4d64edf8a552a9123590bc5a121bb79093741b68 Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Thu, 6 Apr 2023 17:18:24 +0100 Subject: [PATCH] Nightly Benchmarks: Add free tier sized compute (#3969) - Add support for VMs and CU - Add free tier limited benchmark (0.25 CU) - Ensure we use 1 CU by default for pgbench workload --- .github/actions/neon-project-create/action.yml | 16 ++++++++++++++++ .github/workflows/benchmarking.yml | 11 ++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/actions/neon-project-create/action.yml b/.github/actions/neon-project-create/action.yml index 0480bfbc84..ae6464990e 100644 --- a/.github/actions/neon-project-create/action.yml +++ b/.github/actions/neon-project-create/action.yml @@ -14,6 +14,12 @@ inputs: api_host: desctiption: 'Neon API host' default: console.stage.neon.tech + provisioner: + desctiption: 'k8s-pod or k8s-neonvm' + default: 'k8s-pod' + compute_units: + desctiption: '[Min, Max] compute units; Min and Max are used for k8s-neonvm with autoscaling, for k8s-pod values Min and Max should be equal' + default: '[1, 1]' outputs: dsn: @@ -31,6 +37,10 @@ runs: # A shell without `set -x` to not to expose password/dsn in logs shell: bash -euo pipefail {0} run: | + if [ "${PROVISIONER}" == "k8s-pod" ] && [ "${MIN_CU}" != "${MAX_CU}" ]; then + echo >&2 "For k8s-pod provisioner MIN_CU should be equal to MAX_CU" + fi + project=$(curl \ "https://${API_HOST}/api/v2/projects" \ --fail \ @@ -42,6 +52,9 @@ runs: \"name\": \"Created by actions/neon-project-create; GITHUB_RUN_ID=${GITHUB_RUN_ID}\", \"pg_version\": ${POSTGRES_VERSION}, \"region_id\": \"${REGION_ID}\", + \"provisioner\": \"${PROVISIONER}\", + \"autoscaling_limit_min_cu\": ${MIN_CU}, + \"autoscaling_limit_max_cu\": ${MAX_CU}, \"settings\": { } } }") @@ -62,3 +75,6 @@ runs: API_KEY: ${{ inputs.api_key }} REGION_ID: ${{ inputs.region_id }} POSTGRES_VERSION: ${{ inputs.postgres_version }} + PROVISIONER: ${{ inputs.provisioner }} + MIN_CU: ${{ fromJSON(inputs.compute_units)[0] }} + MAX_CU: ${{ fromJSON(inputs.compute_units)[1] }} diff --git a/.github/workflows/benchmarking.yml b/.github/workflows/benchmarking.yml index 16be60b1a1..425d4d76c9 100644 --- a/.github/workflows/benchmarking.yml +++ b/.github/workflows/benchmarking.yml @@ -111,6 +111,7 @@ jobs: strategy: fail-fast: false matrix: + # neon-captest-freetier: Run pgbench with freetier-limited compute # neon-captest-new: Run pgbench in a freshly created project # neon-captest-reuse: Same, but reusing existing project # neon-captest-prefetch: Same, with prefetching enabled (new project) @@ -120,6 +121,9 @@ jobs: db_size: [ 10gb ] runner: [ us-east-2 ] include: + - platform: neon-captest-freetier + db_size: 3gb + runner: us-east-2 - platform: neon-captest-prefetch db_size: 50gb runner: us-east-2 @@ -160,13 +164,14 @@ jobs: echo "${POSTGRES_DISTRIB_DIR}/v${DEFAULT_PG_VERSION}/bin" >> $GITHUB_PATH - name: Create Neon Project - if: contains(fromJson('["neon-captest-new", "neon-captest-prefetch"]'), matrix.platform) + if: contains(fromJson('["neon-captest-new", "neon-captest-prefetch", "neon-captest-freetier"]'), matrix.platform) id: create-neon-project uses: ./.github/actions/neon-project-create with: region_id: ${{ github.event.inputs.region_id || 'aws-us-east-2' }} postgres_version: ${{ env.DEFAULT_PG_VERSION }} api_key: ${{ secrets.NEON_STAGING_API_KEY }} + compute_units: ${{ (matrix.platform == 'neon-captest-freetier' && '[0.25, 0.25]') || '[1, 1]' }} - name: Set up Connection String id: set-up-connstr @@ -175,7 +180,7 @@ jobs: neon-captest-reuse) CONNSTR=${{ secrets.BENCHMARK_CAPTEST_CONNSTR }} ;; - neon-captest-new | neon-captest-prefetch) + neon-captest-new | neon-captest-prefetch | neon-captest-freetier) CONNSTR=${{ steps.create-neon-project.outputs.dsn }} ;; rds-aurora) @@ -185,7 +190,7 @@ jobs: CONNSTR=${{ secrets.BENCHMARK_RDS_POSTGRES_CONNSTR }} ;; *) - echo 2>&1 "Unknown PLATFORM=${PLATFORM}. Allowed only 'neon-captest-reuse', 'neon-captest-new', 'neon-captest-prefetch', 'rds-aurora', or 'rds-postgres'" + echo 2>&1 "Unknown PLATFORM=${PLATFORM}. Allowed only 'neon-captest-reuse', 'neon-captest-new', 'neon-captest-prefetch', neon-captest-freetier, 'rds-aurora', or 'rds-postgres'" exit 1 ;; esac