|
| 1 | +name: a1_vtop_capacity |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "a1-probe-*" |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: VTop Capacity Probe (${{ matrix.label }}) |
| 10 | + continue-on-error: true |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + label: |
| 15 | + - ubuntu-latest-xl |
| 16 | + runs-on: ${{ matrix.label }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Check out code |
| 20 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 21 | + with: |
| 22 | + persist-credentials: 'false' |
| 23 | + |
| 24 | + - name: Host capacity |
| 25 | + run: | |
| 26 | + echo "LABEL=${{ matrix.label }}" |
| 27 | + echo "CPUS=$(nproc)" |
| 28 | + free -m | sed -n '2p' |
| 29 | +
|
| 30 | + - name: Set up Go |
| 31 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 32 | + with: |
| 33 | + go-version-file: go.mod |
| 34 | + |
| 35 | + - name: Tune the OS |
| 36 | + uses: ./.github/actions/tune-os |
| 37 | + |
| 38 | + - name: Setup MySQL |
| 39 | + uses: ./.github/actions/setup-mysql |
| 40 | + with: |
| 41 | + flavor: mysql-8.4 |
| 42 | + |
| 43 | + - name: Get dependencies |
| 44 | + run: | |
| 45 | + sudo apt-get install -y make |
| 46 | + go mod download |
| 47 | +
|
| 48 | + - name: Build vitess |
| 49 | + run: | |
| 50 | + make build |
| 51 | +
|
| 52 | + - name: Install kubectl & kind |
| 53 | + run: | |
| 54 | + make install_kubectl_kind |
| 55 | +
|
| 56 | + - name: Start CPU-request sampler |
| 57 | + run: | |
| 58 | + cat > /tmp/sampler.sh <<'EOS' |
| 59 | + #!/usr/bin/env bash |
| 60 | + # Samples node-level scheduled CPU/memory *requests* every 10s. |
| 61 | + # Kubernetes schedules on requests, so peak requests == the real node sizing requirement. |
| 62 | + echo "ts,cpu_req_m,mem_req_mi,pods_total,pods_pending" > /tmp/cap.csv |
| 63 | + while true; do |
| 64 | + desc=$(kubectl describe node 2>/dev/null | awk '/^Allocated resources:/{f=1} f&&/^ cpu /{print $2; exit}') |
| 65 | + memd=$(kubectl describe node 2>/dev/null | awk '/^Allocated resources:/{f=1} f&&/^ memory /{print $2; exit}') |
| 66 | + tot=$(kubectl get pods -A --no-headers 2>/dev/null | wc -l | tr -d ' ') |
| 67 | + pend=$(kubectl get pods -A --no-headers 2>/dev/null | grep -c Pending) |
| 68 | + [ -n "$desc" ] && echo "$(date -u +%H:%M:%S),${desc%m},${memd%Mi},$tot,$pend" >> /tmp/cap.csv |
| 69 | + sleep 10 |
| 70 | + done |
| 71 | + EOS |
| 72 | + chmod +x /tmp/sampler.sh |
| 73 | + nohup /tmp/sampler.sh > /tmp/sampler.log 2>&1 & |
| 74 | + echo "sampler pid $!" |
| 75 | +
|
| 76 | + - name: vtop_example |
| 77 | + timeout-minutes: 60 |
| 78 | + run: | |
| 79 | + source build.env |
| 80 | + go run test.go -docker=false -skip-build -print-log -follow -timeout=60m vtop_example |
| 81 | +
|
| 82 | + - name: Peak scheduled-request report |
| 83 | + if: always() |
| 84 | + run: | |
| 85 | + set +e |
| 86 | + echo "::group::raw samples" |
| 87 | + cat /tmp/cap.csv |
| 88 | + echo "::endgroup::" |
| 89 | + echo "===== A1 CAPACITY RESULT =====" |
| 90 | + echo "HOST_CPUS=$(nproc)" |
| 91 | + awk -F, 'NR>1 && $2+0>m {m=$2+0} END {printf "PEAK_CPU_REQUEST_MILLICORES=%d\n", m}' /tmp/cap.csv |
| 92 | + awk -F, 'NR>1 && $3+0>m {m=$3+0} END {printf "PEAK_MEM_REQUEST_MI=%d\n", m}' /tmp/cap.csv |
| 93 | + awk -F, 'NR>1 && $4+0>m {m=$4+0} END {printf "PEAK_POD_COUNT=%d\n", m}' /tmp/cap.csv |
| 94 | + awk -F, 'NR>1 {s+=$5} END {printf "PENDING_SAMPLE_TOTAL=%d\n", s}' /tmp/cap.csv |
| 95 | + echo "SAMPLES=$(( $(wc -l < /tmp/cap.csv) - 1 ))" |
| 96 | + echo "==============================" |
0 commit comments