-
Notifications
You must be signed in to change notification settings - Fork 60
Establish performance baselines and regression detection #3441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dheerajodha
wants to merge
18
commits into
conforma:main
Choose a base branch
from
dheerajodha:EC-1819
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
52ca11d
feat(EC-1818): add stress benchmark CI workflow
dheerajodha 6e5b77e
chore(EC-1818): bump stress benchmark to 40 components, 10 workers
dheerajodha a3c5853
fix(EC-1818): address review feedback on benchmark workflow
dheerajodha 4c9d380
chore(EC-1818): bump stress benchmark to 80 components
dheerajodha 804e569
fix(EC-1818): capture stderr and use lowercase job ID
dheerajodha e2db3f5
chore(EC-1818): revert stress components to default 10
dheerajodha e3e75eb
fix(EC-1818): address review feedback on benchmark workflow
dheerajodha 9003852
fix(EC-1818): add job timeout to benchmark workflow
dheerajodha be8a21f
fix(EC-1818): only show stderr in job summary on failure
dheerajodha 8545c00
fix(EC-1818): add descriptions to job summary metrics table
dheerajodha c9c79eb
fix(EC-1818): update benchmark time estimate to match CI observations
033e8bb
fix: allow past effective time in stress benchmark
fc37eb1
chore: update action pins in benchmark workflow
21a4696
feat(EC-1819): add performance baselines and regression detection
dheerajodha 72d5ae1
fix: address issues in baseline regression detection
1b0851c
fix: address review feedback on baseline regression detection
1d0e623
fix: harden benchmark scripts against injection and edge cases
7ff9496
docs: document stress benchmark baseline and regression detection
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| # Copyright The Conforma Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| --- | ||
| name: Stress Benchmark | ||
|
|
||
| "on": | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
|
|
||
| stress: | ||
| name: Stress Benchmark | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| env: | ||
| # Tuned for 4 vCPU / 16 GB CI runners to complete within 5 minutes. | ||
|
dheerajodha marked this conversation as resolved.
|
||
| # Code defaults are 10 components / 35 workers. | ||
| EC_STRESS_COMPONENTS: "10" | ||
| EC_STRESS_WORKERS: "10" | ||
| steps: | ||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1 | ||
| with: | ||
| egress-policy: audit | ||
| disable-telemetry: true | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | ||
|
|
||
| - name: Restore Cache | ||
| uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0 | ||
| with: | ||
| key: main | ||
| path: '**' | ||
|
|
||
| - name: Setup Go environment | ||
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | ||
| with: | ||
| go-version-file: go.mod | ||
|
dheerajodha marked this conversation as resolved.
|
||
| cache: false | ||
|
|
||
| - name: Setup ORAS | ||
| uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2.0.1 | ||
|
|
||
| - name: Prepare benchmark data | ||
| run: | | ||
| cd benchmark/stress | ||
| ./prepare_data.sh | ||
|
|
||
| - name: Build stress benchmark | ||
| run: go build -o benchmark/stress/stress ./benchmark/stress | ||
|
|
||
| - name: Run stress benchmark | ||
| id: bench | ||
| continue-on-error: true | ||
| run: | | ||
| set -o pipefail | ||
| cd benchmark/stress | ||
| ./stress 2>benchmark-stderr.txt | tee benchmark-output.txt | ||
|
|
||
| - name: Compare against baseline | ||
| id: compare | ||
| if: steps.bench.outcome == 'success' | ||
| run: | | ||
| cd benchmark/stress | ||
| if [[ -f baseline.json ]]; then | ||
| ./compare.sh benchmark-output.txt | ||
| else | ||
| echo "No baseline found, skipping comparison." | ||
| fi | ||
|
|
||
| - name: Write job summary | ||
| if: always() | ||
| run: | | ||
| if [[ "${{ steps.bench.outcome }}" == "failure" && -s benchmark/stress/benchmark-stderr.txt ]]; then | ||
| { | ||
| echo "### Stderr" | ||
| echo '```' | ||
| tail -50 benchmark/stress/benchmark-stderr.txt | ||
| echo '```' | ||
|
dheerajodha marked this conversation as resolved.
|
||
| } >> "$GITHUB_STEP_SUMMARY" | ||
| fi | ||
|
|
||
| if [[ ! -f benchmark/stress/benchmark-output.txt ]]; then | ||
| echo "## Stress Benchmark" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "Benchmark did not produce output." >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
| fi | ||
|
|
||
| line=$(grep '^BenchmarkStress' benchmark/stress/benchmark-output.txt || true) | ||
| if [[ -z "$line" ]]; then | ||
| echo "## Stress Benchmark" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "No benchmark results found in output." >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
| fi | ||
|
|
||
| read -r ns_op peak_rss alloc heap < <(BENCH_LINE="$line" python3 -c " | ||
| import os, re | ||
| line = os.environ['BENCH_LINE'] | ||
| def val(p): | ||
| m = re.search(p, line) | ||
| return m.group(1) if m else '0' | ||
| print(val(r'([\d.]+)\s+ns/op'), val(r'([\d.]+)\s+peak-RSS-bytes'), val(r'([\d.]+)\s+allocated-bytes/op'), val(r'([\d.]+)\s+heap-bytes-from-system')) | ||
| ") | ||
|
|
||
| secs=$(awk -v val="${ns_op:-0}" 'BEGIN {printf "%.1f", val / 1000000000}') | ||
| rss_mb=$(awk -v val="${peak_rss:-0}" 'BEGIN {printf "%.0f", val / 1048576}') | ||
| alloc_mb=$(awk -v val="${alloc:-0}" 'BEGIN {printf "%.0f", val / 1048576}') | ||
| heap_mb=$(awk -v val="${heap:-0}" 'BEGIN {printf "%.0f", val / 1048576}') | ||
|
|
||
| has_baseline=false | ||
| if [[ -f benchmark/stress/baseline.json ]]; then | ||
| has_baseline=true | ||
| bl_rss=$(python3 -c "import json; print(json.load(open('benchmark/stress/baseline.json'))['peak_rss_bytes'])") | ||
| bl_ns=$(python3 -c "import json; print(json.load(open('benchmark/stress/baseline.json'))['ns_per_op'])") | ||
| bl_rss_mb=$(awk -v val="$bl_rss" 'BEGIN {printf "%.0f", val / 1048576}') | ||
| bl_secs=$(awk -v val="$bl_ns" 'BEGIN {printf "%.1f", val / 1000000000}') | ||
| rss_change=$(awk -v cur="$peak_rss" -v base="$bl_rss" 'BEGIN {printf "%+.1f", ((cur - base) / base) * 100}') | ||
| time_change=$(awk -v cur="$ns_op" -v base="$bl_ns" 'BEGIN {printf "%+.1f", ((cur - base) / base) * 100}') | ||
| fi | ||
|
|
||
| { | ||
| echo "## Stress Benchmark" | ||
| echo "" | ||
| if [[ "$has_baseline" == "true" ]]; then | ||
| echo "| Metric | Current | Baseline | Change | Description |" | ||
| echo "|--------|---------|----------|--------|-------------|" | ||
| echo "| Components | ${EC_STRESS_COMPONENTS} | | | Snapshot components validated |" | ||
| echo "| Workers | ${EC_STRESS_WORKERS} | | | Parallel validation workers |" | ||
| echo "| Execution time | ${secs}s | ${bl_secs}s | ${time_change}% | Wall-clock time per iteration |" | ||
| echo "| Peak RSS | ${rss_mb} MB | ${bl_rss_mb} MB | ${rss_change}% | Max physical memory used |" | ||
| echo "| Allocated memory | ${alloc_mb} MB | | | Total Go heap allocations |" | ||
| echo "| Heap from system | ${heap_mb} MB | | | Heap memory requested from OS |" | ||
| else | ||
| echo "| Metric | Value | Description |" | ||
| echo "|--------|-------|-------------|" | ||
| echo "| Components | ${EC_STRESS_COMPONENTS} | Snapshot components validated |" | ||
| echo "| Workers | ${EC_STRESS_WORKERS} | Parallel validation workers |" | ||
| echo "| Execution time | ${secs}s | Wall-clock time per iteration |" | ||
| echo "| Peak RSS | ${rss_mb} MB | Max physical memory used |" | ||
| echo "| Allocated memory | ${alloc_mb} MB | Total Go heap allocations |" | ||
| echo "| Heap from system | ${heap_mb} MB | Heap memory requested from OS |" | ||
| fi | ||
| if [[ "${{ steps.compare.outcome }}" == "failure" ]]; then | ||
| echo "" | ||
| echo "> **⚠️ Performance regression detected.** Update the baseline with \`make generate-baseline\` if this is expected." | ||
| fi | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "peak_rss_bytes": 2250485760, | ||
| "ns_per_op": 2567888013, | ||
| "components": 10, | ||
| "workers": 10, | ||
| "commit": "fc37eb13", | ||
| "date": "2026-08-11", | ||
| "go_version": "1.26.3" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.