Skip to content

Commit 47ba942

Browse files
author
fasterrt
committed
probe: runner label availability + vtop peak CPU-request measurement
Temporary investigation branch. Not for merge.
1 parent 3a64a91 commit 47ba942

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

‎.github/workflows/a1_labels.yml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: a1_labels
2+
on:
3+
push:
4+
branches:
5+
- "a1-probe-*"
6+
7+
jobs:
8+
probe:
9+
name: probe (${{ matrix.label }})
10+
continue-on-error: true
11+
timeout-minutes: 6
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
label:
16+
- oracle-vm-8cpu-32gb-x86-64
17+
- gh-hosted-runners-16cores-1-24.04
18+
- ubuntu-latest-4-cores
19+
- ubuntu-latest-8-cores
20+
runs-on: ${{ matrix.label }}
21+
steps:
22+
- name: capacity
23+
run: |
24+
echo "LABEL=${{ matrix.label }}"
25+
echo "CPUS=$(nproc)"
26+
free -m | sed -n '2p'
27+
df -h / | tail -1
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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

Comments
 (0)