|
9 | 9 | - "go.mod" |
10 | 10 | - "go.sum" |
11 | 11 | - "scripts/ci/dns-benchmark-compare.sh" |
| 12 | + - "scripts/ci/dns-benchmark-suite-runner.sh" |
| 13 | + - "scripts/ci/dns-benchmark-suites.sh" |
| 14 | + - "scripts/ci/benchmarks/**" |
12 | 15 | - ".github/workflows/dns-benchmark-compare.yml" |
13 | 16 | workflow_dispatch: |
14 | 17 | inputs: |
|
20 | 23 | description: "Head ref to benchmark" |
21 | 24 | required: false |
22 | 25 | default: "HEAD" |
23 | | - bench_filter: |
24 | | - description: "Regex to select benchmark names" |
| 26 | + base_strategy: |
| 27 | + description: "Base commit strategy: merge-base or exact" |
25 | 28 | required: false |
26 | | - default: "^Benchmark(AsyncCache|SingleflightOverhead|HighQpsScenario|RealisticDnsQuery|DnsController_Singleflight|PipelinedConn_Concurrent|PipelinedConn_Sequential)$" |
| 29 | + default: "merge-base" |
| 30 | + suite_profile: |
| 31 | + description: "Suite profile: quick or dns-module" |
| 32 | + required: false |
| 33 | + default: "dns-module" |
| 34 | + suite_list: |
| 35 | + description: "Optional comma-separated suite list. Overrides profile." |
| 36 | + required: false |
| 37 | + default: "" |
| 38 | + bench_count: |
| 39 | + description: "go test -count" |
| 40 | + required: false |
| 41 | + default: "3" |
| 42 | + bench_time: |
| 43 | + description: "go test -benchtime" |
| 44 | + required: false |
| 45 | + default: "200ms" |
27 | 46 |
|
28 | 47 | permissions: |
29 | 48 | contents: read |
|
34 | 53 | name: DNS Bench Compare |
35 | 54 | runs-on: ubuntu-22.04 |
36 | 55 | continue-on-error: true |
37 | | - timeout-minutes: 30 |
| 56 | + timeout-minutes: 45 |
38 | 57 |
|
39 | 58 | steps: |
40 | 59 | - name: Checkout |
@@ -63,100 +82,63 @@ jobs: |
63 | 82 | echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" |
64 | 83 |
|
65 | 84 | - name: Run Benchmark Compare |
66 | | - env: |
67 | | - BENCH_FILTER: ${{ github.event.inputs.bench_filter }} |
68 | 85 | run: | |
69 | 86 | set -euo pipefail |
70 | 87 | chmod +x scripts/ci/dns-benchmark-compare.sh |
| 88 | + chmod +x scripts/ci/dns-benchmark-suite-runner.sh |
71 | 89 | mkdir -p bench-artifacts |
72 | 90 | if [[ "${{ github.event_name }}" == "pull_request" ]]; then |
73 | 91 | BASE_REF="origin/${{ github.base_ref }}" |
74 | 92 | HEAD_REF="${{ github.sha }}" |
| 93 | + BASE_STRATEGY="merge-base" |
| 94 | + SUITE_PROFILE="dns-module" |
| 95 | + SUITE_LIST="" |
| 96 | + BENCH_COUNT="3" |
| 97 | + BENCH_TIME="200ms" |
75 | 98 | else |
76 | 99 | BASE_REF="${{ github.event.inputs.base_ref }}" |
77 | 100 | HEAD_REF="${{ github.event.inputs.head_ref }}" |
| 101 | + BASE_STRATEGY="${{ github.event.inputs.base_strategy }}" |
| 102 | + SUITE_PROFILE="${{ github.event.inputs.suite_profile }}" |
| 103 | + SUITE_LIST="${{ github.event.inputs.suite_list }}" |
| 104 | + BENCH_COUNT="${{ github.event.inputs.bench_count }}" |
| 105 | + BENCH_TIME="${{ github.event.inputs.bench_time }}" |
78 | 106 | fi |
79 | | - overall=0 |
80 | | - run_suite() { |
81 | | - suite="$1" |
82 | | - pkg="$2" |
83 | | - filter="$3" |
84 | | - exclude_files="${4:-}" |
85 | | - suite_dir="bench-artifacts/${suite}" |
86 | | - mkdir -p "$suite_dir" |
87 | | - set +e |
88 | | - BENCH_PACKAGE="$pkg" \ |
89 | | - BENCH_FILTER="$filter" \ |
90 | | - BENCH_OVERLAY_DIR="$PWD/scripts/ci/benchmarks" \ |
91 | | - BENCH_EXCLUDE_TEST_FILES="$exclude_files" \ |
92 | | - ARTIFACT_DIR="$PWD/$suite_dir" \ |
93 | | - ./scripts/ci/dns-benchmark-compare.sh "$BASE_REF" "$HEAD_REF" \ |
94 | | - 2>&1 | tee "$suite_dir/run.log" |
95 | | - status=${PIPESTATUS[0]} |
96 | | - set -e |
97 | | - if [[ $status -ne 0 && ! -f "$suite_dir/report.md" ]]; then |
98 | | - { |
99 | | - echo "## DNS Benchmark Compare (${suite})" |
100 | | - echo |
101 | | - echo "- Status: failed" |
102 | | - echo "- Exit code: \`$status\`" |
103 | | - echo "- Base ref: \`$BASE_REF\`" |
104 | | - echo "- Head ref: \`$HEAD_REF\`" |
105 | | - echo "- Package: \`$pkg\`" |
106 | | - echo |
107 | | - echo "### Failure Log (tail)" |
108 | | - echo |
109 | | - echo '```text' |
110 | | - tail -n 200 "$suite_dir/run.log" || true |
111 | | - echo '```' |
112 | | - } > "$suite_dir/report.md" |
113 | | - fi |
114 | | - echo "$status" > "$suite_dir/status.txt" |
115 | | - if [[ $status -ne 0 ]]; then |
116 | | - overall=1 |
117 | | - fi |
118 | | - } |
119 | 107 |
|
120 | | - run_suite "control_dns" \ |
121 | | - "./control" \ |
122 | | - "^Benchmark(AsyncCache|SingleflightOverhead|HighQpsScenario|RealisticDnsQuery|DnsController_Singleflight|PipelinedConn_Concurrent|PipelinedConn_Sequential)$" \ |
123 | | - "control/tcp_test.go,control/tcp_splice_bench_test.go" |
124 | | -
|
125 | | - run_suite "component_dns" \ |
126 | | - "./component/dns" \ |
127 | | - "^BenchmarkUpstreamResolver_GetUpstream_(Serial|Parallel)$" |
128 | | -
|
129 | | - { |
130 | | - echo "## DNS Benchmark Compare" |
131 | | - echo |
132 | | - echo "- Base ref: \`$BASE_REF\`" |
133 | | - echo "- Head ref: \`$HEAD_REF\`" |
134 | | - echo |
135 | | - echo "### Suite Status" |
136 | | - echo |
137 | | - control_status="$(cat bench-artifacts/control_dns/status.txt 2>/dev/null || echo 1)" |
138 | | - comp_status="$(cat bench-artifacts/component_dns/status.txt 2>/dev/null || echo 1)" |
139 | | - echo "- control_dns: $([[ \"$control_status\" == \"0\" ]] && echo 'success' || echo 'failed')" |
140 | | - echo "- component_dns: $([[ \"$comp_status\" == \"0\" ]] && echo 'success' || echo 'failed')" |
141 | | - echo |
142 | | - echo "### control_dns" |
143 | | - echo |
144 | | - if [[ -f bench-artifacts/control_dns/report.md ]]; then |
145 | | - cat bench-artifacts/control_dns/report.md |
146 | | - else |
147 | | - echo "_No report generated_" |
148 | | - fi |
149 | | - echo |
150 | | - echo "### component_dns" |
151 | | - echo |
152 | | - if [[ -f bench-artifacts/component_dns/report.md ]]; then |
153 | | - cat bench-artifacts/component_dns/report.md |
154 | | - else |
155 | | - echo "_No report generated_" |
156 | | - fi |
157 | | - } > bench-artifacts/report.md |
158 | | -
|
159 | | - exit $overall |
| 108 | + set +e |
| 109 | + DNS_BENCH_PROFILE="$SUITE_PROFILE" \ |
| 110 | + DNS_BENCH_SUITES="$SUITE_LIST" \ |
| 111 | + BENCH_COUNT="$BENCH_COUNT" \ |
| 112 | + BENCH_TIME="$BENCH_TIME" \ |
| 113 | + BASE_COMMIT_STRATEGY="$BASE_STRATEGY" \ |
| 114 | + ARTIFACT_DIR="$PWD/bench-artifacts" \ |
| 115 | + ./scripts/ci/dns-benchmark-suite-runner.sh "$BASE_REF" "$HEAD_REF" \ |
| 116 | + 2>&1 | tee bench-artifacts/run.log |
| 117 | + status=${PIPESTATUS[0]} |
| 118 | + set -e |
| 119 | +
|
| 120 | + if [[ $status -ne 0 && ! -f bench-artifacts/report.md ]]; then |
| 121 | + { |
| 122 | + echo "## DNS Benchmark Compare" |
| 123 | + echo |
| 124 | + echo "- Status: failed" |
| 125 | + echo "- Exit code: \`$status\`" |
| 126 | + echo "- Base ref: \`$BASE_REF\`" |
| 127 | + echo "- Head ref: \`$HEAD_REF\`" |
| 128 | + echo "- Base strategy: \`$BASE_STRATEGY\`" |
| 129 | + echo "- Suite profile: \`$SUITE_PROFILE\`" |
| 130 | + if [[ -n "$SUITE_LIST" ]]; then |
| 131 | + echo "- Suite selection: \`$SUITE_LIST\`" |
| 132 | + fi |
| 133 | + echo |
| 134 | + echo "### Failure Log (tail)" |
| 135 | + echo |
| 136 | + echo '```text' |
| 137 | + tail -n 200 bench-artifacts/run.log || true |
| 138 | + echo '```' |
| 139 | + } > bench-artifacts/report.md |
| 140 | + fi |
| 141 | + exit $status |
160 | 142 |
|
161 | 143 | - name: Upload Benchmark Artifacts |
162 | 144 | if: always() |
|
0 commit comments