|
| 1 | +name: Continuous Benchmark Shard Transfer Speed |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + dataset_name: |
| 7 | + description: 'Dataset name' |
| 8 | + default: 'h-and-m-2048-angular-filters' |
| 9 | + type: string |
| 10 | + qdrant_versions: |
| 11 | + description: 'Comma-separated versions to compare (ghcr/dev, docker/master, docker/v1.13.0). Can be just single version.' |
| 12 | + default: 'ghcr/dev,docker/master' |
| 13 | + type: string |
| 14 | + cluster_nodes: |
| 15 | + description: 'Number of cluster nodes' |
| 16 | + default: '2' |
| 17 | + type: string |
| 18 | + region: |
| 19 | + description: 'Hetzner region' |
| 20 | + default: 'fsn1' |
| 21 | + type: string |
| 22 | + server_type: |
| 23 | + description: 'Hetzner server type' |
| 24 | + default: 'ccx13' |
| 25 | + type: string |
| 26 | + client_type: |
| 27 | + description: 'Hetzner client type' |
| 28 | + default: 'cx33' |
| 29 | + type: string |
| 30 | + schedule: |
| 31 | + - cron: "0 4 * * *" # Daily at 4am UTC |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: hetzner-machines |
| 35 | + |
| 36 | +env: |
| 37 | + HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} |
| 38 | + # Defaults for push trigger (inputs.* is empty on push) |
| 39 | + SERVER_TYPE: ${{ inputs.server_type || 'ccx13' }} |
| 40 | + CLIENT_TYPE: ${{ inputs.client_type || 'cx33' }} |
| 41 | + REGION: ${{ inputs.region || 'fsn1' }} |
| 42 | + DATASET_NAME: ${{ inputs.dataset_name || 'h-and-m-2048-angular-filters' }} |
| 43 | + QDRANT_VERSIONS: ${{ inputs.qdrant_versions || 'ghcr/dev,docker/master' }} |
| 44 | + CLUSTER_NODES: ${{ inputs.cluster_nodes || '2' }} |
| 45 | + |
| 46 | +jobs: |
| 47 | + generateMatrix: |
| 48 | + name: Generate Matrix |
| 49 | + runs-on: ubuntu-latest |
| 50 | + outputs: |
| 51 | + matrix: ${{ steps.generate.outputs.matrix }} |
| 52 | + node_names: ${{ steps.generate.outputs.node_names }} |
| 53 | + client_name: ${{ steps.generate.outputs.client_name }} |
| 54 | + steps: |
| 55 | + - name: Generate machine matrix |
| 56 | + id: generate |
| 57 | + run: | |
| 58 | + RUN_ID=${{ github.run_id }} |
| 59 | +
|
| 60 | + python >> $GITHUB_OUTPUT << "EOF" |
| 61 | + import json |
| 62 | + import os |
| 63 | +
|
| 64 | + NODES = int(os.environ["CLUSTER_NODES"]) |
| 65 | + RUN_ID = ${{ github.run_id }} |
| 66 | +
|
| 67 | + machines = [] |
| 68 | + node_names = [] |
| 69 | + for i in range(NODES): |
| 70 | + machines.append({ |
| 71 | + "name": f"node-{i}", "suffix": f"node-{i}", "type": "SERVER_TYPE" |
| 72 | + }) |
| 73 | + node_names.append(f"transfer-bench-node-{i}-{RUN_ID}") |
| 74 | + machines.append({ |
| 75 | + "name": "client", "suffix": "client", "type": "CLIENT_TYPE" |
| 76 | + }) |
| 77 | +
|
| 78 | + print(f"matrix={json.dumps({'machine': machines})}") |
| 79 | + print(f'node_names={" ".join(node_names)}') |
| 80 | + print(f"client_name=transfer-bench-client-{RUN_ID}") |
| 81 | + EOF |
| 82 | +
|
| 83 | + setupCluster: |
| 84 | + name: Setup ${{ matrix.machine.name }} |
| 85 | + needs: generateMatrix |
| 86 | + runs-on: ubuntu-latest |
| 87 | + strategy: |
| 88 | + fail-fast: true |
| 89 | + matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }} |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + - uses: webfactory/ssh-agent@v0.8.0 |
| 93 | + with: |
| 94 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 95 | + - name: Setup CI tools |
| 96 | + run: bash -x tools/setup_ci.sh |
| 97 | + - name: Create machine |
| 98 | + uses: ./.github/workflows/actions/create-server-with-retry |
| 99 | + with: |
| 100 | + server_name: transfer-bench-${{ matrix.machine.suffix }}-${{ github.run_id }} |
| 101 | + server_type: ${{ matrix.machine.type == 'CLIENT_TYPE' && env.CLIENT_TYPE || env.SERVER_TYPE }} |
| 102 | + region: ${{ env.REGION }} |
| 103 | + max_retries: 2 |
| 104 | + |
| 105 | + runBenchmark: |
| 106 | + name: Run Transfer Benchmark |
| 107 | + needs: [generateMatrix, setupCluster] |
| 108 | + runs-on: ubuntu-latest |
| 109 | + container: alpine/ansible:2.18.1 |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v4 |
| 112 | + - uses: webfactory/ssh-agent@v0.8.0 |
| 113 | + with: |
| 114 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 115 | + - name: Create inventory |
| 116 | + uses: ./.github/workflows/actions/create-inventory |
| 117 | + with: |
| 118 | + hcloud_token: ${{ secrets.HCLOUD_TOKEN }} |
| 119 | + server_names: ${{ needs.generateMatrix.outputs.node_names }} |
| 120 | + client_names: ${{ needs.generateMatrix.outputs.client_name }} |
| 121 | + db_host: ${{ secrets.POSTGRES_HOST }} |
| 122 | + - name: Run benchmarks for all versions |
| 123 | + run: | |
| 124 | + echo "$QDRANT_VERSIONS" | tr ',' '\n' | while read -r QDRANT_VERSION; do |
| 125 | + QDRANT_VERSION=$(echo "$QDRANT_VERSION" | xargs) |
| 126 | + [ -z "$QDRANT_VERSION" ] && continue |
| 127 | +
|
| 128 | + echo "==========================================" |
| 129 | + echo "Benchmarking Qdrant version: $QDRANT_VERSION" |
| 130 | + echo "==========================================" |
| 131 | +
|
| 132 | + case "${QDRANT_VERSION}" in |
| 133 | + docker/*) |
| 134 | + CONTAINER_REGISTRY="docker.io" |
| 135 | + VERSION=${QDRANT_VERSION#docker/} |
| 136 | + ;; |
| 137 | + ghcr/*) |
| 138 | + CONTAINER_REGISTRY="ghcr.io" |
| 139 | + VERSION=${QDRANT_VERSION#ghcr/} |
| 140 | + ;; |
| 141 | + *) |
| 142 | + echo "Error: unknown version ${QDRANT_VERSION}. Version name should start with 'docker/' or 'ghcr/'" |
| 143 | + exit 1 |
| 144 | + ;; |
| 145 | + esac |
| 146 | +
|
| 147 | + ansible-playbook ansible/playbooks/playbook-transfer-speed.yml \ |
| 148 | + -i ansible/playbooks/inventory.ini \ |
| 149 | + --extra-vars "dataset_name=${DATASET_NAME} server_registry=${CONTAINER_REGISTRY} server_version=${VERSION}" |
| 150 | + done |
| 151 | + env: |
| 152 | + ANSIBLE_HOST_KEY_CHECKING: "False" |
| 153 | + ANSIBLE_SSH_ARGS: "-o ServerAliveInterval=30 -o ServerAliveCountMax=10 -o ControlMaster=no" |
| 154 | + ANSIBLE_STDOUT_CALLBACK: yaml |
| 155 | + QDRANT_VERSIONS: ${{ env.QDRANT_VERSIONS }} |
| 156 | + DATASET_NAME: ${{ env.DATASET_NAME }} |
| 157 | + |
| 158 | + cleanup: |
| 159 | + name: Cleanup Cluster |
| 160 | + needs: [generateMatrix, runBenchmark] |
| 161 | + if: always() |
| 162 | + runs-on: ubuntu-latest |
| 163 | + steps: |
| 164 | + - uses: actions/checkout@v4 |
| 165 | + - name: Setup CI tools |
| 166 | + run: bash -x tools/setup_ci.sh |
| 167 | + env: |
| 168 | + HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} |
| 169 | + - name: Delete machines |
| 170 | + env: |
| 171 | + NODE_NAMES: ${{ needs.generateMatrix.outputs.node_names }} |
| 172 | + CLIENT_NAME: ${{ needs.generateMatrix.outputs.client_name }} |
| 173 | + HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} |
| 174 | + run: echo $NODE_NAMES $CLIENT_NAME | xargs -P0 -n1 hcloud server delete |
0 commit comments